float x,y,t,d,m=200,n=200, b, h,v,fa=0.1,fb=0.1,aa=16,ab=16,f2=2,r1=120, r2=40, r3=-30, f3=7; color colour; color colours[]=new color[257]; //float angle[][]=new float[300][300]; float sinArray[]=new float[721]; boolean frameblending=true; int xPos, yPos, oldxPos, oldyPos, c, i, drawStyle=0; int inverted=-1; void draw(){ //if(t<-10.0 && t>-10.2) println ("fps: " t*10000/millis()); t=0; if (frameblending){ if (drawStyle==0) fill(0,6); if (drawStyle==5) fill(0,1); else fill(0,16); rect(0,0,width,height); } else background(0); stroke(250); fill(64,96,128,32); if (drawStyle==1|drawStyle==4) { noFill(); beginShape(); } else if (drawStyle==2) { beginShape(TRIANGLE_STRIP); } else if (drawStyle==3) { beginShape(TRIANGLE_FAN); vertex(n,m); } while (t0) endShape(); } void dot (int xPos, int yPos) { c=(int)(brightness(get(xPos,yPos)))+128; if (c<0) c=0; if (c>255) c=255; colour=colours[c]; set(xPos,yPos,colour); } void star (int xPos, int yPos) { c=(int)(brightness(get(xPos,yPos)))+21; if (c<0) c=0; if (c>255) c=255; colour=colours[c]; set(xPos,yPos,colour); c=(int)(brightness(get(xPos+1,yPos)))+9; if (c<0) c=0; if (c>255) c=255; colour=colours[c]; set(xPos+1,yPos,colour); c=(int)(brightness(get(xPos-1,yPos)))+9; if (c<0) c=0; if (c>255) c=255; colour=colours[c]; set(xPos-1,yPos,colour); c=(int)(brightness(get(xPos,yPos+1)))+9; if (c<0) c=0; if (c>255) c=255; colour=colours[c]; set(xPos,yPos+1,colour); c=(int)(brightness(get(xPos,yPos-1)))+9; if (c<0) c=0; if (c>255) c=255; colour=colours[c]; set(xPos,yPos-1,colour); } void setup() { size(400, 400, P3D); m=width/2; n=height/2; frameRate(60); x=0; i=0; while (i<720){ sinArray[i]=sin((float)i*PI/360.0); i++; } i=1; colours[0]=color(0,0,0); while (i<256){ colours[i]=color(16*sqrt(i),16*sqrt(i),16*sqrt(i)); i++; } } float sine(float ang){ while (ang<0) ang+=PI*2; return sinArray[(int)((ang*360/PI))%720]; } float cosine(float ang){ while (ang<0) ang+=PI*2; return sinArray[(int)((ang*360/PI)+540)%720]; } void keyPressed(){ if (key=='s') saveFrame("rosaly-####.tif"); if (key=='0') drawStyle=(drawStyle+1)%6; if (key=='f') frameblending=!frameblending; if (key=='i') inverted=-inverted; } void mouseDragged(){ if (mouseButton==LEFT){ f2+=(mouseX-pmouseX)*0.001; r2+=(mouseY-pmouseY)*0.1; } if (mouseButton==RIGHT | (keyPressed == true && keyCode == SHIFT)){ f3+=(mouseX-pmouseX)*0.001; r3+=(mouseY-pmouseY)*0.1; } }