Class ScreenFade
A fade or a wipe over the whole window: to a colour and back round a scene change, a cut, a bar that sweeps across. AddScreenFade(IGame, Color?) puts one in the scene; the transition methods start it, and it draws itself every frame through a shape batch after the post effects, so nothing else in the frame is affected.
[Display("Screen Fade", null)]
[ComponentCategory("Rendering")]
public sealed class ScreenFade : SyncScript, IIdentifiable, ICollectorHolder
- Inheritance
-
ScreenFade
- Implements
- Inherited Members
- Extension Methods
Remarks
Transition(float, Action, float) and Wipe(float, Action, float) take the action to run while the screen is covered, which is where a scene is switched, a level loaded or a player moved: it happens between the two halves, and the player sees the colour and then the result. FadeOut(float) and FadeIn(float) are the halves on their own, and Cut(bool) covers or clears at once.
A transition started while another runs replaces it from the cover the screen has at that moment.
Properties
Color
Gets or sets the colour the screen fades to. Defaults to black.
public Color Color { get; set; }
Property Value
Covered
Gets how much of the screen is covered now, 0 clear to 1 covered.
public float Covered { get; }
Property Value
IsRunning
Gets whether a transition is in progress.
public bool IsRunning { get; }
Property Value
Methods
Cut(bool)
Covers or clears the screen at once, ending any transition.
public void Cut(bool covered)
Parameters
coveredbool
FadeIn(float)
Fades from the colour to the scene over seconds.
public void FadeIn(float seconds)
Parameters
secondsfloat
FadeOut(float)
Fades to the colour over seconds and stays covered.
public void FadeOut(float seconds)
Parameters
secondsfloat
Start()
Takes the batch the fade draws with.
public override void Start()
Transition(float, Action, float)
Fades to the colour over outSeconds, runs between while the screen is
covered, then fades back over inSeconds.
public void Transition(float outSeconds, Action between, float inSeconds)
Parameters
Update()
Advances the transition and draws the cover.
public override void Update()
Wipe(float, Action, float)
A bar of the colour sweeps in from the left over outSeconds until it covers the screen,
between runs, and the bar sweeps on out to the right over inSeconds.
public void Wipe(float outSeconds, Action between, float inSeconds)