3 ms·
>Notice that by adjusting how the fire propagates up, wind can also be simulated. I will leave that as an exercise for the readers who had the courage to read u
by robertAngst 8y ago
>Notice that by adjusting how the fire propagates up, wind can also be simulated. I will leave that as an exercise for the readers who had the courage to read up to here.
This is what I cared to see.
The rest was not a mystery and seems like a pretty simple math/logic problem.
Although, now that I type this out, I am thinking the wind would be simple too...
Can anyone explain why the interest? I imagine there are college kids who do this type of logic.
- blondin 8y agoyes, i am surprised that Fabien is doing the "leaving it as an exercise for the reader" on us. all authors have to do this at some point heh? anyways, you see that "dst = src - randIdx + 1" line? that's what the "reader" needs to play with. right now "randIdx" is 0, 1 or 2. when it's 0, "dst" is one pixel to the right of "src", when it's 1 "dst" is at "src", and 2 is to the left. also remember we are placing it "below" because we are moving up, so we do "firePixels[dst - FIRE_WIDTH] = ...". hope that helps. this article has renewed my interest in demo scene effects. canvas2d seems very friendly now. last time, i had a hard time with the animation boiler plate, manipulation of the canvas element and colors. colors manipulation seems to still be awful. i see Fabien had to write 15 lines of code for palette conversion. but that createjs library makes many things easier. hope Fabien can go through other popular effects... or maybe i should lol : )