Java Reference
In-Depth Information
Animate Emitter's Attributes: The implementation in this chapter provides a number of attributes on
the Emitter class that define the attributes of each new particle. Changing the attributes on the emitter
over time would produce some interesting results. For example, increasing the size of the particles for
short periods of time will produce a pulsing effect. You could also slowly adjust the color of the particles
to reflect some event in the application. In the context of the game, for instance, a particle system could
turn from blue to red as the player loses health.
Summary
This chapter explored how to implement a particle system in JavaFX, and how the features of a particle
system affect its look. The first examples provided a simplistic implementation that focused on the
organization of the key classes—Emitter and Particle. Later examples added features such as
transparency, blend modes, nonlinear motion, and using bitmaps as particles. Combining some or all of
these features allows you to implement a wide range of particle effects. However, for performance
reasons, it is important to keep the number of particles to a minimum and be wary of some of the more
expensive features like transparency and blend modes.
Search WWH ::




Custom Search