Skip to content

Instantly share code, notes, and snippets.

@sircommitsalot
Created April 26, 2014 17:54
Show Gist options
  • Save sircommitsalot/11326544 to your computer and use it in GitHub Desktop.
Save sircommitsalot/11326544 to your computer and use it in GitHub Desktop.
rotate
function checkKey(e) {
e = e || window.event;
if (rotation >= 360) {
rotation = Math.abs(rotation % 360);
} else if (rotation <= 0) {
rotation += 360;
}
if (e.keyCode == '37') {
rotation -= 5;
follower[0].style.webkitTransform = 'rotate(' + rotation + 'deg)';
} else if (e.keyCode == '39') {
rotation += 5;
follower[0].style.webkitTransform = 'rotate(' + rotation + 'deg)';
} else if (e.keyCode == '38') {
// up arrow
} else if (e.keyCode == '40') {
// down arrow
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment