Circular movement for a convex arc
in
Programming Questions
•
2 years ago
I am trying to move a sun along a convex arc of 180 degrees.
The timing should be based on second() so that the movement occurs every 3 degrees at each second...any ideas...
// initiate and assign all variables
float angle= 0.0;
float offset=60;
float scalar=200;
void setup() {
size(1200, 800);
background(120, 50, 230);
strokeWeight (2);
frameRate (30);
//draw and move sun incrementally everytime the loop is called
for (float angle=0; angle<180; angle+=3) {
float speed=second();
background(120, 50, 230);
fill(255, 255, 0);
noStroke();
float x=width/2+scalar*sin(radians(angle)-speed);
float y=height/2+scalar*cos(radians(angle)-speed);
ellipse(x, y, 100, 100);
}
}
The timing should be based on second() so that the movement occurs every 3 degrees at each second...any ideas...
// initiate and assign all variables
float angle= 0.0;
float offset=60;
float scalar=200;
void setup() {
size(1200, 800);
background(120, 50, 230);
strokeWeight (2);
frameRate (30);
//draw and move sun incrementally everytime the loop is called
for (float angle=0; angle<180; angle+=3) {
float speed=second();
background(120, 50, 230);
fill(255, 255, 0);
noStroke();
float x=width/2+scalar*sin(radians(angle)-speed);
float y=height/2+scalar*cos(radians(angle)-speed);
ellipse(x, y, 100, 100);
}
}
1