float x,y,t,d,m=250, 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]; int xPos, yPos, c, i; void draw(){ //if(t<-10.0 && t>-10.2) println ("fps: " t*10000/millis()); t=0; background(0); while (t255) c=255; colour=colours[c]; set(xPos,yPos,colour); } void star (int xPos, int yPos) { c=(int)(brightness(get(xPos,yPos)))+12; if (c<0) c=0; if (c>255) c=255; colour=colours[c]; set(xPos,yPos,colour); c=(int)(brightness(get(xPos+1,yPos)))+5; 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)))+3; 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)))+3; 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)))+5; if (c<0) c=0; if (c>255) c=255; colour=colours[c]; set(xPos,yPos-1,colour); } void setup() { size(500, 500, P3D); framerate(60); x=0; i=0; while (i<720){ sinArray[i]=sin((float)i*PI/360.0); i++; } i=0; while (i<256){ colours[i]=color(i,i,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"); } void mouseDragged(){ if (mouseButton==LEFT){ f2+=(mouseX-pmouseX)*0.001; r2+=(mouseY-pmouseY)*0.1; } if (mouseButton==RIGHT){ f3+=(mouseX-pmouseX)*0.001; r3+=(mouseY-pmouseY)*0.1; } }