Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int outer=20, circles=15, frames=1800, d=20, fc;
- float theta;
- long rs;
- boolean save=false;
- void setup() {
- size(540, 540);
- noStroke();
- rs = (long)random(123);
- }
- void draw() {
- randomSeed(rs);
- background(20);
- createGalaxy(.8, .3, -1, 170);
- createGalaxy(.25, .6, 1, 250);
- theta += TWO_PI/frames;
- if (save && frameCount<=fc+(frames/outer)) saveFrame("images-###.gif");
- }
- void createGalaxy(float _x, float _y, int dir, int max) {
- for (int j=0; j<circles; j++) {
- float angle=0;
- pushMatrix();
- translate(width*_x+random(-d, d), height*_y+random(-d, d));
- rotate(theta*(j+1)*dir);
- float d = random(60, max);
- float sz = random(1, 6);
- float offSet = random(TWO_PI);
- for (int i=0; i<outer; i++) {
- angle=TWO_PI/outer*i;
- float x = cos(angle+offSet)*d;
- float y = sin(angle+offSet)*d;
- for (int k=0; k<5; k++) {
- strokeWeight((k*2));
- stroke(255, 10);
- noFill();
- ellipse(x, y, sz, sz);
- }
- fill(255);
- noStroke();
- ellipse(x, y, sz, sz);
- }
- popMatrix();
- }
- }
- void mouseReleased() {
- rs = (long)random(123);
- randomSeed(rs);
- background(20);
- createGalaxy(.7, .3, -1, 150);
- createGalaxy(.25, .6, 1, 250);
- }
- void keyPressed() {
- fc = frameCount;
- save = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement