Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // by dave @ bees & bombs
- int[][] result;
- float t;
- void setup() {
- setup_();
- result = new int[width*height][3];
- }
- void draw() {
- if (!recording) {
- t = mouseX*1.0/width;
- draw_();
- } else {
- for (int i=0; i<width*height; i++)
- for (int a=0; a<3; a++)
- result[i][a] = 0;
- for (int sa=0; sa<samplesPerFrame; sa++) {
- t = map(frameCount-1 + sa*shutterAngle/samplesPerFrame, 0, numFrames, 0, 1);
- draw_();
- loadPixels();
- for (int i=0; i<pixels.length; i++) {
- result[i][0] += pixels[i] >> 16 & 0xff;
- result[i][1] += pixels[i] >> 8 & 0xff;
- result[i][2] += pixels[i] & 0xff;
- }
- }
- loadPixels();
- for (int i=0; i<pixels.length; i++)
- pixels[i] = 0xff << 24 | (result[i][0]/samplesPerFrame) << 16 |
- (result[i][1]/samplesPerFrame) << 8 | (result[i][2]/samplesPerFrame);
- updatePixels();
- saveFrame("g###.png");
- if (frameCount==numFrames)
- exit();
- }
- }
- //////////////////////////////////////////////////////////////////////////////
- int samplesPerFrame = 4;
- int numFrames = 72;
- float shutterAngle = .8;
- boolean recording = false;
- int N = 12;
- float d, y;
- void setup_() {
- size(500, 500);
- colorMode(HSB, 1);
- strokeWeight(9);
- fill(.1);
- }
- void draw_() {
- background(.1);
- pushMatrix();
- translate(width/2, height/2);
- for (int i=-N; i<4*N; i++) {
- stroke((i/float(N)+4)%1, .7, .9);
- y = 300*(t+i/float(N));
- pushMatrix();
- rotate(TWO_PI*i/N);
- d = lerp(250, 600, i/float(N)+t);
- ellipse(0, y, d, d);
- popMatrix();
- }
- popMatrix();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement