/** a sphere that dissolves into a spiral by guru */ float R = 100; float num = 4; float f = 0.5; void setup() { size(300,300,P3D); frameRate(25); } float rot = 0; void draw() { float f = map( mouseX, 0, width, 0.9, 0.1); background(0); noStroke(); fill(0,255,0); lights(); translate( width/2, height/2); rot += 0.1; rotateY( rot ); beginShape( QUAD_STRIP); for( float a = -360 * num; a<360 * num; a++) { float h = R * a / ( 360 * num ); float r = sqrt( R*R - h*h); float x = cos( radians(a))*r; float y = sin( radians(a))*r; float a2 = a + 360; float h2 = R * (a2) / ( 360 * num ) - f * 100 / num; float r2 = sqrt( R*R - h2*h2); float x2 = cos( radians(a2))*r2; float y2 = sin( radians(a2))*r2; vertex( x, h, y ); vertex( x2, h2, y2 ); } endShape(); }