Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int frms = 200; // number of frames of the animation
- float theta = 0; // the angle used for the loop
- void setup() {
- size(500,500);
- }
- void draw() {
- background(0);
- float x = map(sin(theta),-1,1,100,400); // mapping the sine of the angle to a position
- ellipse(x,height/2, 50,50);
- float inc = TWO_PI/frms; // dividing the circle by the number of frames that we want
- theta += inc; // increasing the angle by this amount
- if (frameCount < frms) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement