class Worm{ int x,y,xoffset,yoffset; color pigment; Worm(){ x = int(random(-20, width)); y = int(random(0, height+20)); //xoffset = int(random(-50, width)); yoffset = int(random(100)); pigment = color(0, random(1), random(1), random(0.2)); println(hue(pigment)); xoffset = int((hue(pigment)-0.4)*1500); } float singraph(float sa){ sa = (sa - 0.5) * 1.0; //scale from -1 to 1 sa = sin(sa*PI)/2 + 0.5; return sa; } void wiggle(){ if(y < 0-yoffset){ y = height+20; } x = xoffset + int(singraph((float)y/100)*50); y -= 1; fill(pigment); pushMatrix(); translate(0,yoffset); ellipse(x,y,10,10); popMatrix(); } }