Search packages, repositories and app categories

sprung cover
Package detailsv3.0.1

sprung

Spring curves for Flutter animations. Based on real physics equations with three damping curves.

AndroidiOSWebmacOSWindowsLinux
30-day downloads
48.1K
Likes
288
Pub points
160

Install package

flutter pub add sprung

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

Sprung is a Flutter package that provides physics-based spring curves for smooth, realistic animations. Inspired by real-world physics, it implements three damping curves to simulate natural motion. Ideal for interactive UI elements like buttons, sliders, and transitions, Sprung enhances user experience with lifelike responsiveness. The package integrates seamlessly into Flutter projects and supports all major platforms, including mobile, web, and desktop. It’s designed for developers seeking precise control over animation dynamics without complex manual calculations.

Use cases

  • Interactive button feedback
  • Smooth sliding panels
  • Animated UI transitions
  • Responsive form elements
  • Dynamic widget scaling
  • Natural scroll behaviors

Key features

  • Physics-based spring curves
  • Three damping curve options
  • Realistic motion simulation
  • Cross-platform support
  • Easy integration with TweenAnimationBuilder
  • Minimal configuration required

Suitable for

  • UI designers seeking realism
  • Developers building interactive apps
  • Animations requiring natural bounce
  • Projects targeting multiple platforms
  • Teams prioritizing performance and fluidity

Considerations

  • May require tuning for specific use cases
  • Best suited for subtle, responsive animations
  • Not ideal for highly complex or custom physics
  • Limited to spring-style interpolation
  • Performance impact in heavy animation chains

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

sprung

Sprung is an easy-to-consume Curve that uses real physics equations to drive your animations.

Easy to consume

Sprung has three opinionated curves, Sprung.underDamped, Sprung.criticallyDamped, and Sprung.overDamped. This is the best way to get started.

AnimatedContainer(
  curve: Sprung.underDamped,
  /// ...
),

When you want more fine control, use the default constructor which is critically damped, with overridable damping value.

AnimatedContainer(
  /// Critically damped by default with a value of `20`
  curve: Sprung(),
  /// ...
),
AnimatedContainer(
  /// Easily adjust damping value.
  curve: Sprung(19),
  /// ...
),

To build a fully custom spring simulation, use Sprung.custom. This allows you to define the spring's damping and stiffness, as well as the mass' mass and initial velocity.

AnimatedContainer(
  /// Build a custom spring
  curve: Sprung.custom(
    damping: 20,
    stiffness: 180,
    mass: 1.0,
    velocity: 0.0,
  ),
  /// ...
),

Based on Physics

Using Flutter's physics engine which leverages Newton's Second Law of Motion, Hooke's Law, and velocity based damping, we implement the following equation to create realistic spring animations.

m times x dot dot equals negative k times parenthesis x minus 1 close parenthesis minus c times x dot

Believable motion

demo of under, critically, and over damped Flutter curves

Reliable accuracy

Sprung exceeds Flutter specifications for curves by guaranteeing an error less than 1e-6. This amounts to a 0.0019px jitter at the beginning or end of a 1920px move.

Categories

Source repository

Projects using this package

Rankings