Package nl.colorize.multimedialib.scene
Class Effect
- java.lang.Object
-
- nl.colorize.multimedialib.scene.Effect
-
- All Implemented Interfaces:
Renderable,Updatable
public class Effect extends java.lang.Object implements Updatable, Renderable
An animated graphical effect that can be played as part of a scene. In combination with theEffectManager, this allows declarative effects that can be played without having to manually update their logic and graphics every frame.The effect consists of a sprite that is animated according to a timeline. When the effect is created, a callback function is passed that is used to determine how the sprite should be modified based on the timeline's value. This callback is then called every frame, with the effect and the timeline's current value as the arguments.. Afterwards, the sprite is rendered.
-
-
Constructor Summary
Constructors Constructor Description Effect(Animation anim, nl.colorize.util.animation.Timeline timeline, java.util.function.BiConsumer<Effect,java.lang.Float> callback)Effect(Image image, nl.colorize.util.animation.Timeline timeline, java.util.function.BiConsumer<Effect,java.lang.Float> callback)Effect(Sprite sprite, nl.colorize.util.animation.Timeline timeline, java.util.function.BiConsumer<Effect,java.lang.Float> callback)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PointgetPosition()TransformgetTransform()booleanisCompleted()voidrender(GraphicsContext graphics)voidupdate(float deltaTime)Updates this object for the current frame.
-
-
-
Constructor Detail
-
Effect
public Effect(Sprite sprite, nl.colorize.util.animation.Timeline timeline, java.util.function.BiConsumer<Effect,java.lang.Float> callback)
-
Effect
public Effect(Animation anim, nl.colorize.util.animation.Timeline timeline, java.util.function.BiConsumer<Effect,java.lang.Float> callback)
-
-
Method Detail
-
getPosition
public Point getPosition()
-
getTransform
public Transform getTransform()
-
update
public void update(float deltaTime)
Description copied from interface:UpdatableUpdates this object for the current frame.
-
isCompleted
public boolean isCompleted()
-
render
public void render(GraphicsContext graphics)
- Specified by:
renderin interfaceRenderable
-
-