11-17-2013, 04:13 PM
Hi!
I'm not very good at js, but after reading
,
and
sources I wrote this: https://github.com/lolbot-iichan/WebStor...5440b66271
It is a first version of particle generator that if future could be used for snow, cherry blossoms, autumn leaves, explosions, fountains, whatever. There are still lots of things to implement: not creating all the particle at once (first seconds of animation are strange), add particle image loading to initial progress bar, gravity support and so on. It also supports both text (like '*') and image source for particle.
However, there is one more thing I can't get. There is a problem with save/restore I cannot find for hours. Can you please take a look at my ugly code at say if there are any obvious mistakes? Full code review would be great, but I'm not sure if you have time for things like that.
I'm not very good at js, but after reading
Code:
<animation>Code:
<imagepack>Code:
<curtain>It is a first version of particle generator that if future could be used for snow, cherry blossoms, autumn leaves, explosions, fountains, whatever. There are still lots of things to implement: not creating all the particle at once (first seconds of animation are strange), add particle image loading to initial progress bar, gravity support and so on. It also supports both text (like '*') and image source for particle.
However, there is one more thing I can't get. There is a problem with save/restore I cannot find for hours. Can you please take a look at my ugly code at say if there are any obvious mistakes? Full code review would be great, but I'm not sure if you have time for things like that.
)... I think you shouldn't use Animation for this because it relies on timers being returned from the callbacks. When I use requestAnimationFrame() instead it seems to be much better. requestAnimationFrame() is a function that takes a callback and executes it once before the next re-paint of the rendering engine of the browser. Optimally it runs with 60 FPS. Also, when using requestAnimationFrame() no animations run when the browser tab is not visible. You can use it like this: