float x = 200; // current position float y = 200; // current position float r = 50; // current radius boolean tickling = true; // tickling or poking int strength = 10; // tickling strength void setup() { size(400,400); smooth(); noStroke(); } void draw() { background(0); // check if we are inside the ellipse if(dist(mouseX,mouseY,x,y) < r) { // if tickling, move me if(tickling) { x = random(x-strength,x+strength); y = random(y-strength,y+strength); } else // if pocking, change my size r = random(50-strength,50+strength); } else { r = 50; } // Set size from how far mouse has moved ellipse(x,y,r*2,r*2); } void keyPressed() { if(key == 't') tickling = !tickling; else if(key == 'm') strength = min(strength+5,20); else if(key == 'l') strength = max(strength-5,5); // print messages if(tickling) print("I am tickling"); else print("I am poking"); println(" with "+strength+" strength"); } // START NO NOTES // code used to capture screenshots void keyReleased() { if(key == '`' && !online) save("sketch.png"); }