Skip to content

Instantly share code, notes, and snippets.

@albertochiwas
Last active September 20, 2016 01:59
Show Gist options
  • Save albertochiwas/4c57c2bba2116c1e07080cfc962df31f to your computer and use it in GitHub Desktop.
Save albertochiwas/4c57c2bba2116c1e07080cfc962df31f to your computer and use it in GitHub Desktop.
Mueve todas las articulaciones y camina dando saltitos (ida y vuelta)
var av = new Avatar(1);
av.scale(0.75);
var x = 190;
var incx = true;
var pausa = false;
av.setLimit(0,-3,3);
av.setLimit(1,10,40);
av.setLimit(3,-30,0);
av.setLimit(5,-8,8);
av.setLimit(6,-10,10);
av.setLimit(8,-10,10);
av.setNext(6,2);
av.setNext(8,2);
av.setAngle(1,15);
av.setAngle(8,5);
var draw = function() {
background(255, 255, 0);
if (frameCount<120 || frameCount>480) {
av.draw(x,200);
return;
}
if (incx) {
if (++x>220) {
incx = false;
}
} else {
if (--x<180) {
incx = true;
}
}
av.next(0);
av.next(1);
av.next(3);
av.next(5);
av.next(6);
av.next(7);
av.next(8);
av.next(9);
av.draw(x,200+25.50*sin(x*20.0));
//println(frameCount);
};
var mouseClicked = function() {
if ( pausa ) {
loop();
} else {
noLoop();
}
pausa = !pausa;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment