Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int circleResolution;
- float radius, theta;
- void setup() {
- size(400, 400);
- background(20);
- stroke(240);
- }
- void draw() {
- fill(20, 30);
- rect(0, 0, width, height);
- translate(width/2, height/2);
- circleResolution = (int) map(sin(theta), -1, 1, 3, 40) ;
- radius = map(sin(theta), -1, 1, 80, 160) ;
- float angle = TWO_PI/circleResolution;
- strokeWeight(1);
- for (int i=0; i<=circleResolution; i++) {
- float x = cos(HALF_PI+angle*i) * radius;
- float y = sin(HALF_PI+angle*i) * radius;
- line(0, 0, x, y);
- }
- theta += 0.0523;
- //if (frameCount % 4 == 0 && frameCount < 121) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement