Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int circleResolution, s;
- float radius, theta, angle;
- void setup() {
- size(500, 500);
- background(20);
- }
- void draw() {
- strokeCap(SQUARE);
- background(20);
- translate(width/2, height/2);
- circleResolution = (int) map(sin(theta), -1, 1, 40, 70) ;
- radius = map(sin(theta), -1, 1, 100, 150) ;
- angle = TWO_PI/circleResolution;
- drawCircle(20, 240, 1.0);
- drawCircle(15, 20, .75);
- drawCircle(10, 240, .5);
- theta += 0.0523;
- if (frameCount % 4 == 0 && frameCount < 121) saveFrame("image-###.gif");
- }
- void drawCircle(int sw, int s, float scal) {
- strokeWeight(sw);
- stroke(s,200);
- for (int i=0; i<=circleResolution; i++) {
- float x = cos(HALF_PI+angle*i) * radius*scal*random(1, 1.5);
- float y = sin(HALF_PI+angle*i) * radius*scal*random(1, 1.5);
- line(0, 0, x, y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement