Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int num = 1, frms = 100;
- float theta;
- color[] col = {color(255, 50, 0), color(0, 255, 50), color(0, 50, 255)};
- void setup() {
- size(540, 540, P2D);
- }
- void draw() {
- //background(0);
- noStroke();
- fill(20, 30);
- rect(0, 0, width, height);
- for (int i=0; i<num; i++) {
- float offSet = HALF_PI/num*i;
- drawTriangle(offSet);
- }
- theta += TWO_PI/frms;
- if (frameCount> 100 && frameCount<=(100+frms)) saveFrame("image-###.png");
- }
- void drawTriangle(float offSet) {
- float r = map(sin(theta),-1,1,50,150);
- pushMatrix();
- translate(width/2, height/2);
- rotate(theta+offSet);
- beginShape();
- for (int i=0; i<3; i++) {
- float x = cos(TWO_PI/3*i)*r;
- float y = sin(TWO_PI/3*i)*r;
- fill(col[i]);
- vertex(x, y);
- }
- endShape();
- popMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement