Skip to main content

FlixelShakeable

View source

interface

org.flixelgdx.functional.FlixelShakeable

public interface FlixelShakeable

Something FlixelShakeTween can jitter and restore without caring whether the underlying channel is a sprite graphic offset, a world position, or a desktop window position.

Implementations choose what X and Y mean: FlixelSprite uses graphic offset; FlixelObject uses world position; FlixelWindow uses window placement in screen coordinates.

See Also: FlixelShakeTween

Methods

getShakeX()

public float getShakeX()

Current shake channel X (for example graphic offset or world X).

Returns: Shake X before jitter is applied.


getShakeY()

public float getShakeY()

Current shake channel Y.

Returns: Shake Y before jitter is applied.


setShake(float, float)

public void setShake(float x, float y)

Sets the shake channel to absolute coordinates (typically base plus jitter).

Parameters:

NameDescription
xNew shake X.
yNew shake Y.

getShakeWidth()

public default float getShakeWidth()

Width used to scale FlixelShakeUnit.FRACTION on the X axis. Values 0 or less mean the tween treats intensity like plain pixels on that axis.

Returns: Reference width for fractional shake, or non-positive to fall back.


getShakeHeight()

public default float getShakeHeight()

Height used to scale FlixelShakeUnit.FRACTION on the Y axis. Values 0 or less mean the tween treats intensity like plain pixels on that axis.

Returns: Reference height for fractional shake, or non-positive to fall back.


shakeFractionWidthFromGraphics()

public default float shakeFractionWidthFromGraphics()

Convenience default for fullscreen targets: uses the back buffer size when libGDX graphics is available.

Returns: Positive width in pixels, or 0f if unknown.


shakeFractionHeightFromGraphics()

public default float shakeFractionHeightFromGraphics()

Convenience default for fullscreen targets: uses the back buffer size when libGDX graphics is available.

Returns: Positive height in pixels, or 0f if unknown.