Class Effect
java.lang.Object
nl.colorize.multimedialib.scene.effect.Effect
- All Implemented Interfaces:
Scene
Deprecated.
Effects are short-lived sub-scenes that can be defined in a declarative
style. Effects are not intended to contain general application logic, they
are intended for small, self-contained effects that are active for a
limited period of time and are independent of other things happening in
the scene.
Behavior can be added to effects in the form of handlers. These handlers operate on different points in the effect's lifecycle, for example during frame updates or after the effect is marked as completed.
Effects can be "linked" to graphics. When the effect ends, it will automatically remove all linked graphics from the stage. This allows the effect to control the life cycle for both the effect logic and the associated graphics.
-
Constructor Summary
ConstructorsConstructorDescriptionEffect()Deprecated.Creates a new effect that initially does not define any behavior and is not linked to any graphics. -
Method Summary
Modifier and TypeMethodDescriptionaddClickHandler(Supplier<Rect> bounds, Runnable handler) Deprecated.addClickHandler(Rect bounds, Runnable handler) Deprecated.addClickHandler(StageNode2D graphic, Runnable handler) Deprecated.addCompletionHandler(Runnable handler) Deprecated.addFrameHandler(Runnable handler) Deprecated.addFrameHandler(Updatable handler) Deprecated.addTimelineHandler(nl.colorize.util.animation.Timeline timeline, Consumer<Float> callback) Deprecated.Adds a frame handler that will update the specified timeline during every frame update, then invokes the callback function based on the timeline's new value.addTimerHandler(Timer timer, Consumer<Float> callback) Deprecated.Adds a frame handler that will update the specified timer during every update, then invokes the callback function based on the timer's new value.attach(SceneContext context) Deprecated.Attaches this effect to the specified scene context.static EffectDeprecated.Creates an effect that will first wait for the specified period of time, and will then perform an action.voidend(SceneContext context) Deprecated.Clean-up logic that is performed every time the scene ends.booleanDeprecated.Indicates the scene has been completed and no longer wishes to receive frame updates.linkGraphics(StageNode2D... graphics) Deprecated.Links existing graphics to this effect.removeAfterwards(StageNode2D... graphics) Deprecated.UselinkGraphics(StageNode2D...)instead.stopAfter(float duration) Deprecated.Adds a handler that will mark the effect as completed once the specified period of time has elapsed.stopAfterAnimation(Sprite sprite) Deprecated.Adds a handler that will mark the effect as completed once the specified sprite animation has ended.stopIf(BooleanSupplier condition) Deprecated.Adds a handler that will mark the effect as completed once the specified condition is met.Deprecated.Adds a handler that will always return false, and will therefore make the effect continue indefinitely.stopNow()Deprecated.Adds a handler that will mark the effect as completed during the next frame update.voidupdate(SceneContext context, float deltaTime) Deprecated.Called during every frame update for as long as the scene is active.<T extends StageNode2D>
voidwithLinkedGraphics(Class<T> type, Consumer<T> callback) Deprecated.voidwithLinkedGraphics(Consumer<StageNode2D> callback) Deprecated.
-
Constructor Details
-
Effect
public Effect()Deprecated.Creates a new effect that initially does not define any behavior and is not linked to any graphics. Prefer using the static factory methods to create effects with the desired behavior.
-
-
Method Details
-
addFrameHandler
-
addFrameHandler
-
addTimerHandler
-
addTimelineHandler
public Effect addTimelineHandler(nl.colorize.util.animation.Timeline timeline, Consumer<Float> callback) Deprecated.Adds a frame handler that will update the specified timeline during every frame update, then invokes the callback function based on the timeline's new value. The effect will be marked as completed once the timeline ends. -
addClickHandler
-
addClickHandler
-
addClickHandler
Deprecated. -
addCompletionHandler
-
stopAfter
Deprecated.Adds a handler that will mark the effect as completed once the specified period of time has elapsed. -
stopAfterAnimation
-
stopIf
Deprecated.Adds a handler that will mark the effect as completed once the specified condition is met. -
stopNow
Deprecated.Adds a handler that will mark the effect as completed during the next frame update. -
stopNever
Deprecated.Adds a handler that will always return false, and will therefore make the effect continue indefinitely. -
linkGraphics
Deprecated.Links existing graphics to this effect. This means the graphics will be removed from stage when the effect has completed. -
removeAfterwards
Deprecated.UselinkGraphics(StageNode2D...)instead.Links existing graphics to this effect. This means the graphics will be removed from stage when the effect has completed. -
update
Deprecated.Description copied from interface:SceneCalled during every frame update for as long as the scene is active.deltaTimeindicates the elapsed time since the last frame, in seconds. -
end
Deprecated.Description copied from interface:SceneClean-up logic that is performed every time the scene ends.This method is optional, the default implementation does nothing.
-
isCompleted
public boolean isCompleted()Deprecated.Description copied from interface:SceneIndicates the scene has been completed and no longer wishes to receive frame updates.If this scene is the currently active scene, it might not actually end until a new scene is requested.
If this scene is a completed sub-scene, meaning there is a parent scene which is still active, this sub-scene will end after the current frame.
- Specified by:
isCompletedin interfaceScene
-
withLinkedGraphics
Deprecated. -
withLinkedGraphics
@Deprecated public <T extends StageNode2D> void withLinkedGraphics(Class<T> type, Consumer<T> callback) Deprecated. -
attach
Deprecated.Attaches this effect to the specified scene context. Using this method is identical tosceneContext.attach(effect), but is more readable when creating effects using the fluent API. -
delay
-
SceneContext. This class will be removed in a future version of MultimediaLib.