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

@:value({ ForceRestart : true, EndVisibility : true, Interval : 0.04, Duration : 1 })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). 0 means "forever".

Interval

In what interval to toggle visibility. Set to FlxG.elapsed if <= 0!

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. FlxFlickers 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 onlyduration:Float

The duration of the flicker (in seconds). 0 means "forever".

read onlyendVisibility:Bool

The final visibility of the object after flicker is complete.

read onlyinterval:Float

The interval of the flicker.

read onlyobject:FlxObject

The flickering object.

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.

Methods

destroy():Void

Nullifies the references to prepare object for reuse and avoid memory leaks.

stop():Void

Prematurely ends flickering.