Hello so below is my code of a simple planet orbiting the sun
final int SUN_DIAM = 50;
final int ORBIT_X = 150;
final int ORBIT_Y = 35;
final int PLANET_DIAM = 25;
final float SPEED = 0.03;
float angle = 0;
final int PLANET_DIAM_CHANGE = 10;
float xPos, yPos;
void setup () {
size(500, 500);
}
void draw () {
background(0);
fill(255, 255, 0);
circle(width/2, height/2, SUN_DIAM);
xPos= (width/2)+ORBIT_Xcos(angle);
yPos= (height/2)+ORBIT_Ysin(angle);
fill(120);
circle(xPos, yPos, PLANET_DIAM);
angle = angle + SPEED;
}
So now I want to make the diameter of the planet change, depending on angle using a sin or cos function. Thank you !