Created
May 31, 2017 02:22
-
-
Save albertochiwas/8b34329cdff39c98206cf626ac3fb998 to your computer and use it in GitHub Desktop.
Another approach to switch & count arm swing movements
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var av = new Avatar(15); | |
av.scale(0.75); | |
var dir = true; | |
var c = 0; | |
var draw = function() { | |
if (c > 10) { return; } | |
background(0, 0, 0, 100); | |
av.draw(mouseX,mouseY); | |
if ( av.getAngle(1) < 75 ) { | |
av.rotate(1,2); | |
} else { | |
if ( dir ) { | |
if ( av.getAngle(2) > 89 ) { | |
dir = false; | |
c++; | |
} | |
av.rotate(2,2); | |
} else { | |
if ( av.getAngle(2) < 50 ) { | |
dir = true; | |
c++; | |
} | |
av.rotate(2,-2); | |
} | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment