The code used here is similar to the code used in our earlier exploding bitmap experiment, A Rotating Bitmap in 3D Explodes into Particles. There we have discussed the methods in detail. In the FlowerTwist effect code, we have placed many comments within to make it more understandable. Also, we have updated the basic classes for Flash Player 10.
The motion of the particles here depends on the color of each particle; in particular the luminance (a measure of brightness) is used to control how far the particles fly in the z-direction when the bitmap explodes. Through some experimentation with various functions, we have found a very nice way of having the particles twist into a helical pattern as they explode into space.
Although the basic classes used here are somewhat complicated, they have been designed to be as reusable as possible. To produce different effects, try changing the equations which control the coordinates of the particles. We also encourage you to check out our examples posted at 3D Particles Experiments in AS3 and Flash CS3, where the particles were created from scratch rather than being based on a bitmap.
We should note that the number of particles used here is rather small compared to what others have been able to do with Flash. This is because in our code we are asking Flash to do quite a bit: z-sorting of particles (with a z-buffer method), constant updates of particle coordinates in 3D, interactive quaternion-based rotation, and bitmap filters. As a result the application can be rather CPU intensive, and we do not recommend using very large bitmaps with this code.
When the particles are flattened into a plane, the resulting picture has a low-resolution, pixilated quality, showing Moiré patterns. We have in mind a way to involve a 3D projected bitmap to remedy this issue, and this will be the subject of a future experiment.
Download here http://www.mediafire.com/?im7cci5jjbakqww
Enjoy our Flower Twist!
(source http://www.flashandmath.com/flashcs4/flower/index.html)
No comments:
Post a Comment