FadeEffect class

Animates the Renderable.opacity of an entity's RenderableComponent from a starting alpha to to over durationTicks ticks.

Opacity is clamped to [0.0, 1.0] after each delta application.

The entity must have a RenderableComponent; if absent, the effect is a no-op. Applies an additive delta per tick so multiple FadeEffects stack — two simultaneous fades contribute the sum of their opacity deltas.

// Fade out:
FadeEffect(to: 0.0, durationTicks: 60, easing: EasingType.easeInQuad)

// Fade in from black:
FadeEffect(from: 0.0, to: 1.0, durationTicks: 30)
Inheritance

Constructors

FadeEffect({required double to, double? from, EasingType easing = EasingType.linear, int durationTicks = 30, bool loop = false, VoidCallback? onComplete})

Properties

durationTicks → int
Duration of this effect in fixed game-loop ticks.
finalinherited
easing → EasingType
Easing curve.
final
effectType → String
Unique string discriminator used by EffectSerializer.
no setteroverride
from → double?
Explicit start opacity [0, 1]. When null the entity's current Renderable.opacity is captured on the first tick.
final
hashCode → int
The hash code for this object.
no setterinherited
loop ↔ bool
When true, EffectPlayer resets and replays this effect indefinitely.
getter/setter pairinherited
onComplete ↔ VoidCallback?
Called once when a non-looping effect reaches durationTicks.
getter/setter pairinherited
onLoopComplete ↔ VoidCallback?
Called at the boundary of each completed loop iteration when loop is true. Fire custom logic (sound, spawn) at each repeat.
getter/setter pairinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
to → double
Target opacity [0, 1].
final

Methods

applyTick(EffectContext ctx, int prevElapsed, int currElapsed) → void
Apply the effect delta covering ticks prevElapsed → currElapsed.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reset() → void
Reset mutable state so the effect can be replayed by EffectPlayer on loop restart.
override
tAt(int elapsed) → double
Normalised progress for elapsed ticks in [0.0, 1.0].
inherited
toJson() → Map<String, dynamic>
Encode this effect's parameters to a JSON-compatible map.
override
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited