Removal Effects


Introduction

Whenever a pair of tiles are matched and removed from the screen, a game edition can remove the tiles using a variety of special effects. These effects are set and adjusted using applet parameters. If no special effects are desired, tiles will simply vanish when matched.

There are two types of removal effects; motion and transition. Motion effects control movement of the tile off the screen. Transition effects cause the tile to vanish, but in a gradual and interesting way.

Motion and transition effects can be used independently or in combination (i.e. one motion effect combined with one transition effect).

Note that transition effects require more computer power to render, and may have an unappealing look on some systems (depending on how Java graphics are implemented on the system, and the number of bits used for color).

See Some Sample Effects


Motion Effects

Motion effects are used to move matched tiles off of the screen. There are four types of motion available: Coast, Fly, Swirl and Wander.

"
Coast" is a smooth movement, at a constant speed in a single direction.

"
Fly" is an accelerating movement in a single direction.

"
Swirl" is an acceleration movement in an outward spiral.

"
Wander" is an random, zig zagging movement.


Transition Effects

Transition effects are used to gradually remove tiles from the screen. There are four types of transition effects; Fade, Dissolve, Twinkle and Waver.

"
Fade" is a smooth, even transition where the image gradually becomes more and more transparent until it disappears.

"
Dissolve" is an uneven transition, where different pixels in the image become transparent sooner than others.

"
Twinkle" can be even or uneven (i.e. it can apply simultaneously to the whole image, or to different pixels in the image at different times). It involves first changing pixels to a predetermined color, then fading them away. When applied evenly it is more appropriately called termed a "Glow".

"
Waver" is an uneven but regular transition where waves pass accross the image, making it gradually fade out then in then further out, until it disappears.


Controlling Effects

All effects are controled by nine parameters.

If you wish to use effects,
allowEffects should be set to "yes". This is the default, so if you intend to use effects this parameter does not need to be explicitly set.

If you wish effecst to be active when the player first begins the game,
effectsOption should be set to "yes". This is the default, so if you intend to use effects this parameter does not need to be explicitly set. If set to "no", the player must use the options screen to turn effects on.

The
effect parameter declares the motion and transition effects to be applied when tiles are matched. This is done by creating a string describing the effects, such as "Fly", "Dissolve", or "Coast Fade". Any motion effect may optionally be followed by a direction; "up", "down", "right" or "left". If no direction is specified, the initial direction for any particular tile will be random. The "twinkle" effect should be followed by a color.

When combining a motion and transition effect, simply include both (e.g. "Fly right Twinkle Yellow").

For a transition effect,
steps determines the number of discrete steps (frames) a transition animation can use. A larger number of steps will result in a smoother animation, but will require more system resources (slowing down the player's computer). Note that this parameter has no impact on motion effects.

effectLapse determines the number of milliseconds between each frame of animation (for any type of effect, motion or transition). A shorter amount of time (i.e. a smaller number) will result in a smoother animation, but will also tie up the player's computer resources. A larger number will provide larger intervals of time for the player's computer to perform tasks other than animation, but will make the animation more choppy. Generally, this parameter should be left at the default of 10 until computer systems increase in speed.

effectSimul determiens the maximum number of tiles which can be animated at one time. Any tiles matched while this limit has been reached will simply vanish from the screen without a removal effect. This condition has been included to prevent the game from too severely bogging down slower systems with excessive animations. This number can be increased as computer systems become faster.

Three parameters control different aspects of each type of effect;
effectParm1, effectParm2 and effectParm3. Note that there are not separate parameters for motion and transition effects, so if the two are used in combination you cannot vary the motion effect without changing the transition effect, and vice versa.

The meanings of the different parameters for each effect are summarized as follows:

Effect

effectParm1

effectParm2

effectParm3

Coast Minimum speed Maximum speed N/A
Fly Minimum acceleration Maximum acceleration N/A
Swirl Minimum acceleration Maximum acceleration Angle of force, relative to the current direction of motion, measured in radians
Wander Minimum acceleration Maximum acceleration Chance of changing direction
Fade N/A N/A N/A
Dissolve Number of transparency steps N/A N/A
Twinkle Number of "glow" steps Number of glow/transparency steps  
Waver Size of bands (in pixels) Number of transparency steps N/A


"Coast" is controlled by setting a minimum and maximum speed. The actual speed at which a tile moves is determined at the time the animation begins. By setting these two parameters equal (i.e. min = max), all tiles will use the same speed.

For "Fly", "Swirl" and "Wander", speed is controlled by setting the minimum and maximum acceleration. The actual acceleration for a a particular tile will be determined at the time the animation begins. By setting these two parameters equal (i.e. min = max), all tiles will accelerate at the same rate.

For the "Swirl" effect, the third parameter (from -0.5 to +0.5) controls the direction in which force is applied to the tile (causing it to swirl), measured in radians. A value of 0.5 applies the force perpendicular to the tile's motion, making a tight spiral. Values closer to zero will cause a looser spiral (0 is equivalent to "Fly"). Negative values cause a counter-clockwise (rather than clockwise) spiral.

For the "Wander" effect, the third parameter controls the chance at any time that the tile will change acceleration. Initially, the tile will accelerate in a particular direction. It will continue doing so until it leaves the screen or randomly decides to change it's acceleration (including direction). It will continue to accelerate, occasionally changing direction, until it leaves the screen. The third parameter controls the chance that the tile will change direction by representing the denominator in a fraction. For example, a 2 means that there is a 1/2 chance.

For the "Fade" effect the only variation is in the number of animation
steps. More steps will cause a more gradual fade.

For the "Dissolve" effect the first parameter determines the number of "transparency steps". For example, 5 transparency steps will make a pixel 20%, 40%, 60%, 80% and finally 100% transparent in successive animation frames. The number of pixels which begin to fade at any time depend on both the first parameter (number of transparency steps) and the total number of
steps. Since all pixels must fade by the end of the animation, then they must all have begun to fade by [steps - effectParm1], and so at any particular step the number of pixels which will begin to fade will be 1 / [steps - effectParm1]. The upshot of this is that if you want a more "diluted" dissolve, use fewer transparency steps and more total steps. If steps = effectParm1, "Dissolve" is equivalent to "Fade".

For the "Twinkle" effect, random pixels will first gradually change to the twinkle color, and then gradually fade (become transparent). The first parameter is the number of "glow" steps. This is the number of steps that a pixel will spend turning to the twinkle color. The second parameter is the total number of steps the pixel will spend glowing and then becoming completely transparent (and so, the number of transparency steps is [effectParm2 - effectParm1]. Similar to "Dissolve", the pixels which twinkle must all begin to do so by [steps - effectParm2], so the number of pixels which start to twinkle at any time will be 1 / [steps - effectParm2]. The upshot of this is that if you want a more "diluted" twinkle, use fewer total glow/transparency steps and more total steps. If steps = effectParm2, "Twinkle" produces a "Glow" effect, where the entire tile first glows the twinkle color and then fades.

For the "Waver" effect, the first parameter determines the size of the "bands" you see as the tile fades (the parameter is the size of half a band, in pixels). The second parameter is the number of transparency steps (similar to dissolve). Note that [ effectParm1 + effectParm2 ] for Waver should always be less than or equal to
steps. If not, they will be adjusted automatically.


Tips

Fly and Coast

You can use the directions to achieve different effects. "Coast Up" looks sort of like a balloon. "Coast Down" looks like something sinking in water, as opposed to "Fly Down" which looks like something dropping through the air.

Swirl

Tight spirals (effectParm3 = 0.5 or -0.5) look cool at first, but they can become very annoying unless you make the tile move fast. A looser spiral gets the tile off the screen faster even if the tile accelerates slowly.

Wander

Even if you increase the chance of changing direction up to 1, the default acceleration (min 5, max 10) will send the tile off the screen with only a bit of wiggle. To get a "serious" wandering effect, you need to reduce the acceleration (effectParm1 and effectParm2); lower accelerations will cause more eratic motions.

Twinkle

Generally, you can use low values for parameters one and two without changing the effect much, unless you are trying for a "glow". Use a large number of steps to get a dilute twinkle, lower values to get a more even glow.

Compare Twinkle Parameters

Waver

This effect generally looks best with a larger number of steps and with smaller bands.

Fade and Dissolve

The number of steps to use in a fade is purely a matter of taste (as well as computer power). In dissolve, use a large number of steps and a small value for effectParm1 to get a diffuse dissolve. The closer effectParm1 is to the number of steps, the more the Dissolve becomes like a Fade.


Back to the Host Kit Main Page