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;
- color bg = #2E2633;
- color s = #DCE9BE;
- void setup() {
- size(500, 300);
- background(bg);
- org_x = width/4;
- org_y = height/2;
- }
- void draw() {
- background(bg);
- if (org_x < width *.75) {
- if (frameCount % 4 == 0) {
- Thingie thingie = new Thingie(org_x);
- thingies.add(thingie);
- org_x += random(8, 12);
- }
- }
- for (int i=0; i<thingies.size();i++) {
- Thingie thing = (Thingie) thingies.get(i);
- thing.run();
- }
- }
- void mouseClicked() {
- thingies.clear();
- org_x = width/4;
- }
- class Thingie {
- float theta, t, x, y, sz;
- float alpha = 255;
- Thingie(float _x) {
- x= _x;
- y= height/2 + random(-10, 10);
- sz = int(random(30, 50));
- }
- void run() {
- display();
- }
- void display() {
- fill(s,alpha);
- stroke(s, alpha);
- ellipse(x, y, sz, sz);
- sz -= .35;
- if (sz < 0) alpha = 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement