Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int x, y, counter;
- float outsideRadius, insideRadius, theta;
- int numPoints = 120;
- int[] palette = new int[numPoints];
- void setup() {
- size(400, 400, P2D);
- background(255);
- x = width/2;
- y = height/2;
- frameRate(15);
- for (int i=0; i<numPoints; i++) {
- palette[i] = int(255/numPoints*i);
- }
- }
- void draw() {
- background(0);
- stroke(0);
- strokeWeight(5);
- noStroke();
- float angle = 0;
- float angleStep = 180.0/numPoints;
- insideRadius =80;
- outsideRadius = insideRadius*2;
- beginShape(TRIANGLE_STRIP);
- for (int i = 0; i <= numPoints; i++) {
- float px = x + cos(radians(angle)) * outsideRadius;
- float py = y + sin(radians(angle)) * outsideRadius;
- angle += angleStep;
- vertex(px, py);
- colorMode(HSB, 360, 100, 100);
- fill((i+counter)%numPoints*360/numPoints, 100, 80);
- px = x + cos(radians(angle)) * insideRadius;
- py = y + sin(radians(angle)) * insideRadius;
- vertex(px, py);
- colorMode(RGB);
- angle += angleStep;
- }
- endShape();
- counter++;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement