How to apply visual effects
Show, location and cg statement
Effects can be applied with the optionnal property effect of some statements:
You can check the above links to see how to apply this effect.
Effect statement
Apply one or several effect to the whole stage.
An effect statement consists of a single logical line beginning with the keyword effect, followed by the effect name and its optional parameters.
- blur: blur the stage (optionnal parameters: light or heavy)
- grayscale: the stage is displayed in black and white
- sepia: add a sepia filter to the stage
- dark: darken the stage (optionnal parameters: light or heavy)
- bright: brighten the stage (optionnal parameters: light or heavy)
- zoom: zoom in the stage (optionnal parameters: light or heavy)
- rain: add a rain effect to the stage (optionnal parameters: light or heavy)
- snow: add a snow effect to the stage (optionnal parameters: light or heavy)
- fog: add a fog effect to the stage (optionnal parameters: light or heavy)
- shake: briefly shake the stage.
- flash: briefly display a white flash. By default, the flash is white but it is possible to define another color by adding the hexadecimal code of the color (ex: #ff0000, more here) or their CSS name (red, white...)
> effect snow heavy
It is possible to apply several effect at the same time by separating them with a coma:
Due to CSS3 restrictions, some effects are unfortunately not compatible together and cannot be applied at the same time:
- blur, grayscale, sepia, dark, bright
- rain, snow, fog
Effects are applied according to their display order. In the above example, the blur effect is applied before the grayscale. Since both effect are not compatible, the grayscale effect will replace the blur effect.
An effect can be stopped by adding the optional parameter none.
> effect rain none
# stop all effects
> effect none
# stop all effects and start the rain
> effect none, rain
All the above effects can be as well applied with the location statement. Indeed every effect applied to a location is applied to the whole stage. It is therefore advice to use the effect property of the location statement when you want the location to appear with the effect already applied. The effect statement should only be used to apply an effect later or to remove it.
> location forest effect rain
# display the forest and then start the rain
> location forest
> effect rain