Class CrossFadeEffect
Dissolves a region from one screen into another by blending colors rather than by swapping cells in an order.
Inherited Members
Namespace: Scylla.TextMode
Assembly: ScyllaTextMode.dll
Syntax
public sealed class CrossFadeEffect : TransitionEffectBase, ITextEffect, IDisposable
Remarks
A text grid cannot show two different characters at once, so a cell cannot be half of each. Instead every cell that changes dips toward a middle color, swaps at the bottom of the dip and comes back up, which is as close to a cross fade as a character grid gets. Cells the two screens agree on completely are left untouched.
All those swaps landing on the same frame reads as a hard cut in the middle of a smooth fade, so cells are staggered by the effect's mask. The mask gives the stagger its shape: random by default, or sweeping across with a directional one, and CellDuration controls how spread out it is. A cell duration of 1 puts every cell on the same schedule and changes the whole region as one.
Only the cells actually mid-dip are rewritten each frame. Cells whose turn has not come round, and cells that have finished, hold a constant appearance and are left alone.
Properties
MidColor
Gets or sets the color cells dip through when their character has to change. Defaults to the grid's background, which reads as the old character fading out before the new one fades in.
Declaration
public Color32 MidColor { get; set; }
Property Value
| Type | Description |
|---|---|
| Color32 |
Methods
OnEffectRelease()
Called when the effect is disposed. Return anything rented from the context here.
Declaration
protected override void OnEffectRelease()
Overrides
OnEffectTick(float, float)
Called once per tick to draw the effect at the given progress.
Declaration
protected override void OnEffectTick(float progress, float easedProgress)
Parameters
| Type | Name | Description |
|---|---|---|
| float | progress | Linear progress from 0 to 1. |
| float | easedProgress | Progress with the easing curve applied. |
Overrides
OnTransitionStart()
Called when the effect starts, after both the starting and target states are ready.
Declaration
protected override void OnTransitionStart()
Overrides
SetMidColor(Color32)
Sets the color cells dip through when their character has to change.
Declaration
public CrossFadeEffect SetMidColor(Color32 color)
Parameters
| Type | Name | Description |
|---|---|---|
| Color32 | color | The dip color. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | This effect, for chaining. |