/* Copyright John Gilbertson 2005 */ /* This code is for educational purposes only. */ /* You may not copy any part of this code for any use. */ /* Built with processing, http://www.processing.org/ */ class ring { int s,r,w,n; float speed; float angle; color c; boolean[] missing; ring(int _s, int _r, int _w, int _n, float _speed, color _c) { s=_s; r=_r; w=_w; n=_n; c=_c; speed=_speed; if(random(100)>50.0) speed=speed*-1; speed=speed/2.0 + random(speed/2.0); missing=new boolean[s]; if(n>=s) { n=s-1; } if(n<5 && c!=color(0,0,255)) { n=5; } while(n>0) { int x=(int)random(s); if(!missing[x]) { missing[x]=true; n--; } } } void draw() { angle+=speed; push(); translate(width/2,height/2); rotateZ(angle); float dt=TWO_PI/(float)s; fill(c); for(int i=0;i