views:

20

answers:

1

I've created an animation using script.aculo.us. However, when the animation is finished, I want to have it reset all the objects and perform the animation again. I plan to just reset the positions of the objects manually, but how can I make the animations loop? If I put the effect declarations inside a for or while loop, it just crashes the browser.

Any ideas?

+1  A: 

One of the options with Scriptaculous effects is to have an afterFinish callback. Simply call your animation again, and you should be good to go. Here's a bit of info on the callbacks:

http://wiki.github.com/madrobby/scriptaculous/core-effects

http://www.tutorialspoint.com/script.aculo.us/scriptaculous_common_parameters.htm

Sean McMains
Thanks! That did the trick. Though, is it bad practice to to call a function as a callback from within that function?
Dan T