Screen.js (system script)
From Spheriki
Screen.js is a system script that provides screen fading functionality.
Contents |
Usage
RequireSystemScript("screen.js");
Variables and functions of screen.js
- ClearScreen()
- tints the screen solidly black.
- FadeOut(milliseconds)
- makes the screen fade to black in the given number of milliseconds.
- FadeIn(milliseconds)
- makes the screen fade from black in the given number of milliseconds.
- FadeToColor(milliseconds, clr)
- same as
FadeOut(), except that 'clr' is a Color object that defines the color the screen fades to.
- same as
- FadeFromColor(milliseconds, clr)
- same as
FadeIn(), except that 'clr' is a Color object that defines the color the screen fades from.
- same as
Examples
To make the screen fade out in three seconds, write:
FadeOut(3000);
To make it fade in:
FadeIn(3000);
Notes
-
FadeOut(),FadeIn(),FadeToColor()andFadeFromColor()simply grab the current screen and fade it. That's why you have to take care that something has been drawn onto it and that it hasn't been cleared (i.e. because of FlipScreen()) before they're called. - If you try to fade in a map by placing
FadeIn()in the map entry script, you might not get what you expect. When the entry script is called, the map hasn't been rendered yet. This is why your entry script should call RenderMap() first:
RenderMap(); FadeIn(1000);
-
Screen.jsautomatically includes colors.js (system script).