Class TextEffects
Creates configured text effects, ready to be handed to a view's effect player.
Inherited Members
Namespace: Scylla.TextMode
Assembly: ScyllaTextMode.dll
Syntax
public static class TextEffects
Remarks
This is the front door of the effects system. A typical call reads as one expression:
view.Effects.Play(TextEffects.Typewriter(5, 2, "ACCESS GRANTED", green, black)
.SetCharactersPerSecond(24f)
.SetCursor('_'));
view.Effects.Play(TextEffects.FadeIn(panel)
.SetMask(CellMask.Wipe(TextEffectDirection.LeftToRight))
.SetCellDuration(0.3f)
.SetDuration(0.8f));
Effects created here are not started. Passing one to Play<T>(T) starts it and hands over ownership, so the player advances it every frame and disposes it when it finishes.
Methods
Blinds(int, bool, in CellRect)
Creates a transition that fills parallel bands in turn.
Declaration
public static CrossFadeEffect Blinds(int bands = 6, bool horizontal = true, in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| int | bands | How many bands to divide the region into. |
| bool | horizontal | True for bands running across the region, false for bands running down it. |
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | An unstarted transition. |
BoxWipe(bool, in CellRect)
Creates a transition that opens or closes a rectangle at the center of the region.
Declaration
public static CrossFadeEffect BoxWipe(bool inward = false, in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | inward | True to close in on the center instead of opening outward. |
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | An unstarted transition. |
ClockWipe(bool, in CellRect)
Creates a transition that sweeps a hand around the center of the region.
Declaration
public static CrossFadeEffect ClockWipe(bool clockwise = true, in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | clockwise | False to sweep the other way. |
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | An unstarted transition. |
ColorCycle(ColorGradient, in CellRect)
Creates an effect that runs a region's text through a color gradient.
Declaration
public static ColorCycleEffect ColorCycle(ColorGradient gradient, in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| ColorGradient | gradient | The gradient to color the text from. |
| CellRect | region | The block of cells to color. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| ColorCycleEffect | An unstarted color cycle. |
CrispTransition(in CellMask, in CellRect)
Creates a transition that switches each cell from one screen to the other in a single frame, in the order a mask decides.
Declaration
public static MaskTransitionEffect CrispTransition(in CellMask mask, in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellMask | mask | The order cells change over in. |
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| MaskTransitionEffect | An unstarted transition. |
Remarks
Pair it with a target and a mask. The named helpers below cover the common shapes:
view.Effects.Play(TextEffects.Wipe(TextEffectDirection.LeftToRight).To(DrawMenu));
view.Effects.Play(TextEffects.Dissolve().To(DrawMenu).SetDuration(0.8f));
See Also
CrossFade(in CellRect)
Creates a transition that blends one screen into another by color rather than by swapping cells in an order.
Declaration
public static CrossFadeEffect CrossFade(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | An unstarted cross fade. |
Remarks
Cells sharing a character between the two screens blend smoothly. Cells whose character changes dip through a middle color and swap at the bottom of the dip, because a text grid cannot show two characters at once.
Decode(in CellRect)
Creates a decode effect that resolves a region out of scrambled characters. The region is captured when the effect starts, so draw the content first.
Declaration
public static DecodeEffect Decode(in CellRect region)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to decode. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| DecodeEffect | An unstarted decode effect. |
Remarks
Cells resolve in a random order, which is what reads as decryption. Pass a different mask for a different feel: Sequential() resolves in reading order, and a wipe resolves as a sweep.
The easing is what stops the decode ending in a rush. Resolving at a constant rate packs the last tenth of the cells into the last five percent of the run, so they all land together; easing out spreads that tail across roughly a third of the run instead, leaving the final few characters to trickle in.
The cell duration is paired with the curve rather than chosen independently. Between them they decide when the first cell resolves, and holding that point steady while the curve gets steeper is what lengthens the tail without shortening the scrambled phase that precedes it. Changing one without the other moves both.
With these defaults the region stays fully scrambled for a little over a quarter of the run, and the last tenth of the cells take a little under half of it. Both are proportions of the duration, so a longer tail means a longer effect: there is no setting that fits a three second trickle into a four second decode that also spends nearly two seconds scrambled.
The glyph churn winds down alongside all of that, from twenty re-rolls a second to three. Holding the churn flat while the resolve order eases out leaves the stragglers in the tail thrashing at full speed against a screen that has otherwise settled, which reads as though they are stuck rather than as though the decryption is closing in.
Decode(int, int, string, Color32, Color32)
Creates a decode effect that writes its own text and then resolves it out of scrambled characters.
Declaration
public static DecodeEffect Decode(int row, int column, string text, Color32 foreground, Color32 background)
Parameters
| Type | Name | Description |
|---|---|---|
| int | row | Row the text starts on. |
| int | column | Column the text starts at. |
| string | text | The text to decode onto. |
| Color32 | foreground | Foreground color of the settled text. |
| Color32 | background | Background color of the settled text. |
Returns
| Type | Description |
|---|---|
| DecodeEffect | An unstarted decode effect. |
DigitalRain(in CellRect)
Creates a transition that runs falling characters down the region, leaving the new screen behind as they pass.
Declaration
public static DigitalRainEffect DigitalRain(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| DigitalRainEffect | An unstarted digital rain. |
Remarks
Columns set off at staggered moments but all land together, so the effect finishes exactly when its duration says it will and can be sequenced with anything else.
Dissolve(in CellRect)
Creates a transition that changes cells over in a random order.
Declaration
public static CrossFadeEffect Dissolve(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | An unstarted transition. |
FadeIn(in CellRect)
Creates an effect that fades a region's existing content in from a color.
Declaration
public static FadeEffect FadeIn(in CellRect region)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to fade. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| FadeEffect | An unstarted fade effect. |
FadeOut(in CellRect)
Creates an effect that fades a region's existing content out to a color.
Declaration
public static FadeEffect FadeOut(in CellRect region)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to fade. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| FadeEffect | An unstarted fade effect. |
Flicker(in CellRect)
Creates an effect that dips a region's brightness at irregular intervals, the way a tired display does.
Declaration
public static FlickerEffect Flicker(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to flicker. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| FlickerEffect | An unstarted flicker. |
Glitch(in CellRect)
Creates an effect that corrupts a region in short bursts, tearing rows, replacing characters and inverting patches.
Declaration
public static GlitchEffect Glitch(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to corrupt. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| GlitchEffect | An unstarted glitch. |
Iris(bool, in CellRect)
Creates a transition that opens or closes a circle at the center of the region.
Declaration
public static CrossFadeEffect Iris(bool inward = false, in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| bool | inward | True to close in on the center instead of opening outward. |
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | An unstarted transition. |
NoiseDissolve(in CellRect)
Creates a transition that spreads across the region like a burn rather than an even scatter.
Declaration
public static CrossFadeEffect NoiseDissolve(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | An unstarted transition. |
Pulse(in CellRect)
Creates an effect that breathes a region's brightness up and down without changing what it says.
Declaration
public static PulseEffect Pulse(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to pulse. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| PulseEffect | An unstarted pulse. |
Remarks
Ambient effects repeat without end unless given a loop count, and put the region back the way they found it when stopped.
Push(TextEffectDirection, TextEffectPushMode, in CellRect)
Creates a transition that slides the two screens past each other.
Declaration
public static PushEffect Push(TextEffectDirection direction, TextEffectPushMode mode = TextEffectPushMode.Push, in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TextEffectDirection | direction | The edge the new screen travels in from. |
| TextEffectPushMode | mode | How the two screens move relative to each other. |
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| PushEffect | An unstarted push. |
Sequence()
Creates an empty sequence, which runs effects one after another with optional pauses and callbacks between them.
Declaration
public static TextEffectSequencer Sequence()
Returns
| Type | Description |
|---|---|
| TextEffectSequencer | An empty sequence. |
Remarks
The callback step is what makes a sequence worth having: it is where the screen gets redrawn between one effect finishing and the next beginning.
view.Effects.Play(TextEffects.Sequence()
.Then(TextEffects.Wipe(TextEffectDirection.RightToLeft).ToCleared(green, black))
.Call(() => DrawRoom(console, room))
.Wait(0.2f)
.Then(TextEffects.Typewriter(20, 2, room.Description, green, black)));
SlideIn(in CellRect, TextEffectDirection)
Creates an effect that slides a region's existing content in from an edge.
Declaration
public static SlideInEffect SlideIn(in CellRect region, TextEffectDirection from)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to slide. An empty rectangle means the whole grid. |
| TextEffectDirection | from | The edge the content travels in from. |
Returns
| Type | Description |
|---|---|
| SlideInEffect | An unstarted slide effect. |
StaticTuneIn(in CellRect)
Creates a transition that buries the region in static and lets the new screen resolve out of it.
Declaration
public static StaticTuneInEffect StaticTuneIn(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| StaticTuneInEffect | An unstarted tune in. |
Transition(in CellMask, in CellRect)
Creates a transition that changes the region over to a new screen in the order a mask decides, which is every wipe, iris, blind and dissolve there is.
Declaration
public static CrossFadeEffect Transition(in CellMask mask, in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellMask | mask | The order cells change over in. |
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | An unstarted transition. |
Remarks
Each cell fades through the change rather than switching: it dims, swaps its character at the bottom of the dip, and comes back up. A wipe therefore arrives as a soft band and a set of blinds opens as a fade.
CrispTransition(in CellMask, in CellRect) is the same thing with a hard edge, and is cheaper: it writes only the cells that changed this frame, where this rewrites the whole region. On a full screen that is a few thousand cell writes a frame, which is cheap but not free.
Twinkle(in CellRect)
Creates an effect that scatters fading points of light through the empty parts of a region, the way stars come and go behind a title.
Declaration
public static TwinkleEffect Twinkle(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to twinkle. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| TwinkleEffect | An unstarted twinkle. |
Remarks
Text in the region is left alone; only cells that were empty when the effect started are used. That is what lets this run underneath a logo or a menu.
Typewriter(in CellRect, string, Color32, Color32)
Creates a typewriter effect confined to a block of cells, wrapping at the region's right edge and stopping at its bottom.
Declaration
public static TypewriterEffect Typewriter(in CellRect region, string text, Color32 foreground, Color32 background)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells the text is laid out within. |
| string | text | The text to type out. |
| Color32 | foreground | Foreground color of the revealed text. |
| Color32 | background | Background color of the revealed text. |
Returns
| Type | Description |
|---|---|
| TypewriterEffect | An unstarted typewriter effect. |
Typewriter(int, int, string, Color32, Color32)
Creates a typewriter effect that reveals text one character at a time, starting at a position and running to the bottom right of the grid.
Declaration
public static TypewriterEffect Typewriter(int row, int column, string text, Color32 foreground, Color32 background)
Parameters
| Type | Name | Description |
|---|---|---|
| int | row | Row the text starts on. |
| int | column | Column the text starts at. |
| string | text | The text to type out. |
| Color32 | foreground | Foreground color of the revealed text. |
| Color32 | background | Background color of the revealed text. |
Returns
| Type | Description |
|---|---|
| TypewriterEffect | An unstarted typewriter effect. |
Wave(in CellRect)
Creates an effect that rolls a sine wave through a region, displacing its rows as it passes.
Declaration
public static WaveEffect Wave(in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| CellRect | region | The block of cells to wave. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| WaveEffect | An unstarted wave. |
Wipe(TextEffectDirection, in CellRect)
Creates a transition that sweeps straight across the region.
Declaration
public static CrossFadeEffect Wipe(TextEffectDirection direction, in CellRect region = default)
Parameters
| Type | Name | Description |
|---|---|---|
| TextEffectDirection | direction | The direction to sweep in. |
| CellRect | region | The block of cells to transition. An empty rectangle means the whole grid. |
Returns
| Type | Description |
|---|---|
| CrossFadeEffect | An unstarted transition. |