void setup(){ size(500, 500); noCursor(); } void draw() { colorMode(HSB, 450, 100, 100); rectMode(CENTER); noStroke(); background(mouseX/2, 100, 100); fill(360-mouseX/2, 100, 100); rect(250, 250, mouseY+1, mouseY+1); }
code optimisé :
void setup(){size(500, 500);noCursor();}void draw(){colorMode(HSB,450,100,100);rectMode(CENTER);noStroke();background(mouseX/2, 100, 100);fill(360-mouseX/2, 100, 100);rect(250,250,mouseY+1,mouseY+1);}