Created
March 14, 2015 08:50
-
-
Save vitalyp/5f5fbeb36ff2b3c963ff to your computer and use it in GitHub Desktop.
Single line Pendulum stroke algorythm
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 inc = 1, | |
slideCount = 30, | |
slideIndex = 1; | |
// PENDULUM ANIMATION | |
// ------------------------------- | |
function doPendulum() { | |
slideIndex += (inc *= (((slideIndex >= slideCount-1 || slideIndex <= 0 ) && -1) || 1)); | |
} | |
// where: | |
// inc - slide index increment (-1 or 1) | |
// slideIndex - index of current slide, E=>[0..slideIndex) | |
// slideCount - index of last slide (0.png, 1.png, ..., slideCount.png) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment