Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float angle;
- float widthVar;
- float rotationSpeed;
- void setup()
- {
- //set the size of the panel
- size(600,200);
- //initialization of parameters
- angle = 3;
- widthVar = 0;
- rotationSpeed = 0.1;
- fill(100);
- noStroke();
- rectMode(CENTER);
- rect(width/2,height/2, 40,40);
- }
- void draw()
- {
- background(0);
- pushMatrix();
- //move the origin to the pivot point
- translate(width/2, height/2);
- //pivot the grid
- rotate(radians(angle));
- //
- rectMode(CENTER);
- fill(133*cos(widthVar)*cos(widthVar) + 130);
- rect(0, 0, 40*cos(widthVar),40);
- popMatrix();
- angle = angle + 2.5;
- widthVar = widthVar + rotationSpeed;
- }
Advertisement
Add Comment
Please, Sign In to add comment