SnowBlossom - Ren'Py Visual Novel Engine

documentation index ◦ reference manual ◦ function index

# SnowBlossom

Function: | SnowBlossom | (image, count=10, border=50, xspeed=(20, 50), yspeed=(100, 200), start=0, horizontal=False):

This implements the snowblossom effect, which is a simple linear motion up or down, left, or right. This effect can be used for falling cherry blossoms, falling snow, rising bubbles, and drifting dandelions, along with other things.

image - The image that is to be used for the particles. This can actually be any displayable, so it's okay to use an Animation as an argument to this parameter.

count - The number of particles to maintain at any given time. (Realize that not all of the particles may be on the screen at once.)

border - How many pixels off the screen to maintain a particle for. This is used to ensure that a particle is not displayed on the screen when it is created, and that it is completely off the screen when it is destroyed.

xspeed - The horizontal speed of the particles, in pixels per second. This may be a single integer, or it may be a tuple of two integers. In the latter case, the two numbers are used as a range from which to pick the horizontal speed for each particle. The numbers can be positive or negative, as long as the second is larger then the first.

yspeed - The vertical speed of the particles, in pixels per second. This may be a single integer, but it should almost certainly be a pair of integers which are used as a range from which to pick the vertical speed of each particle. (Using a single number will lead to every particle being used in a wave... not what is wanted.) The second number in the tuple should be larger then the first.

start - This is the number of seconds it will take to start all particles moving. Setting this to a non-zero number prevents an initial wave of particles from overwhelming the screen. Each particle will start in a random amount of time less than this number of seconds.

fast - If true, then all particles will be started at once, and they will be started at random places on the screen, rather then on the top or bottom.

horizontal - If true, the particles start on the left or right edge of the screen. If false, they start along the top or bottom edge.

## Example

    init:
        image blossoms = SnowBlossom(Animation("sakura1.png", 0.15,
                                               "sakura2.png", 0.15))

    show snowblossom

    "Finally, there's now a particle motion system in
     Ren'Py."

    "It can be used to animate things like falling cherry
     blossoms, falling snow, and rising bubbles."

    "While there's convenient support for things rising and
     falling in straight lines, it's also possible to define
     your own motions."

    "The sky's the limit."

    "Or the ground, in the case of these cherry blossoms."

    hide snowblossom with dissolve

documentation index ◦ reference manual ◦ function index