Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void setup() {
- size(640, 360);
- }
- void draw() {
- background(260);
- pushMatrix();
- translate(width*0.2, height*0.5);
- rotate(frameCount / 20.0);
- star(0, 100, 15, 240, 3);
- popMatrix();
- fill(20, 130, 200);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 45.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(260, 30, 45);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 40.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(260, 30, 260);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 35.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(26, 260, 255);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 30.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(260, 150, 45);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 25.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(260, 30, 45);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 20.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(260, 260, 45);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 15.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(260, 30, 45);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 14.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(150, 260, 45);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 10.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(260, 0, 0);
- pushMatrix();
- translate(width*0.7, height*0.5);
- rotate(frameCount / 12.0);
- star(0, 200, 80, 100, 40);
- popMatrix();
- fill(260, 150, 0);
- pushMatrix();
- translate(width*0.8, height*0.5);
- rotate(frameCount / -30.0);
- star(0, 20, 30, 120, 5);
- popMatrix();
- fill(150, 26, 260);
- }
- void star(float x, float y, float radius1, float radius2, int npoints) {
- float angle = TWO_PI / npoints;
- float halfAngle = angle/2.0;
- beginShape();
- for (float a = 0; a < TWO_PI; a += angle) {
- float sx = x + cos(a) * radius2;
- float sy = y + sin(a) * radius2;
- vertex(sx, sy);
- sx = x + cos(a+halfAngle) * radius1;
- sy = y + sin(a+halfAngle) * radius1;
- vertex(sx, sy);
- }
- endShape(CLOSE);
- }
Add Comment
Please, Sign In to add comment