Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

Why is my Function "Speeding up" (With JsFiddle example) (Solved)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Schoening   Members   -  Reputation: 141

Like
0Likes
Like

Posted 28 October 2012 - 07:26 AM

I called my render(); function inside an interval.
And now, every 5 seconds the cube.rotation seems to speed up:

http://jsfiddle.net/Schoening/ArCW2/

Ad:

#2 glf1311   Members   -  Reputation: 292

Like
0Likes
Like

Posted 28 October 2012 - 10:45 AM

Your mistake is that u call requestAnimationFrame AND setInterval. setInterval calls your render function every 5sec and render calls requestAnimationFrame which makes sure ur frame is drawn 60(?) times a second. Now everytime setInterval calls render another AnimationFrame is requested and ur frame is drawn additional 60 times a second.
I would try something like this http://jsfiddle.net/ArCW2/1/

Regards glf

#3 Schoening   Members   -  Reputation: 141

Like
0Likes
Like

Posted 28 October 2012 - 10:55 AM

Thank you for the explanation glf :)




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS