TransitionStep
class TransitionStep
Implements: Cloneable
Package: dev.joid.lib.ui.core.transition · Module: core · Source: TransitionStep.java
One step of a transition, opening or closing, that animates a progress from 0 to 1 and draws the UI through its drawing.
Description
Section titled “Description”The progress starts at the first frame the UI is drawn, so a UI opened during a heavy frame still plays its whole step. When a UI closes during its opening, the closing step starts from the progress the opening had reached.
Learn more
Section titled “Learn more”Creation
Section titled “Creation”| Returns | Signature | Summary |
|---|---|---|
TransitionStep | create(float duration, TweenEquation equation) factory | Creates a step that lasts this many ms with this easing, and that draws the UI unchanged until you give it a drawing. |
| TransitionStep(float duration, TweenEquation equation) protected | Called by a subclass with the same arguments as create. |
Properties
Section titled “Properties”| Property | Type | Default | Summary |
|---|---|---|---|
| draw | TransitionDrawing | (ui, progress, body) -> body.run() | How the step draws the UI for a progress between 0 and 1; the drawing must run the body it receives. |
| enabled | boolean | true | If false, the step does not play and the UI opens or closes at once. |
Methods
Section titled “Methods”| Returns | Signature | Summary |
|---|---|---|
T | copy() | Returns a copy of the step, of the same class, with its fields and a copy of its animator: value, speed and listeners. |
void | start() | Plays the step from the start. |
void | start(float progress) | Plays the step from this progress, for the remaining share of its duration. |
void | stop() | Stops the step; the UI is drawn without it from then on. |
void | render(UI ui, Runnable body) | Draws the body of the UI through the drawing of the step while the step plays, and as it is otherwise. |
TweenAnimator | getAnimator() | The animator that holds the progress of the step. |
boolean | isRunning() | If true, the step is playing. |
For subclasses
Section titled “For subclasses”| Returns | Signature | Summary |
|---|---|---|
void | init(UI ui) hook | Hook that JOID calls when the UI opens, before the opening step starts, for each enabled step; the default does nothing. |
Creation details
Section titled “Creation details”create
Section titled “create”TransitionStep create(float duration, TweenEquation equation) factory
Creates a step that lasts this many ms with this easing, and that draws the UI unchanged until you give it a drawing.
TransitionStep
Section titled “TransitionStep”TransitionStep(float duration, TweenEquation equation) protected
Called by a subclass with the same arguments as create.
Property details
Section titled “Property details”this draw(TransitionDrawing draw)fluent
Default: (ui, progress, body) -> body.run()
How the step draws the UI for a progress between 0 and 1; the drawing must run the body it receives.
enabled
Section titled “enabled”this enabled(boolean enabled)fluentboolean isEnabled()
Default: true
If false, the step does not play and the UI opens or closes at once.
Method details
Section titled “Method details”<T extends TransitionStep> T copy()
Throws:
IllegalStateException: …
Returns a copy of the step, of the same class, with its fields and a copy of its animator: value, speed and listeners. A UI plays copies of the steps of its transition; the fields of a subclass are copied as they are, without a copy of the objects they hold.
void start()
Plays the step from the start.
void start(float progress)
Plays the step from this progress, for the remaining share of its duration.
void stop()
Stops the step; the UI is drawn without it from then on.
render
Section titled “render”void render(UI ui, Runnable body)
Draws the body of the UI through the drawing of the step while the step plays, and as it is otherwise.
getAnimator
Section titled “getAnimator”TweenAnimator getAnimator()
The animator that holds the progress of the step.
isRunning
Section titled “isRunning”boolean isRunning()
If true, the step is playing.
void init(UI ui) hook
Hook that JOID calls when the UI opens, before the opening step starts, for each enabled step; the default does nothing.
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
