Skip to content

Decorators and Sequences

Transitions can be combined using decorators and sequences
Each method returns a new transition, so you can easily chain multiple together

MethodDescription
.delay(double duration)Delays the transition by duration milliseconds
.ease(Ease ease)Applies an easing function to the transition
.speed(double speed)Changes the transition duration
2.0 makes the transition twice as fast
.repeat(int n)Repeats the transition n times
.then(Transitionable transition)Chains another transition to the end of the current one
.reverse()Reverses the direction of the transition
Alias for .ease(alpha -> 1d - alpha)
.loop()Repeats the transition forever
Alias for .repeat(-1)
.circular()Plays the transition twice, forwards and backwards
Alias for transition.then(transition.reverse())

Upgrade previous example

Let's slightly modify the example from the previous section

java
import dev.deitylamb.fern.common.Easings;

Transitionable<?> transition = Fern.transition(2000)
  .delay(100) 
  .ease(Easings::easeOutCubic) 
  .circular() 
  .loop(); 

Code result

Fade-in-out transition with easing and delay

Examples

You can find more complex examples in this section

Made with ❤️