Last updated:
0 purchases
elegant spring animation
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
copied to clipboard
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);
}
copied to clipboard
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);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.