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.
Description
Section titled “Description”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.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
Tween | to(Supplier | Creates a tween of duration ms that moves the value from where it is when the tween begins to the target. |
Tween | from(Supplier | 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 | Creates a tween without duration that sets the target at once. |
Tween | call(EventListener | 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. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| target | float | 0F | The value to reach; a call to target(...) cancels a relative target. |
| path | ITweenPath | TweenPaths.CATMULL_ROM | The curve that joins the start, the waypoints and the target; it has an effect only with waypoints. |
| easing | TweenEquation | TweenEquations.LINEAR | The curve that maps the elapsed time to the progress. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
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. |
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
Events
Section titled “Events”Inherited from BaseTween (8)
onStart · onIterationStart · onIterationEnd · onComplete · onReverseStart · onReverseIterationStart · onReverseIterationEnd · onReverseComplete
Creation details
Section titled “Creation details”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.
Property details
Section titled “Property details”target
Section titled “target”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.
easing
Section titled “easing”this easing(TweenEquation easing)fluentTweenEquation getEasing()
Default: TweenEquations.LINEAR
The curve that maps the elapsed time to the progress.
Method details
Section titled “Method details”targetRelative
Section titled “targetRelative”this targetRelative(float target) fluent
Sets the target to the start value plus target, then returns this tween.
waypoint
Section titled “waypoint”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
