/* p5tweets by Abe Pazos - 2013 What is this? An experiment to find out how much can be done with programs that fit in a tweet (140 characters) How do they look like? Here you can see still images, but note that you will miss the animation: http://funprogramming.org/p5tweets Why do this? Because it's fun, addictive, difficult, and you often must break all rules of "good programming". Therefore, please don't learn programming from these tweets :) How to run them: 1) Install Processing 2) Download https://raw.github.com/hamoid/Fun-Programming/master/processing/ideas/2013/08/p5tweets/p5tweets.pde 3) Open the downloaded file in Processing 4) Uncomment a pair of lines 5) Click run The first line in each pair of lines contains a name and an id. This is not part of the tweet. I use the id to save an image when I press the 's' key to easily share images with others. The second line in the pair is the tweet. Note: The p5tweets were originally written for Processing 2. Most are not compatible with Processing 3. Why are they commented out? Because I wanted to have them all in one file. If they were not commented out Processing would get confused with so many "void draw" found in this file. Find more p5tweets made by others: https://twitter.com/search?q=void%20OR%20size%20%23p5&src=savs&mode=realtime p5tweets Processing tool for easy download of tweets: https://forum.processing.org/topic/tweet-a-sketch#25080000002431089 Make your own: At the end of the pde file there is a ruler you can use to make sure you don't go past the 140 characters limit :) Kudos To the ones who did this before (and still are doing it) with both SuperCollider and Processing. */ //int id=1; String name="random(1)*random(1)*random(1)"; String ext="png"; void setup() { //size(800,800);for(int x=0;x<800;x++)if(x<800/2)line(x,0,x,random(1)*800);else line(x,0,x,random(1)*random(1)*random(1)*800);//#p5 //} //int id=2; String name="RGB noise"; String ext="png"; //void draw(){loadPixels();int i=0;while(i<10000){pixels[i]=int(-random(1<<24));updatePixels();i++;}}//#p5 #processing //int id=3; String name="Monitor kaputt"; String ext="png"; //void draw(){loadPixels();int i=0;while(i<9999){pixels[i]=-int(sin(i/(1+frameCount%250))*127+128)<<(frameCount%16);updatePixels();i++;}}//#p5 //int id=4; String name="RGB TV"; String ext="png"; //void draw(){loadPixels();int i=0;while(i<10000){pixels[i]=int(8*noise(frameCount+i)+.5)<<((frameCount+i)%24);updatePixels();i++;}}//#p5 // TODO: test why colors don't work on Processing 3. Negative values work, but colors are different. //int id=5; String name="Flower"; String ext="png"; //void draw(){float m=millis()*.0003,r=89*sin(m*5.1)*noise(m);stroke(255,80);if(m<1)background(0);point(49+r*sin(m),49+r*cos(m));}//#p5 //int id=6; String name="Confused dot army"; String ext="png"; //int i,m;void draw(){background(i=0);stroke(255);m=millis();while(i<99){strokeWeight(((i/23.1+m/717.1)%30));point((i*i*m)%99,i++);}}//#p5 //int id=7; String name="Z line beam"; String ext="png"; //float i,m;void draw(){m=millis()*.001;background(i=0);stroke(255,99);while(i++<99){line(i*m%109,i*m%107,i*m%103,i*m%105);}}//#p5 //int id=8; String name="Color dancing dots"; String ext="png"; //int i,m;void draw(){background(i=0);m=millis();while(i<99){stroke(-m<>(i/w%9));line(i%w,i%w,i%(w+7),i%(w+6));}}//#p5 //int id=18; String name="Red friend"; String ext="jpg"; //int i,w=900;void setup(){size(w,w);}void draw(){fill(w,0,0,7);stroke(++i&255);bezier(i%w,0,i%(w+13),w/2,i/w*i%(w+33),w/2,i%(w+87),w);}//#p5 //int id=19; String name="Binary tunnel"; String ext="png"; //int i,s;void setup(){size(900,900);}void draw(){fill(--i<<-i);s=1<<-i%8;translate(300,600);rotate(i*.001);rect(s*(-i%5),s*(-i%7),s,s);}//#p5 //int id=20; String name="Asteroids"; String ext="png"; //int i,w=700;void setup(){size(w,w);clear();}void draw(){rect(200,mouseY,30,9);rect(w+i++%2*-20,random(w),7,7);copy(0,0,w,w,-2,0,w,w);}//#p5 //int id=21; String name="Boxed"; String ext="jpg"; //int i,w=900;void setup(){size(w,w,P3D);}void draw(){pointLight(w,0,0,w,w,w);translate(i*i%w,i*3%w);rotate(1,i*.1,i*.3,2);box(++i%99);}//#p5 //int id=22; String name="Some kind of order"; String ext="jpg"; //int i=0;void setup(){size(900,900);}void draw(){while(i++%99!=0){fill(i|i*i);translate(450,450);rotate(i);rect(i%333,0,i%33,5+i%10);}}//#p5 //int id=23; String name="Communication attempt"; String ext="jpg"; //int[]i=new int[4];int a,c;void setup(){size(900,900);}void draw(){stroke(a<0){pixels[i%w]=i%(s+i/s)-1<<(i/(w*90));}updatePixels();}//#p5 //int id=25; String name="Extended alphabet"; String ext="png"; //int i;void setup(){size(900,900);noStroke();}void draw(){while(++i%4>0){fill(-1<<(i%2<<4));rect(3+i%13*90,3+i%11*90,i*i%85,i*i%86);}}//#p5 //int id=26; String name="Fly like a fly"; String ext="png"; //float i;void setup(){size(900,900,P3D);}void draw(){translate(450,450);rotateY(i+=.017);rotateZ(i*.13);rect(200,200*sin(i*.87),90,90);}//#p5 //int id=27; String name="Binary noise"; String ext="png"; //int i,s=400,k=s*s;void setup(){size(s,s);}void draw(){while(++i%k>0)set(i%s,i/s%s,-i<0){pixels[abs((i*7&i/s)%w)]=-(i/73)<<3;}updatePixels();}//#p5 //int id=35; String name="MYWC"; String ext="png"; //int i,s=450;void setup(){size(s*2,s*2,P3D);}void draw(){translate(s,s);rotate(--i*.1,i%9,i%7,i%4);fill((-7<0){fill(-n<0;)pixels[i*7%(s*s)]=-i*(i>>19)/s<0){translate(550,550);rotateX(i/6);rotateY(i/7);ellipse(400,0,20,20);}}//#p5 //int id=51; String name="a"; String ext="png"; //int i,s=900;void setup(){size(s,s,P3D);}void draw(){while(++i%8192>0){stroke(i/90210%256);point(i*(i+(i>>16))%s,i/6502%s,i/1117%s);}}//#p5 // Ruler. 140 characters long. I develop new tweets under it. /////-----/////---20/////-----/////---40/////-----/////---60/////-----/////---80/////-----/////--100/////-----/////--120/////-----/////--140 void keyPressed() { if(key=='s') save(id + "." + ext); }