Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ArrayList thingies = new ArrayList();
- float limit, r, org_x, org_y;
- float sw = 3;
- color bg = #2E2633;
- color s = #DCE9BE;
- void setup() {
- size(500, 500);
- background(bg);
- org_x = width/2;
- org_y = height/2;
- float theta = 0;
- while (theta < 360) {
- r = random(2, 4);
- theta += r;
- Thingie thingie = new Thingie(theta);
- thingies.add(thingie);
- }
- }
- void draw() {
- background(bg);
- for (int i=0; i<thingies.size();i++) {
- Thingie thing = (Thingie) thingies.get(i);
- thing.run();
- }
- if (frameCount % 4 == 0 && frameCount <241) saveFrame("image-###.gif");
- }
- class Thingie {
- float theta, t, x, y;
- Thingie(float _theta) {
- theta= _theta;
- }
- void run() {
- move();
- display();
- }
- void move() {
- x = org_x + sin(theta)*150;
- y = org_y + cos(theta)*150;
- t = map(cos(theta), -1, 1, 0.0523, 0.0523/4);
- //t = 0.0523/4;
- sw = map(sin(theta),-1,1,20,50);
- theta += t;
- }
- void display() {
- //stroke(s,50);
- strokeWeight(.5);
- fill(s,50);
- stroke(s);
- //noStroke();
- ellipse(x, y, sw, sw);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement