l’on peu crée des curiosités dans le suivi du curseur …
changez la valeur de la variable “inertie” pour voir
float
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
///////////////////////////////////////////////////////////
///////////////////////// http://www.ebooki.fr 2012////
////////////////////////////////////////////////////////////
float x;
float y;
float inertie= 0.01;
void setup()
{
size(600, 360);
background(100);
}
void draw()
{
float objectifX=mouseX;
float objectifY=mouseY;
x=x+(objectifX-x)* inertie;
y=y+(objectifY-y)* inertie;
background(100);
smooth();
fill(0, 0, 255);
strokeWeight(30); //
stroke(255,0,0);
ellipse(x, y, 100, 100);
stroke(0, 255, 0);
line(x-100,y,x+100,y);
} |