FlixelFlickerTween
View sourceclass
org.flixelgdx.tween.type.FlixelFlickerTween
public class FlixelFlickerTween extends FlixelTween
Toggles FlixelVisible.isVisible() over time; restores visibility on completion.
Constructors
FlixelFlickerTween(FlixelTweenSettings)
public FlixelFlickerTween(FlixelTweenSettings settings)
Fields
flickerTarget
protected FlixelVisible flickerTarget
period
protected float period
ratio
protected float ratio
tweenFunction
protected Predicate<FlixelFlickerTween> tweenFunction
endVisibility
protected boolean endVisibility
Methods
setFlicker(FlixelVisible, float, float, boolean, Predicate<FlixelFlickerTween>)
public FlixelFlickerTween setFlicker(FlixelVisible flickerTarget, float period, float ratio, boolean endVisibility, Predicate<FlixelFlickerTween> tweenFunction)
Registers the visibility target and the flicker's per-cycle timing.
Parameters:
| Name | Description |
|---|---|
flickerTarget | The object to toggle visibility on. |
period | Length of one full on/off cycle, in seconds. |
ratio | Fraction of each period spent invisible, clamped to [0, 1]. A ratio of 0.5 reproduces HaxeFlixel's FlxFlicker.flicker even toggle, where HaxeFlixel's Interval parameter is half of this period. Other ratios bias the cycle toward mostly visible or mostly invisible, which HaxeFlixel's toggle-only flicker cannot do. |
endVisibility | Visibility to restore once a non-looping flicker finishes. |
tweenFunction | Custom visibility function, or null to use FlixelFlickerTween.defaultTweenFunction(FlixelFlickerTween). |
Returns: this tween for chaining.
defaultTweenFunction(FlixelFlickerTween)
public static boolean defaultTweenFunction(FlixelFlickerTween t)
The default tween function that toggles visibility based on the period and ratio.
Parameters:
| Name | Description |
|---|---|
t | The tween. |
Returns: true if the object should be visible, false otherwise.
updateTweenValues()
protected void updateTweenValues()
finish()
public void finish()
isTweenOf(Object, String)
public boolean isTweenOf(Object object, String field)
reset()
public void reset()
getSecondsSinceStart()
public float getSecondsSinceStart()
getPeriod()
public float getPeriod()
getRatio()
public float getRatio()