The retro flickering effect with callbacks. You can use this as a mixin in any FlxObject subclass or by calling the static functions.
Static methods
staticflicker(Object:FlxObject, Duration:Float = 1, Interval:Float = 0.04, EndVisibility:Bool = true, ForceRestart:Bool = true, ?CompletionCallback:FlxFlicker ‑> Void, ?ProgressCallback:FlxFlicker ‑> Void):FlxFlicker
A simple flicker effect for sprites using a FlxTimer
to toggle visibility.
Parameters:
Object | The object. |
---|---|
Duration | How long to flicker for (in seconds). |
Interval | In what interval to toggle visibility. Set to |
EndVisibility | Force the visible value when the flicker completes, useful with fast repetitive use. |
ForceRestart | Force the flicker to restart from beginning, discarding the flickering effect already in progress if there is one. |
CompletionCallback | An optional callback that will be triggered when a flickering has finished. |
ProgressCallback | An optional callback that will be triggered when visibility is toggled. |
Returns:
The FlxFlicker
object. FlxFlicker
s are pooled internally, so beware of storing references.
staticisFlickering(Object:FlxObject):Bool
Returns whether the object is flickering or not.
Parameters:
Object | The object to test. |
---|
staticstopFlickering(Object:FlxObject):Void
Stops flickering of the object. Also it will make the object visible.
Parameters:
Object | The object to stop flickering. |
---|
Variables
read onlytimer:FlxTimer
The flicker timer. You can check how many seconds has passed since flickering started etc.
read onlycompletionCallback:FlxFlicker ‑> Void
The callback that will be triggered after flicker has completed.
read onlyprogressCallback:FlxFlicker ‑> Void
The callback that will be triggered every time object visiblity is changed.