Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int frames = 60;
- int thingies = 800;
- Thingie[] th = new Thingie[thingies];
- void setup() {
- size(500, 500);
- noStroke();
- for (int i = 0; i < thingies; i++) {
- th[i] = new Thingie(random(width), random(height), random(1, 3), random(-0.1, 0.1), random(20,50));
- }
- }
- void draw() {
- background(255,0,0);
- float t = (frameCount % frames)/float(frames);
- for (int i=0; i<frames;i++) {
- th[i].draw(t);
- }
- displayMask();
- saveFrame("image#####.gif");
- if (frameCount == frames) noLoop();
- }
- void displayMask() {
- float orgX = width/2;
- float orgY = height/2;
- PGraphics mask = createGraphics(width, height);
- mask.beginDraw();
- mask.background(0);
- mask.fill(255);
- mask.noStroke();
- for (int i=0; i<2; i++) {
- mask.ellipse(width/4+ width/2*i, height/4+40, width*.3, width*.3);
- }
- mask.ellipse(orgX, orgY+40, width*.5, width*.5);
- mask.endDraw();
- mask.filter(BLUR);
- blend(mask, 0, 0, width, height, 0, 0, width, height, DARKEST);
- }
- class Thingie {
- float x, y, scale, rotation, sz;
- Thingie(float _x, float _y, float _scale, float _rotation, float _sz) {
- x = _x;
- y = _y;
- scale = _scale;
- rotation = _rotation;
- sz = _sz;
- }
- void draw(float time) {
- resetMatrix();
- scale(scale);
- translate(x, y);
- rotate(rotation);
- fill(255,255,0,200);
- ellipse(0,-time*height+height, sz, sz);
- ellipse(0,-time*height, sz, sz);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement