Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float org_x, org_y, r;
- int num = 100;
- Thingie[] things = new Thingie[num];
- color bg = #ECD078;
- color f = #542437;
- void setup() {
- size(500, 500);
- background(bg);
- stroke(f,220);
- fill(bg,50);
- strokeWeight(3);
- rectMode(CENTER);
- org_x = width/2;
- org_y = height/2;
- float start = 150;
- float theta = 0;
- for (int i=0; i<num; i++) {
- float x = sin(theta)*start;
- float y = cos(theta)*start;
- things[i]=new Thingie(x, y, theta);
- theta += TAU/num;
- }
- }
- void draw() {
- background(bg);
- for (int i=0; i<things.length;i++) {
- things[i].display();
- }
- r += 0.0523;
- //if (frameCount % 4 ==0 && frameCount < 121) saveFrame("image-####.gif");
- }
- class Thingie {
- float x, y, theta, diam;
- Thingie(float _x, float _y, float _theta) {
- x = _x;
- y = _y;
- theta = _theta;
- }
- void display() {
- diam=map(sin(theta),-1,1,20,80);
- translate(org_x, org_y);
- rotate(r);
- rect(x,y, diam, diam);
- resetMatrix();
- theta += 0.0523;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement