Skip to content

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.

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.

ReturnsSignatureSummary
TransitionStepcreate(float duration, TweenEquation equation) factoryCreates 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) protectedCalled by a subclass with the same arguments as create.

PropertyTypeDefaultSummary
drawTransitionDrawing(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.
enabledbooleantrueIf false, the step does not play and the UI opens or closes at once.

ReturnsSignatureSummary
Tcopy()Returns a copy of the step, of the same class, with its fields and a copy of its animator: value, speed and listeners.
voidstart()Plays the step from the start.
voidstart(float progress)Plays the step from this progress, for the remaining share of its duration.
voidstop()Stops the step; the UI is drawn without it from then on.
voidrender(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.
TweenAnimatorgetAnimator()The animator that holds the progress of the step.
booleanisRunning()If true, the step is playing.
ReturnsSignatureSummary
voidinit(UI ui) hookHook that JOID calls when the UI opens, before the opening step starts, for each enabled step; the default does nothing.

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.

  • 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.

  • this enabled(boolean enabled) fluent
  • boolean isEnabled()

Default: true

If false, the step does not play and the UI opens or closes at once.

<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.

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.

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

Report a problem with this page