elegant_spring_animation 1.0.0 copy "elegant_spring_animation: ^1.0.0" to clipboard
elegant_spring_animation: ^1.0.0 copied to clipboard

A package that provides an intuitive API for using spring animations.

Make your animations feel natural with spring animations.

This package lets you easily create spring physics-based animation curves, and use them wherever you want.

See live demo here.

Getting started #

Add elegant_spring_animation as a dependency in your pubspec.yaml file:

dependencies:
  elegant_spring_animation: ^1.0.0

Usage #

Basic usage #

Pass the duration of your animation in the constructor, and that's it.

Note: be sure to pass the correct duration, as internal calculations are based on the duration. (If you pass a different duration than the actual duration of the animation, the resulting curve won't be ideal)

  final Duration _duration = const Duration(milliseconds: 1000);
  late AnimationController _animationController;
  late Curve _elegantCurve;

  @override
  void initState() {
    super.initState();
    _animationController = AnimationController(vsync: this, duration: _duration);
    _elegantCurve = ElegantSpring(duration: _duration);
  }

Customizing the bounciness #

There is an optional bounce parameter, which has a default value of 0 (no bounce).

You can provide a value between -1 and 1. Higher the value, bouncier the animation. (Negative values may result in an unnatural motion).

_elegantCurve = ElegantSpring(duration: _duration, bounce: 0.25);
16
likes
0
pub points
44%
popularity

Publisher

unverified uploader

A package that provides an intuitive API for using spring animations.

Repository (GitHub)
View/report issues

Topics

#animation

License

unknown (license)

Dependencies

flutter

More

Packages that depend on elegant_spring_animation