/*Processing Framework Copyright@taka.BRK 20090513 */ float[] squareX,squareY; int wNum,hNum,array; float angle,rSize,a; int Length = 20; float[] X = new float[Length],Y = new float[Length],Ang = new float[Length],Rot = new float[Length],c = new float[Length],Radius = new float[Length]; float cx,cy,power = 0,MaxPower = 200; float fluc_color; float fluc_y; class cineX2{ cineX2(){ colorMode(RGB,256); } void card_shuffle(){ stroke(0,0,0); strokeWeight(1); frameRate(24); colorMode(RGB,256); angle += 0.01f; for(int i=0;i<256;i++){ translate(width/2,height/2); rotate(sin(angle)*cos(angle)*tan(angle)); rect(i/cos(angle),-i*sin(angle),width/3,height/3); rectMode(CENTER); fill(0,i,256-i); } } void pink_pi(){ colorMode(RGB,256); frameRate(24); noStroke(); for(int i=0;i<100;i++){ a += 0.001f; fill(256,i,256-i); rotate(a); ellipse(width/2,height/2,100,100); } } void RBW(){ stroke(0); strokeWeight(1); angle += 0.00003f; for(int i=0;i<256;i++){ rotate(cos(angle)*cos(angle)+sin(angle)+tan(angle)/2); translate(width/2,height/2); fill(i,256-i,0); plus(i,20); fill(0,0,i); ellipse(width/2,-i,50,50); ellipseMode(CENTER); fill(i,i,i); ellipse(width/1.3f,i,10,10); ellipseMode(CENTER); } } public void plus(int s,int t){ beginShape(); vertex( -t, s ); vertex( t, s ); vertex( t, t ); vertex( s, t ); vertex( s, -t ); vertex( t, -t ); vertex( t, -s ); vertex( -t, -s ); vertex( -t, -t ); vertex( -s, -t ); vertex( -s, t ); vertex( -t, t ); endShape(CLOSE); } void worp_man(){ frameRate(15); for(int k=0;k<5;k++){ stroke(random(255),random(255),random(255)); ellipse(width/2,height/2,random(1000),random(1000)); fill(random(255),0,0,30); } } void prism(){ for(int i=0;i<5;i++){ stroke(255-random(100),255-random(100),255-random(100),70); line(width/2,0,random(1000),random(1000)); rotate(radians(360)); } } void sonw_circle(){ angle += 0.01f; for(int i=0;i<256;i++){ translate(width/2,height/2); rotate(sqrt(2)*sin(angle)); ellipse(i,i,10,10); fill(256,256,256); } } void spider_ball(){ frameRate(24); stroke(0); strokeWeight(1); angle += 0.01f; for(int i = 0;i<256;i++){ translate(i,i); rotate(cos(angle)*cos(angle)); ellipse(i,i,100,100); fill(i,0,256-i); } } void powerBall(){ colorMode(HSB,100); noStroke(); fadeToWhite(); if(power>0){ for(int i=0;i1)power = power * 0.98; else power=0; } } public void fadeToWhite(){ rectMode(CORNER); fill(100,30); rect(0,0,width,height); } public void mousePressed(){ power = 0; for(int i = 0;i < Length;i++){ Radius[i] = random(10,30); c[i] = random(100); Rot[i] = random(-5,5); } } void rect_draw(){ frameRate(30); stroke(random(256),random(256),random(256),30); int x = int(random(width)); int y = int(random(height)); rectLines(x,y,30,30); } void rectLines(int x,int y,int w,int h){ line(x,y,x+w,y); line(x,y,x,y+h); line(x+w,y,x+w,y+h); line(x,y+h,x+w,y+h); } void randomLine(){ colorMode(HSB,100); for(int i=0;i<1000;i++){ stroke(random(256),random(256),random(256),30); line(random(width),random(3*width),random(height),height); } } void curveEffect(){ for(int i=0;i<256;i++){ stroke(0,0,i); strokeWeight(4); curve(i,0,i+160,60,40,i+120,160,200); curve(0,0,width-i,height-i*2,i*12,i*i,i*i,width/2); curve(width,height,0,0,sin(45)*i+width,cos(60)*i+height,width,0); curve(width/2,height/2,width*sin(60),height*cos(45)*cos(30),0,0,width,height); } } void sea(){ fluc_color = 0; for(int j=0;j<=height;j+=5){ fluc_color += random(-50,50); stroke(fluc_color,60,100,30); fluc_y = 0; beginShape(); for(int i=0;i<=width;i+=5){ fluc_y += random(-2,2); vertex(i,j+fluc_y); } endShape(); } } void crimson_world(){ stroke(255,0,0,70); colorMode(RGB); frameRate(10); noFill(); for(int i = 0;i<30;i++){ ellipse(random(width/2),random(height/2),random(width/2)+300,random(height/2)+300); rotateX(radians(i*15)); rotateY(radians(i*5)); } } float xmag,ymag,newXmag,newYmag = 0; void qube(){ noStroke(); colorMode(RGB,1); pushMatrix(); translate(width/2,height/2,-30); float newXmag = mouseX/PApplet.parseFloat(width)*TWO_PI; float newYmag = mouseY/PApplet.parseFloat(height)*TWO_PI; float diff = xmag-newXmag; if(abs(diff)>0.01f){ xmag -= diff/4.0f; } diff = ymag-newYmag; if(abs(diff)>0.01f){ ymag -= diff/4.0f; } rotateX(-ymag); rotateY(-xmag); scale(50); beginShape(QUADS); fill(0,1,1); vertex(-1,1,1); fill(1,1,1); vertex(1,1,1); fill(1,0,1); vertex(1,-1,1); fill(0,0,1); vertex(-1,-1,1); fill(1,1,1); vertex(1,1,1); fill(1,1,0); vertex(1,1,-1); fill(1,0,0); vertex(1,-1,-1); fill(1,0,1); vertex(1,-1,1); fill(1,1,0); vertex(1,1,-1); fill(0,1,0); vertex(-1,1,-1); fill(0,0,0); vertex(-1,-1,-1); fill(1,0,0); vertex(1,-1,-1); fill(0,1,0); vertex(-1,1,-1); fill(0,1,1); vertex(-1,1,1); fill(0,0,1); vertex(-1,-1,1); fill(0,0,0); vertex(-1,-1,-1); fill(0,1,0); vertex(-1,1,-1); fill(1,1,0); vertex(1,1,-1); fill(1,1,1); vertex(1,1,1); fill(0,1,1); vertex(-1,1,1); fill(0,0,0); vertex(-1,-1,-1); fill(1,0,0); vertex(-1,-1,-1); fill(1,0,1); vertex(1,-1,1); fill(0,01); vertex(-1,-1,1); endShape(); popMatrix(); } void check(){ colorMode(RGB,10); noStroke(); fill(0,0,0,5); for(int i=0;i<5;i++){ rect(0,10+i*40,width,20); rect(10+i*40,0,20,height); } fill(10,10,10,3); for(int i=0;i<5;i++){ rect(0,10+i*40+3,width,2); rect(0,10+i*40+15,width,2); rect(10+i*40+3,0,2,height); rect(10+i*40+13,0,2,height); } } void pushText(String fontsrc){ int MaxColor; PFont font; MaxColor = 100; colorMode(HSB,MaxColor); frameRate(10); font = loadFont(fontsrc); textFont(font); textAlign(CENTER); if(keyPressed){ fill(random(MaxColor),MaxColor,MaxColor,80); text(key,random(width),random(height)); } } void keyPressed(){ switch(key){ case ' ': background(0); break; } } } class fireCube{ int [][] fire; color[] palette; float angle; int[] calc1,calc2,calc3,calc4,calc5; PGraphics pg; fireCube(int wi,int hi){ size(wi,hi,P2D); pg = createGraphics(width,height,P3D); calc1 = new int[width]; calc3 = new int[width]; calc4 = new int[width]; calc2 = new int[height]; calc5 = new int[height]; colorMode(HSB); fire = new int[width][height]; palette = new color[255]; for(int x = 0;x>1,height>>1); pg.rotateX(sin(angle/2)); pg.rotateY(cos(angle/2)); pg.background(0); pg.stroke(128); pg.scale(25); pg.noFill(); pg.box(4); pg.endDraw(); for(int x = 0; x < width; x++){ fire[x][height-1] = int(random(0,190)) ; } loadPixels(); int counter=0; for(int y=0;y>16 & 0xFF) == 128){ fire[x][y] = 128; } } } updatePixels(); } } class loadPics{ PImage bg; loadPics(String src){ bg = loadImage(src); } void back(){ background(bg); } void img(float _w,float _h){ image(bg,_w,_h); } } class reflesh{ int r,g,b,_alpha; reflesh(int _r,int _g,int _b,int _a){ r = _r; g = _g; b = _b; _alpha = _a; } void draw(){ rectMode(CORNER); fill(r,g,b,_alpha); rect(0,0,width,height); } } class randomLine2{ int range_color,range_y; float fluc_color; randomLine2(int _rc,int _ry,float _fc){ range_color = _rc; range_y = _ry; fluc_color = _fc; } void draw(){ noFill(); rectMode(CENTER); for(int i=0;iMaxSpeed)Speed = MaxSpeed; float ang = ((width/2)-mouseX); Angle += ang*0.05; X += Speed*sin(radians(Angle)); Y += Speed*cos(radians(Angle)); loopWorld(); fill(abs(ang)*2,abs(acc)*2,MaxColor); rect(X,Y,20,20); } void loopWorld(){ if(X<0)X = width + X; if(X>width)X = X-width; if(Y<0)Y = height+Y; if(Y>height)Y=Y-height; } } class bounceBall{ float GRAVITY,FRICTION,X,Y,Spx,Spy; int Radius; color ball_color; bounceBall(float _x,float _y,float _spx,float _spy,int _radius,color _ball_color,float _gravity,float _friction){ X = _x; Y = _y; Spx = _spx; Spy = _spy; Radius = _radius; ball_color = _ball_color; GRAVITY = _gravity; FRICTION = _friction; } void move(){ Spy += GRAVITY; X += Spx; Y += Spy; this.bounce(); } void draw(){ fill(ball_color); ellipse(X,Y,Radius*2,Radius*2); } private void bounce(){ int bounceMinX = Radius,bounceMaxX = width-Radius,bounceMinY = Radius,bounceMaxY = height-Radius; if(XbounceMaxX){ Spx = -Spx*FRICTION; if(abs(Spx)<1)Spx = 0; if(XbounceMaxX)X = bounceMaxX-(X-bounceMaxX); } if(YbounceMaxY){ Spy = -Spy * FRICTION; if(abs(Spy)bounceMaxY)Y=bounceMaxY-(Y-bounceMaxY); } } } class yuragi{ int range; float r,g,b; yuragi(float _r,float _g,float _b,int _range){ range = _range; r = _r; g = _g; b = _b; } public void draw(){ for(int i=0;i<50;i++){ for(int j=0;j<50;j++){ fill(r,g,b); rect(10+j*20+random(-range,range),10+i*20+random(-range,range),10,10); } } } } class ellipseEffect{ float x,y,cx,cy,ang1,ang2,r1,r2,rot1,rot2; ellipseEffect(){ cx = width/2; cy = height/2; ang1 = ang2 =0; r1 = 100; r2 = 30; rot1 = 3; rot2 = 20; } void draw(){ colorMode(HSB,100); noStroke(); frameRate(30); ang1 += rot1; ang2 += rot2; float rx = cx + (r1*sin(radians(ang1))); float ry = cy + (r1*cos(radians(ang1))); x = rx + (r2*sin(radians(ang2))); y = ry + (r2*cos(radians(ang2))); rectMode(CENTER); fill(0,100,100,60); rect(x,y,10,10); } } class ellipseEffect2{ int maxColor; ellipseEffect2(){ maxColor = width; } void draw(){ colorMode(HSB,maxColor); noStroke(); frameRate(10); fadeToWhite(); float speed = dist(mouseX,mouseY,pmouseX,pmouseY); fill(mouseY,min(speed*2,maxColor),maxColor); ellipse(mouseX,mouseY,speed,speed); } void fadeToWhite(){ rectMode(CORNER); fill(maxColor,10); rect(0,0,width,height); } } class pixelEffect{ PImage pixelPics; pixelEffect(String src){ size(width,height); colorMode(RGB,256); background(0); frameRate(24); pixelPics = loadImage(src); pixelPics.loadPixels(); } void draw(){ loadPixels(); int x = int(random(pixelPics.width)); int y = int(random(pixelPics.height)); int pos = x + (y * width); pixels[pos] = pixelPics.pixels[pos]; updatePixels(); } } class redDot{ Dot[] dot; float[] squareX; float[] squareY; int wNum,hNum; int array; int pattern_rd; redDot(){ size(width,height); frameRate(24); // smooth(); //pattern_rd = 0; wNum = 50; hNum = 50; array = 0; squareX = new float[wNum*hNum]; squareY = new float[wNum*hNum]; dot = new Dot[wNum*hNum]; int dotWidth = 2; int dotHeight = 2; int dotMargin = 0; for(int j=0;jwidth+this.rectW){ xPos = 0; nextX = 0; } if(xPos<0-this.rectW){ xPos=width; nextX=width; } if(yPos<0-this.rectH){ xPos = height; yPos = height; } if(yPos>height+this.rectH){ yPos = 0; nextY = 0; } } } } class blueWave{ float yoff = 0,zoff = 0,ns = 0.1,zs = 8,nx,ny=yoff,z1,z2; blueWave(){ noiseDetail(8,0.5); } void draw(){ noStroke(); colorMode(RGB,256); translate(width*0.5,height*.55,0); rotateX(PI/3.25); scale(15); for(int y = -10;y <= 10;y++){ nx = 0.005; beginShape(TRIANGLE_STRIP); for(int x = -25;x<25;x++){ z1 = noise(nx,ny,zoff); z2 = noise(nx,ny+ns,zoff); fill(0,0,z1*255,pow(10,0.85+z1*2)); vertex(x,y,z1*zs); fill(0,0,z2*255,pow(10,0.85+z2*2)); vertex(x,y+1,z2*zs); nx+=ns; } endShape(); ny+=ns; } } } /*P3D*/ class KineticType{ Line ln; Line lns[]; String words[] = { "sometimes it's like", "the lines of text", "are so happy", "that they want to dance", "or leave the page or jump", "can you blame them?", "living on the page like that", "waiting to be read..." }; PFont f; KineticType(int wi,int hi){ size(wi,hi,P3D); frameRate(30); lns = new Line[8]; f = loadFont("Univers66.vlw.gz"); textFont(f,1f); fill(255); for(int i = 0;i<8;i++){ ln = new Line(words[i],0,i*70,f); lns[i] = ln; } } void draw(){ background(0); translate((float)(width/2.0)-350,(height/2.0)-240,-450); rotateY(0.3); for(int i = 0;i<8;i++){ float f1 = sin((i+1.0) * (millis()/10000.0) * TWO_PI); float f2 = sin((8.0-i) * (millis()/10000.0) * TWO_PI); Line line = lns[i]; pushMatrix(); translate(0.0,line.yPosition,0.0); for(int j = 0;j3){ flapSpeed *= -1; }else if(ang<-3){ flapSpeed *= -1; } ang2 += rotSpeed; ang3 += 1.25; ang4 += 0.55; popMatrix(); } } class Birds{ int birdCount = 2000; Bird[]birds = new Bird[birdCount]; float[]x = new float[birdCount]; float[]y = new float[birdCount]; float[]z = new float[birdCount]; float[]rx = new float[birdCount]; float[]ry = new float[birdCount]; float[]rz = new float[birdCount]; float[]spd = new float[birdCount]; float[]rot = new float[birdCount]; Birds(int wi,int hi){ size(wi,hi,P3D); noStroke(); for(int i=0;i0){ x[i] = random(width); y[i] = random(height); z[i] = -1000; } } } } class space_Ring_Effect{ int Length = 100; float[] x = new float[Length]; float[] y = new float[Length]; float[] z = new float[Length]; space_Ring_Effect(int w,int h,int speed){ size(w,h,P3D); frameRate(speed); background(0); stroke(100); for(int i=0;i0){ x[i] = random(width); y[i] = random(height); z[i] = -1000; } } } } class sprite{ float sspeed; int sW,sH; float angle,rSize,a; sprite(int _width,int _height,float ss){ sW = _width; sH = _height; sspeed = ss; rSize = width/4; a = 0.0; size(sW,sH,P3D); } void draw(){ frameRate(24); colorMode(RGB,256); a += sspeed; if(a>TWO_PI){ a = 0.0; } stroke(256,0,0); strokeWeight(4); translate(width/2,height/2); rotateX(a); rotateY(a*2); fill(256,256,256); rect(-rSize, -rSize, rSize*2, rSize*2); translate(width%3,height/3); rotateX(a%6); rotateY(a%3); fill(256,0,0); rect(-rSize,-rSize,rSize*3,rSize/4); for(int i = 0;i<256;i++){ translate(width/2,height/2); rotateX(a); rotateY(a*2); fill(i,i,i); rect(-rSize, -rSize, rSize*2, rSize*2); translate(width/2,height/2); rotateX(a); rotateY(a); fill(256,0,i); ellipse(100,100,100,100); } } } class RED_3D{ float offset = PI/12,b = 0.0f,sSize; int num = 12,safecolor; int[] colors = new int[num]; boolean pink = true; RED_3D(){ colorMode(RGB,256); sSize = width/5; fill(204,204); safecolor = color(256,0,0); for(int i=0;iTWO_PI){ b = 0.0f; } translate(width/2,height/2); rotateX(b/4); rotateY(b*2); rect(-sSize,-sSize,sSize*2,sSize*2); rotateX(b*1.001f); rotateY(b*2.002f); rect(-sSize,-sSize,sSize*2,sSize*2); rotateX(b); rotateY(b); rect(-sSize,-sSize,-sSize,-sSize); translate(0,0,16); translate(width/2,height/2,-20); if(b>=TWO_PI*2){ b=0.0f; } for(int i=0;i