by Presto » Sep 29, 2003 @ 3:09pm
You might want to check this out too... It's a disintigration effect.
Say you use 30 FPS, and you want to disintegrate the entire screen over 3 seconds. That gives us 90 frames to work with.
[pseudocode]
Create an integer "scrn_array" for the number of pixels/blocks you want to dissolve.
Assign every integer in the array a random number from 1-90.
Take a snapshot of the current screen.
Start the frame_counter at 1.
Loop through the scrn_array.
If our "scrn_array[x][y] == frame_counter", blank out that pixel/block in the snapshot.
Next
Increment frame_counter.
Update the screen with the modified snapshot.
[/pseudocode]
Looping through per pixel would be about 853 pixel changes per frame (76,800/90). That's a lot, but if we use 2x2 blocks, it's only 213 changes (19200/90). 4x4 blocks would be 53 changes (4800/90) per frame. And 8x8 blocks would yield 13 changes per frame (1200/90).
So, as always it's a speed vs. quality decision.
I'll have to try this myself sometime.