pub enum Curves {}Expand description
A collection of common animation curves.
See also:
§Why these are functions
Dart’s are static const fields, which the language canonicalizes: every
mention of Curves.easeIn is the same object, which is what makes
Flutter’s widget.curve != oldWidget.curve checks answer “unchanged”.
Rust has no const canonicalization, so each accessor hands out a clone of one
process-local Rc and Rc::ptr_eq reproduces that comparison.
Implementations§
Source§impl Curves
impl Curves
Sourcepub fn linear() -> Rc<dyn Curve>
pub fn linear() -> Rc<dyn Curve>
A linear animation curve.
This is the identity map over the unit interval: its
Curve::transform method returns its input unmodified. This is useful
as a default curve for cases where a Curve is required but no actual
curve is desired.
Sourcepub fn decelerate() -> Rc<dyn Curve>
pub fn decelerate() -> Rc<dyn Curve>
A curve where the rate of change starts out quickly and then
decelerates; an upside-down f(t) = t² parabola.
This is equivalent to the Android DecelerateInterpolator class with a
unit factor (the default factor).
Sourcepub fn fast_linear_to_slow_ease_in() -> Rc<dyn Curve>
pub fn fast_linear_to_slow_ease_in() -> Rc<dyn Curve>
A curve that is very steep and linear at the beginning, but quickly flattens out and very slowly eases in.
By default is the curve used to animate pages on iOS back to their original position if a swipe gesture is ended midway through a swipe.
Sourcepub fn fast_ease_in_to_slow_ease_out() -> Rc<dyn Curve>
pub fn fast_ease_in_to_slow_ease_out() -> Rc<dyn Curve>
A curve that starts slowly, speeds up very quickly, and then ends slowly.
This curve is used by default to animate page transitions used by
CupertinoPageRoute.
It has been derived from plots of native iOS 16.3 animation frames on iPhone 14 Pro Max. Specifically, transition animation positions were measured every frame and plotted against time. Then, a cubic curve was strictly fit to the measured data points.
Sourcepub fn ease() -> Rc<dyn Curve>
pub fn ease() -> Rc<dyn Curve>
A cubic animation curve that speeds up quickly and ends slowly.
This is the same as the CSS easing function ease.
Sourcepub fn ease_in() -> Rc<dyn Curve>
pub fn ease_in() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends quickly.
This is the same as the CSS easing function ease-in.
Sourcepub fn ease_in_to_linear() -> Rc<dyn Curve>
pub fn ease_in_to_linear() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends linearly.
The symmetric animation to Curves::linear_to_ease_out.
Sourcepub fn ease_in_sine() -> Rc<dyn Curve>
pub fn ease_in_sine() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends quickly. This is
similar to Curves::ease_in, but with sinusoidal easing for a slightly
less abrupt beginning and end. Nonetheless, the result is quite gentle
and is hard to distinguish from Curves::linear at a glance.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_quad() -> Rc<dyn Curve>
pub fn ease_in_quad() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends quickly. Based on a
quadratic equation where f(t) = t², this is effectively the inverse of
Curves::decelerate.
Compared to Curves::ease_in_sine, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_cubic() -> Rc<dyn Curve>
pub fn ease_in_cubic() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends quickly. This curve
is based on a cubic equation where f(t) = t³. The result is a safe
sweet spot when choosing a curve for widgets animating off the viewport.
Compared to Curves::ease_in_quad, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_quart() -> Rc<dyn Curve>
pub fn ease_in_quart() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends quickly. This curve
is based on a quartic equation where f(t) = t⁴.
Animations using this curve or steeper curves will benefit from a longer duration to avoid motion feeling unnatural.
Compared to Curves::ease_in_cubic, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_quint() -> Rc<dyn Curve>
pub fn ease_in_quint() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends quickly. This curve
is based on a quintic equation where f(t) = t⁵.
Compared to Curves::ease_in_quart, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_expo() -> Rc<dyn Curve>
pub fn ease_in_expo() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends quickly. This curve
is based on an exponential equation where f(t) = 2¹⁰⁽ᵗ⁻¹⁾.
Using this curve can give your animations extra flare, but a longer duration may need to be used to compensate for the steepness of the curve.
Compared to Curves::ease_in_quint, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_circ() -> Rc<dyn Curve>
pub fn ease_in_circ() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends quickly. This curve is effectively the bottom-right quarter of a circle.
Like Curves::ease_in_expo, this curve is fairly dramatic and will
reduce the clarity of an animation if not given a longer duration.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_back() -> Rc<dyn Curve>
pub fn ease_in_back() -> Rc<dyn Curve>
A cubic animation curve that starts slowly and ends quickly. This curve
is similar to Curves.elasticIn in that it overshoots its bounds before
reaching its end. Instead of repeated swinging motions before ascending,
though, this curve overshoots once, then continues to ascend.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_out() -> Rc<dyn Curve>
pub fn ease_out() -> Rc<dyn Curve>
A cubic animation curve that starts quickly and ends slowly.
This is the same as the CSS easing function ease-out.
Sourcepub fn linear_to_ease_out() -> Rc<dyn Curve>
pub fn linear_to_ease_out() -> Rc<dyn Curve>
A cubic animation curve that starts linearly and ends slowly.
A symmetric animation to Curves::ease_in_to_linear.
Sourcepub fn ease_out_sine() -> Rc<dyn Curve>
pub fn ease_out_sine() -> Rc<dyn Curve>
A cubic animation curve that starts quickly and ends slowly. This is
similar to Curves::ease_out, but with sinusoidal easing for a
slightly less abrupt beginning and end. Nonetheless, the result is quite
gentle and is hard to distinguish from Curves::linear at a glance.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_out_quad() -> Rc<dyn Curve>
pub fn ease_out_quad() -> Rc<dyn Curve>
A cubic animation curve that starts quickly and ends slowly. This is
effectively the same as Curves::decelerate, only simulated using a
cubic bezier function.
Compared to Curves::ease_out_sine, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_out_cubic() -> Rc<dyn Curve>
pub fn ease_out_cubic() -> Rc<dyn Curve>
A cubic animation curve that starts quickly and ends slowly. This curve
is a flipped version of Curves::ease_in_cubic.
The result is a safe sweet spot when choosing a curve for animating a widget’s position entering or already inside the viewport.
Compared to Curves::ease_out_quad, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_out_quart() -> Rc<dyn Curve>
pub fn ease_out_quart() -> Rc<dyn Curve>
A cubic animation curve that starts quickly and ends slowly. This curve
is a flipped version of Curves::ease_in_quart.
Animations using this curve or steeper curves will benefit from a longer duration to avoid motion feeling unnatural.
Compared to Curves::ease_out_cubic, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_out_quint() -> Rc<dyn Curve>
pub fn ease_out_quint() -> Rc<dyn Curve>
A cubic animation curve that starts quickly and ends slowly. This curve
is a flipped version of Curves::ease_in_quint.
Compared to Curves::ease_out_quart, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_out_expo() -> Rc<dyn Curve>
pub fn ease_out_expo() -> Rc<dyn Curve>
A cubic animation curve that starts quickly and ends slowly. This curve
is a flipped version of Curves::ease_in_expo. Using this curve can
give your animations extra flare, but a longer duration may need to be
used to compensate for the steepness of the curve.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_out_circ() -> Rc<dyn Curve>
pub fn ease_out_circ() -> Rc<dyn Curve>
A cubic animation curve that starts quickly and ends slowly. This curve is effectively the top-left quarter of a circle.
Like Curves::ease_out_expo, this curve is fairly dramatic and will
reduce the clarity of an animation if not given a longer duration.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_out_back() -> Rc<dyn Curve>
pub fn ease_out_back() -> Rc<dyn Curve>
A cubic animation curve that starts quickly and ends slowly. This curve
is similar to Curves.elasticOut in that it overshoots its bounds before
reaching its end. Instead of repeated swinging motions after ascending,
though, this curve only overshoots once.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_out() -> Rc<dyn Curve>
pub fn ease_in_out() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up, and then ends slowly.
This is the same as the CSS easing function ease-in-out.
Sourcepub fn ease_in_out_sine() -> Rc<dyn Curve>
pub fn ease_in_out_sine() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up, and then ends
slowly. This is similar to Curves::ease_in_out, but with sinusoidal
easing for a slightly less abrupt beginning and end.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_out_quad() -> Rc<dyn Curve>
pub fn ease_in_out_quad() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up, and then ends
slowly. This curve can be imagined as Curves::ease_in_quad as the
first half, and Curves::ease_out_quad as the second.
Compared to Curves::ease_in_out_sine, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_out_cubic() -> Rc<dyn Curve>
pub fn ease_in_out_cubic() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up, and then ends
slowly. This curve can be imagined as Curves::ease_in_cubic as the
first half, and Curves::ease_out_cubic as the second.
The result is a safe sweet spot when choosing a curve for a widget whose initial and final positions are both within the viewport.
Compared to Curves::ease_in_out_quad, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_out_cubic_emphasized() -> Rc<dyn Curve>
pub fn ease_in_out_cubic_emphasized() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up shortly
thereafter, and then ends slowly. This curve can be imagined as a steeper
version of Curves::ease_in_out_cubic.
The result is a more emphasized eased curve when choosing a curve for a widget whose initial and final positions are both within the viewport.
Compared to Curves::ease_in_out_cubic, this curve is slightly
steeper.
Sourcepub fn ease_in_out_quart() -> Rc<dyn Curve>
pub fn ease_in_out_quart() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up, and then ends
slowly. This curve can be imagined as Curves::ease_in_quart as the
first half, and Curves::ease_out_quart as the second.
Animations using this curve or steeper curves will benefit from a longer duration to avoid motion feeling unnatural.
Compared to Curves::ease_in_out_cubic, this curve is slightly
steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_out_quint() -> Rc<dyn Curve>
pub fn ease_in_out_quint() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up, and then ends
slowly. This curve can be imagined as Curves::ease_in_quint as the
first half, and Curves::ease_out_quint as the second.
Compared to Curves::ease_in_out_quart, this curve is slightly
steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_out_expo() -> Rc<dyn Curve>
pub fn ease_in_out_expo() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up, and then ends slowly.
Since this curve is arrived at with an exponential function, the midpoint is exceptionally steep. Extra consideration should be taken when designing an animation using this.
Compared to Curves::ease_in_out_quint, this curve is slightly
steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_out_circ() -> Rc<dyn Curve>
pub fn ease_in_out_circ() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up, and then ends
slowly. This curve can be imagined as Curves::ease_in_circ as the
first half, and Curves::ease_out_circ as the second.
Like Curves::ease_in_out_expo, this curve is fairly dramatic and will
reduce the clarity of an animation if not given a longer duration.
Compared to Curves::ease_in_out_expo, this curve is slightly steeper.
Derived from Robert Penner’s easing functions.
Sourcepub fn ease_in_out_back() -> Rc<dyn Curve>
pub fn ease_in_out_back() -> Rc<dyn Curve>
A cubic animation curve that starts slowly, speeds up, and then ends
slowly. This curve can be imagined as Curves::ease_in_back as the
first half, and Curves::ease_out_back as the second.
Since two curves are used as a basis for this curve, the resulting animation will overshoot its bounds twice before reaching its end - first by exceeding its lower bound, then exceeding its upper bound and finally descending to its final position.
Derived from Robert Penner’s easing functions.
Sourcepub fn fast_out_slow_in() -> Rc<dyn Curve>
pub fn fast_out_slow_in() -> Rc<dyn Curve>
A curve that starts quickly and eases into its final position.
Over the course of the animation, the object spends more time near its final destination. As a result, the user isn’t left waiting for the animation to finish, and the negative effects of motion are minimized.
See also:
Easing.legacy, the name for this curve in the Material specification.
Sourcepub fn slow_middle() -> Rc<dyn Curve>
pub fn slow_middle() -> Rc<dyn Curve>
A cubic animation curve that starts quickly, slows down, and then ends quickly.
Sourcepub fn bounce_out() -> Rc<dyn Curve>
pub fn bounce_out() -> Rc<dyn Curve>
An oscillating curve that first grows and then shrink in magnitude.
Sourcepub fn bounce_in_out() -> Rc<dyn Curve>
pub fn bounce_in_out() -> Rc<dyn Curve>
An oscillating curve that first grows and then shrink in magnitude.
Sourcepub fn elastic_in() -> Rc<dyn Curve>
pub fn elastic_in() -> Rc<dyn Curve>
An oscillating curve that grows in magnitude while overshooting its bounds.
Sourcepub fn elastic_out() -> Rc<dyn Curve>
pub fn elastic_out() -> Rc<dyn Curve>
An oscillating curve that shrinks in magnitude while overshooting its bounds.
Sourcepub fn elastic_in_out() -> Rc<dyn Curve>
pub fn elastic_in_out() -> Rc<dyn Curve>
An oscillating curve that grows and then shrinks in magnitude while overshooting its bounds.