Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float theta, lx, ly, sz;
- int frames=60, rows, cols, edge=0;
- void setup() {
- size(500, 500);
- rows=height/5;
- cols=width/5;
- lx = width/cols;
- ly = height/rows;
- noStroke();
- }
- void draw() {
- background(#202020);
- drawStuff(width*.5, height*.33, #ffffff,1,2);
- drawStuff(width*.5, height*.5, #ffffff,1,3);
- drawStuff(width*.5, height*.66, #ffffff,1,4);
- theta -=TWO_PI/frames;
- if (frameCount<=frames) saveFrame("image-###.gif");
- }
- void drawStuff(float ox, float oy, color col, int r, int o) {
- for (int i=edge; i<cols-edge; i++) {
- for (int j=edge; j<rows-edge; j++) {
- fill(col,20);
- float x = (i+.5)*lx;
- float y = (j+.5)*ly;
- float distance = dist(x, y, ox, oy);
- //float distance = dist(x,y,width/2,height/2);
- float offSet = map(distance, 0, sqrt(sq(width/2)+sq(height/2)), 0, TWO_PI);
- float sz = map(sin(theta*r+offSet*o), -1, 1, 0, 35);
- ellipse(x, y, sz, sz);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement