 # ONE-LINERS: Grow a picture or video from a single line of C or Python code

One-liner videos are grown in the same way as one-liner pictures except there's an additional keyword 'tfrac' (for time fraction) which represents the proportion of the way through the video. The video generator program successively assigns values to tfrac to generate each frame of video in turn. These values are uniformly spaced in the interval (0,1] so the program will work the same way no matter how many frames are in the video (the default is 32).

 cos(x/15+tfrac*2*pi) Moving cosine A simple one-liner to illustrate the concept ((y+40+100*fabs(cos(tfrac*pi)))*(y+40+100*fabs(cos(tfrac*pi)))+x*x<40*40)*(5*((x+40)*blue)) + (y > 80)*(y*green) Bouncing planet ((x ^ y) >> (x & ~y & int(127*tfrac)))*green + ((x ^ y) >> (~x & y & int(31*tfrac)))*red + ((x ^ y) >> (x & y & int(63*tfrac)))*blue Madly animated carpet sin(x/40.0+tfrac*4*pi)*green + cos(x/40.0-tfrac*6*pi)*red + sin(-x/40.0+tfrac*2*pi)*blue Dancing colours cos(sqrt(sqrt(x*x*x*x+y*y*y*y))/10.0)*red + cos(sqrt(sqrt(x*x*x*x+y*y*y*y))/5.0+tfrac*2*pi)*green + cos(sqrt(sqrt(x*x*x*x+y*y*y*y))/3.0)*blue Animated logo (y>-70&&y<-40&&x-100*(2*tfrac-1)>-33&&x-100*(2*tfrac-1)<33) ? red+green+blue*0.5 : (y>40&&y<70&&x-100*(2*tfrac-1)>-33&&x-100*(2*tfrac-1)<33) ? blue*0.6 : (x & 16) ? white : black Stepping feet illusion rand()%100000+ tfrac*(x*x+y*y < tfrac*tfrac*200*200)*(blue*x+red*y) Static stopper (abs((x+64)*cos(tfrac*pi)-(y-48)*sin(tfrac*pi))<20/2 && abs((x+64)*sin(tfrac*pi)+(y-48)*cos(tfrac*pi))<80/2)*green + (abs(x*cos(2*tfrac*pi)-(y+64)*sin(2*tfrac*pi))<20/2 && abs(x*sin(2*tfrac*pi)+(y+64)*cos(2*tfrac*pi))<80/2)*red + (abs((x-64)*cos(-tfrac*pi)-(y-48)*sin(-tfrac*pi))<20/2 && abs((x-64)*sin(-tfrac*pi)+(y-48)*cos(-tfrac*pi))<80/2)*blue Spinners ((x-80*sin(y/(4+2*cos(tfrac*2*pi))))*(x-80*sin((y-1)/(4+2*cos(tfrac*2*pi))))<0 && blue || white) Spring (x*x+y*y > 100*100)*white + (x*x+y*y <= 100*100)*((tfrac*2*pi > pi)*((x >= 0)||(x < 0 && -y < x/tan(tfrac*2*pi))) ? green*(1-tfrac) : black + (tfrac*2*pi <= pi)*((x >= 0 && -y > x/tan(tfrac*2*pi)) ? green*(1-tfrac) : black)) Sweep (tfrac <= 0.167) ? (abs(x)+abs(y/(2*tfrac)) < 110 ? (x*x+y*y<40*40 ? (x*x+y*y<20*20 ? black : (red+green/2+rand()%2000)*0.3) : white) : (blue+green)*0.5) : (tfrac <= 0.833) ? (abs(x)+abs(y*3) < 110 ? (x*x+y*y<40*40? (x*x+y*y<20*20 ? black : (red+green/2+rand()%2000)*0.3) : white) : (blue+green)*0.5) : (tfrac <= 1) ? (abs(x)+abs(y/(2.001-2*tfrac)) < 110 ? (x*x+y*y<40*40? (x*x+y*y<20*20 ? black : (red+green/2+rand()%2000)*0.3) : white) : (blue+green)*0.5) Alien Blink blue*(pow((((int)(81.0 * atan2(x*cos(tfrac*2*pi)-y*sin(tfrac*2*pi), x*sin(tfrac*2*pi)+y*cos(tfrac*2*pi)))) & 31) - 15, 2) + pow((((int)(2.0 * sqrt(x*x + y*y))) & 31) - 15, 2)) Which way is it turning? (Original still due to GDR!) cos(x*x+y*y+2*pi*tfrac) Bubbles (Original still due to Stefano Bodrato) (tfrac <= 0.25) ? (abs(y)+abs(x/(4*tfrac)) < 80 ? green : blue*(y+129)/256) : (tfrac <= 0.5) ? (abs(y)+abs(x/(4*tfrac-2.001)) < 80 ? green : blue*(y+129)/256) : (tfrac <= 0.75) ? (abs(y)+abs(x/(4*tfrac-1.999)) < 80 ? red : blue*(y+129)/256) : (tfrac <= 1) ? (abs(y)+abs(x/(4.001-4*tfrac)) < 80 ? red : blue*(y+129)/256) Flipping card (abs(x) < 25-(y+105)/10 && y >= -105 && y < -65) ? ( (1+cos(sqrt(x*x+(y+85)*(y+85))/9))*(white*3*(tfrac*tfrac*tfrac*tfrac*tfrac*tfrac + (1-tfrac)*(1-tfrac)*(1-tfrac)*(1-tfrac)*(1-tfrac)*(1-tfrac)) + red*0.5+green*0.3)) : (y >= -90 && y < 90 && abs(x) < 50)*(white*(1+cos(x/(13+((y+90)/90))))) + (y >= 90 && y < 127)*green*0.5 + (y < -95)*(abs(x) < 2*(y+128))*(white*(1+cos(x/15))) + (y == 127)*white*6 Lighthouse (x+128)*green + (-y+128)*red + (0.5+fabs(tfrac-0.5))*256*blue Almost every colour (within the (r,g,b) palette) The computation cost for videos is greater than for pictures, so only the one-liner picture form is open to the public. If you would like to make some one-liner videos, send me some pictures for the (still) picture gallery and I'll tell you where to find the form to make videos.