The if statement needs to be put in the function that is called in the animate for it to function properly. Another way is to use a setTimeout function on the if statement with milliseconds greater than 1000 (the animate time).
Merge pull request #453 from DJScias/dev-0.3

The if statement needs to be put in the function that is called in the a...