bestiole maBestiole; void setup(){ size(400,400); background(0); frameRate(12); smooth(); maBestiole = new bestiole(); } void draw(){ noStroke(); fill(0, 102); rect(0, 0, width, height); if (mousePressed){ maBestiole.display1(); maBestiole.move1(); } else { maBestiole.display2(); maBestiole.move2(); } } class bestiole { float sinval, cosval, sinvalbez, cosvalbez; float angle = 0.0; float anglebez = 0.0; float rayon = 100.0; float rayonbez = 40.0; float xline, yline, xbez, ybez, xpos, ypos, xoff, yoff; color c; bestiole() { xpos = width/2; ypos = height/2; } void display1(){ for (float i = 0; i < 10; i++) { angle = random (TWO_PI); sinval = sin (angle); cosval = cos (angle); xline = xpos + (cosval * rayon); yline = ypos + (sinval * rayon); stroke(153); strokeWeight(2); line (xpos, ypos, xline, yline); ellipse (xline, yline, 6, 6); } c = color (random (51,204), 128); fill(c); strokeWeight(1); stroke(255,128); ellipse(xpos, ypos, 20, 20); } void move1(){ xpos = xpos + ((mouseX - xpos)/4); ypos = ypos + ((mouseY - ypos)/4); } void display2(){ for (float i = 0; i < 20; i++) { angle = random (TWO_PI); sinval = sin (angle); cosval = cos (angle); if (angle > HALF_PI && angle < 3 * HALF_PI){ anglebez = random (5 * QUARTER_PI, 3 * HALF_PI); } else { anglebez = random (3 * HALF_PI, 7 * QUARTER_PI); } sinvalbez = sin (anglebez); cosvalbez = cos (anglebez); xline = xpos + (cosval * rayon); yline = ypos + (sinval * rayon); xbez = xline + (cosvalbez * rayonbez); ybez = yline + (sinvalbez * rayonbez); stroke(153); strokeWeight(2); bezier (xpos, ypos, xpos, ypos, xbez, ybez, xline, yline); } noStroke(); c = color (random (51,153), 128); fill(c); strokeWeight(1); stroke(255,128); ellipse(xpos, ypos, 20, 20); fill(255, 153); ellipse(xpos, ypos, 6, 6); } void move2(){ xoff += .01; xpos = noise(xoff) * width; yoff += .05; ypos = noise(yoff) * height; } }