DEV Community

Cover image for Android — Spring & Fling Animations with Jetpack compose
Raksha for Canopas Software

Posted on

5 1

Android — Spring & Fling Animations with Jetpack compose

How to create physics-based animation such as fling and spring animation in jetpack compose?

We will explore Compose animations API to create physics-based cool animations.

What we’re going to implement

  1. Spring release animation
  2. Fling animation
  3. Chain spring animations

But first, let’s get familiar with spring animation. Spring is physics-based animation, unlike other animations, it adds a more natural and smooth effect in motion.

In Jetpack compose, we have spring AnimationSpec to customize animations. SpringSpec takes three parameters.

  1. DampingRatio — define the bouncy of spring. The lower the damping ratio, the higher the bounciness. The default value is DampingRatioNoBouncy

  2. Stiffness — is something like animation duration, it defines the speed of spring to the final position. The default value is Spring.StiffnessMedium

  3. VisibilityThreshold — specifies the visibility threshold.

Check out the project on github for the complete working solution and example.

For full version of this post, visit canopas blog .

Sentry blog image

The Visual Studio App Center’s retiring

But sadly….you’re not. See how to make the switch to Sentry for all your crash reporting needs.

Read more

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay