Skip to content

Tween

final class Tween
Extends: BaseTween<Tween>
Package: dev.joid.lib.animation.tween · Module: core · Source: Tween.java

Moves one float value, read and written through a getter and a setter, to a target over a duration.

The getter is read when the tween begins, after its delay, so a tween placed in a sequence starts from the value that the previous steps left. TweenAnimator.tween gives a tween already wired to an animator. A duration below 0 throws an IllegalArgumentException. A tween moves only while its manager is updated: Animate values of your own shows tweens in a timeline.

ReturnsSignatureSummary
Tweento(Supplier getter, Consumer setter, float duration) factoryCreates a tween of duration ms that moves the value from where it is when the tween begins to the target.
Tweenfrom(Supplier getter, Consumer setter, float duration) factoryCreates a tween of duration ms that moves the value from the target back to where it was when the tween began.
Tweenset(Supplier getter, Consumer setter) factoryCreates a tween without duration that sets the target at once.
Tweencall(EventListener listener) factoryCreates an empty step that calls listener when a timeline reaches it.
Tweenmark() factoryCreates an empty step without value, a place in a timeline.

PropertyTypeDefaultSummary
targetfloat0FThe value to reach; a call to target(...) cancels a relative target.
pathITweenPathTweenPaths.CATMULL_ROMThe curve that joins the start, the waypoints and the target; it has an effect only with waypoints.
easingTweenEquationTweenEquations.LINEARThe curve that maps the elapsed time to the progress.

ReturnsSignatureSummary
thistargetRelative(float target) fluentSets the target to the start value plus target, then returns this tween.
thiswaypoint(float waypoint) fluentAdds a value to pass through on the way, after the previous waypoints, then returns this tween.
Inherited from BaseTween (25)

getFullDuration · isFinished · getDelay · isYoyo · getRepeatCount · getDuration · getRepeatDelay · getStep · isPaused · getCurrentTime · isStarted · isInitialized · getUserData · start · build · kill · pause · resume · delay · repeat · repeatYoyo · userData · forceToStart · forceToEnd · update

Inherited from BaseTween (8)

onStart · onIterationStart · onIterationEnd · onComplete · onReverseStart · onReverseIterationStart · onReverseIterationEnd · onReverseComplete

Tween to(Supplier<Float> getter, Consumer<Float> setter, float duration) factory

Creates a tween of duration ms that moves the value from where it is when the tween begins to the target.

Tween from(Supplier<Float> getter, Consumer<Float> setter, float duration) factory

Creates a tween of duration ms that moves the value from the target back to where it was when the tween began.

Tween set(Supplier<Float> getter, Consumer<Float> setter) factory

Creates a tween without duration that sets the target at once.

Tween call(EventListener<TweenEvent> listener) factory

Creates an empty step that calls listener when a timeline reaches it.

Tween mark() factory

Creates an empty step without value, a place in a timeline.

  • this target(float target) fluent

Default: 0F

The value to reach; a call to target(...) cancels a relative target.

  • this path(ITweenPath path) fluent

Default: TweenPaths.CATMULL_ROM

The curve that joins the start, the waypoints and the target; it has an effect only with waypoints.

  • this easing(TweenEquation easing) fluent
  • TweenEquation getEasing()

Default: TweenEquations.LINEAR

The curve that maps the elapsed time to the progress.

this targetRelative(float target) fluent

Sets the target to the start value plus target, then returns this tween.

this waypoint(float waypoint) fluent

Adds a value to pass through on the way, after the previous waypoints, then returns this tween. With a relative target, the waypoint is relative to the start value too.


fluent returns the instance, typed for chaining · factory creates an instance · signal also accepts a value that follows signals, as a signal, an expression or a lambda (When does JOID compute this value again?) · hook called by JOID, override it · abstract you implement it · default interface method with a body · static called on the class · protected visible to subclasses

Report a problem with this page