class flixel.effects.FlxFlicker implements IFlxDestroyable

Available on all platforms

The retro flickering effect with callbacks. You can use this as a mixin in any FlxObject subclass or by calling the static functions. @author pixelomatic

Class Fields

static function flicker(Object:FlxObject, ?Duration:Float = 1, ?Interval:Float = 0.04f, ?EndVisibility:Bool = true, ?ForceRestart:Bool = true, ?CompletionCallback:FlxFlicker ->Void = null, ?ProgressCallback:FlxFlicker ->Void = null):Void

A simple flicker effect for sprites using a ping-pong tween by toggling visibility. * *

Object

The sprite. *

Duration

How long to flicker for. *

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 beginnig, 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.

static function isFlickering(Object:FlxObject):Bool

Returns whether the object is flickering or not. *

Object

The object to test.

static function stopFlickering(Object:FlxObject):Void

Stops flickering of the object. Also it will make the object visible. *

Object

The object to stop flickering.

Instance Fields

var duration:Float

The duration of the flicker.

var endVisibility:Bool

The final visibility of the object after flicker is complete.

var interval:Float

The interval of the flicker.

var object:FlxObject

The flickering object.

var timer:FlxTimer

The flicker timer. You can check how many seconds has passed since flickering started etc.

function completionCallback(:FlxFlicker):Void

The callback that will be triggered after flicker has completed.

function destroy():Void

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

function progressCallback(:FlxFlicker):Void

The callback that will be triggered every time object visiblity is changed.