Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float segmentCount, angleStep, radius, theta;
- void setup() {
- size(500, 500);
- colorMode(HSB, 360, 100, 100);
- //noStroke();
- stroke(350);
- strokeWeight(8);
- }
- void draw() {
- background(350);
- segmentCount = map(sin(theta), -1, 1, 6, 12);
- angleStep=360/segmentCount;
- float div = map(sin(theta),-1,1,4.5,2.5);
- radius = width/div;
- beginShape(TRIANGLE_FAN);
- vertex(width/2, height/2);
- for (float angle=0;angle <=360; angle+=angleStep) {
- float vx = width/2 + cos(radians(angle))*radius;
- float vy = height/2 + sin(radians(angle))*radius;
- vertex(vx, vy);
- fill(angle, 100, 90);
- }
- endShape();
- theta += 0.0523;
- //if (frameCount % 2 == 0 && frameCount < 121) saveFrame("image-###.gif");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement