DEV Community

Nicholas Eddy
Nicholas Eddy

Posted on

Better Animations... in Latest Doodle

Animations in Doodle 0.10.2 can be chained within an animation block using the then method. This makes it easier to have sequential animations and avoids the need to explicitly track secondary animations for cancellation, since these are tied to their "parent" animation.

val animation = animate {
    0f to 1f using (tweenFloat(easing, duration)) {                   // (1)
        // ...
    } then {
        0f to 1f using (after(delay, tweenFloat(easing, duration))) { // (2)

        } then {                                                      // (3)
            // ...
        }
    } then {                                                          // (4)
        // ...
    }
}

animation.completed += { /* ... */ }  // applies to entire chain
animation.pause ()                    // applies to entire chain
animation.cancel()                    // applies to entire chain
Enter fullscreen mode Exit fullscreen mode

This release also includes lots of other great features including:

  • Desktop Accessibility Support - Accessibility features now work on Desktop
  • SpinButtons now support basic Accessibility
  • Improved Sliders - Sliders can now represent values of any Comparable type T between two start and end values.
  • Non-linear Sliders

Check out the docs for more details.

Doodle helps you create beautiful, modern apps entirely in Kotlin. Its render model is intuitive yet powerful, making it easy to achieve complex UIs with pixel level precision and layouts. This simplicity and power applies to everything from user input to drag and drop. Doodle lets you build and animate anything.

Top comments (0)