Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Code by @MetaGlitch
- float fps = 16.666;
- int inFrames = 15;
- int outFrames = 15;
- int otherFrames = 60;
- int numFrames = inFrames + otherFrames + outFrames;
- float t1 = inFrames * 1.0/numFrames;
- float t2 = (inFrames+otherFrames) * 1.0/numFrames;
- int samplesPerFrame = 8;
- float exposure = 0.75; // exposure time in frames. >1 allowed for blending multiple frames
- float subFrameAttenuation = 1; // 1 for weighting every subframe the same. <1 for attenuation effect.
- boolean looping = true; // false: t=1 on the last frame; true: t=1-1/nummFrames on last frame.
- boolean recording = true;
- float a = 0;
- float s = TWO_PI/120;
- void setup_() {
- size(500, 500, P3D);
- smooth(8);
- noStroke();
- noiseDetail(4);
- }
- float exposureCopy = exposure;
- void draw_() {
- // collab settings: hit t=1 and remove motion blur on first and last frame.
- looping = false;
- if (frameCount==1 || frameCount==numFrames) exposure=0;
- else exposure=exposureCopy;
- background(255);
- float x = 250;
- float y = 0;
- if (t<t1) y = map(t, 0, t1, -50, 50); // entry
- if (t>t2) y = map(t, t2, 1, 450, 550); // exit
- if (t>=t1 && t<=t2) {
- y = map(t, t1, t2, 50, 450);
- x = 250 + random(-5,5);
- }
- fill(0);
- ellipse(x, y, 100, 100);
- doLines();
- a+=s;
- }
- //////////////////
- float pingpong(float t) { // / => /\
- return 1-2*abs(t-0.5);
- }
- float ease(float t, float e) {
- return t < 0.5 ? 0.5 * pow(2*t, e) : 1 - 0.5 * pow(2*(1 - t), e);
- }
- float ease(float t, float in, float out) {
- return (1-t)*ease(t, in) + t*ease(t, out);
- }
- // original source code: http://www.openprocessing.org/sketch/151044
- void doLines() {
- //background(226, 210, 184);
- for (int j=50; j<450; j+=25) {
- for (int i=50; i<450; i++) {
- if (j!=50 && j!=440) { //grid
- float step = sin(a)*(sin((450-i)*PI/400.0));
- float swing = j+step*(120.0*noise(a+i/300.0, a+j/300.0, a/10.0)-60.0);
- float dx = randomC()/2;
- float dy = randomC()/2;
- float px = i+dx;
- float py = swing+dy;
- fill(255, 150+150*sqrt(sq(dx)+sq(dy))); // pencil effect
- ellipse(px, py, 2, 2);
- }
- }
- }
- }
- float randomC() {
- float r = random(0, 1);
- float ang = sin(TWO_PI*random(0, 1));
- return r*ang;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement