Skip to content

Instantly share code, notes, and snippets.

@albertochiwas
Created August 29, 2016 19:33
Show Gist options
  • Save albertochiwas/9047909530916113545f72e507c82276 to your computer and use it in GitHub Desktop.
Save albertochiwas/9047909530916113545f72e507c82276 to your computer and use it in GitHub Desktop.
Ardilla con mouseX mouseY en draw()
var h1 = [25,25,25,0,0,0,0,0,0];
var c1 = [0,0,0,0,25,25,-25,-25];
var i = 0;
var avanza = +1;
frameRate(15);
var av = new Avatar(0);
av.scale(0.5);
var draw = function() {
background(255);
av.rotate(1,h1[i]*avanza);
av.rotate(2,c1[i]*avanza);
av.draw(mouseX,mouseY);
i = i + avanza;
if (i<0 || i >= h1.length) {
avanza = -avanza;
}
};
var mouseClicked = function() {
noLoop();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment