Documentation
¶
Overview ¶
Package animation provides AnimationController, Tween, Curves and the other animation primitives.
An Animation[T] is a value that changes over time, with a status (dismissed, forward, reverse, completed) and listeners. An AnimationController runs one from 0 to 1 (or between other bounds) on a ticker from a scheduler.TickerProvider. A Tween, a CurveTween or a TweenSequence maps the 0 to 1 value to another type, and a Curve shapes the progress. CurvedAnimation, ReverseAnimation, ProxyAnimation, TrainHoppingAnimation and the compound animations (AnimationMean, AnimationMax, AnimationMin) build one animation from others.
Listeners are handles: AddListener returns a foundation.ListenerHandle (and AddStatusListener a StatusListenerHandle) that RemoveListener takes, because Go functions can't be compared. A panic in a listener is reported to the error reporter of the controller (see Environment) and the other listeners still run.
The painting tweens (EdgeInsets, Decoration, TextStyle and so on) are in package widgets, with the implicit animations.
Flutter: package:flutter/animation.dart.
Index ¶
- Variables
- func CatmullRomCurveValidateControlPoints(controlPoints []ui.Offset, tension float64, reasons *[]string) bool
- func Curve2DFindInverse(c Curve2D, x float64) float64
- func CurveEqual(a, b Curve) bool
- func DescribeAnimation[T any](a Animation[T]) string
- func InitAnimatableBase[T any](b *AnimatableBase[T], self Animatable[T])
- func IsAnimating[T any](a Animation[T]) bool
- func IsCompleted[T any](a Animation[T]) bool
- func IsDismissed[T any](a Animation[T]) bool
- func IsForwardOrCompleted[T any](a Animation[T]) bool
- type Animatable
- type AnimatableBase
- type AnimatableCallback
- type AnimateOpts
- type Animation
- type AnimationBehavior
- type AnimationController
- func (c *AnimationController) AnimateBack(target float64, opts ...AnimateOpts) *scheduler.TickerFuture
- func (c *AnimationController) AnimateBackWith(simulation physics.Simulation) *scheduler.TickerFuture
- func (c *AnimationController) AnimateTo(target float64, opts ...AnimateOpts) *scheduler.TickerFuture
- func (c *AnimationController) AnimateWith(simulation physics.Simulation) *scheduler.TickerFuture
- func (c *AnimationController) Dispose()
- func (c *AnimationController) Fling(opts ...FlingOpts) *scheduler.TickerFuture
- func (c *AnimationController) Forward(from ...float64) *scheduler.TickerFuture
- func (c *AnimationController) IsAnimating() bool
- func (c *AnimationController) IsDisposed() bool
- func (c *AnimationController) LastElapsedDuration() foundation.Opt[time.Duration]
- func (c *AnimationController) Repeat(opts ...RepeatOpts) *scheduler.TickerFuture
- func (c *AnimationController) Reset()
- func (c *AnimationController) Resync(vsync scheduler.TickerProvider)
- func (c *AnimationController) Reverse(from ...float64) *scheduler.TickerFuture
- func (c *AnimationController) SetValue(newValue float64)
- func (c *AnimationController) Status() AnimationStatus
- func (c *AnimationController) Stop(opts ...StopOpts)
- func (c *AnimationController) String() string
- func (c *AnimationController) Toggle(from ...float64) *scheduler.TickerFuture
- func (c *AnimationController) Value() float64
- func (c *AnimationController) Velocity() float64
- func (c *AnimationController) View() Animation[float64]
- type AnimationControllerOpts
- type AnimationStatus
- type AnimationStatusListener
- type AnimationStyle
- type AnimationWithParent
- func (a AnimationWithParent[P]) AddListener(listener foundation.VoidCallback) foundation.ListenerHandle
- func (a AnimationWithParent[P]) AddStatusListener(listener AnimationStatusListener) StatusListenerHandle
- func (a AnimationWithParent[P]) RemoveListener(handle foundation.ListenerHandle)
- func (a AnimationWithParent[P]) RemoveStatusListener(handle StatusListenerHandle)
- func (a AnimationWithParent[P]) Status() AnimationStatus
- type CatmullRomCurve
- type CatmullRomSpline
- type CatmullRomSplineOpts
- type CompoundAnimation
- func NewAnimationMax[T int | float64](first, next Animation[T]) *CompoundAnimation[T]
- func NewAnimationMean(left, right Animation[float64]) *CompoundAnimation[float64]
- func NewAnimationMin[T int | float64](first, next Animation[T]) *CompoundAnimation[T]
- func NewCompoundAnimation[T comparable](name string, first, next Animation[T], combine func(first, next T) T) *CompoundAnimation[T]
- type Cubic
- type Curve
- type Curve2D
- type Curve2DGenerateSamplesOpts
- type Curve2DSample
- type CurveFunc
- type CurveTween
- type CurvedAnimation
- type CurvesCollection
- type ElasticInCurve
- type ElasticInOutCurve
- type ElasticOutCurve
- type Environment
- type FlingOpts
- type FlippedCurve
- type FlippedTweenSequence
- type Interval
- type LazyListeners
- type Lerper
- type LocalListeners
- func (l *LocalListeners) AddListener(listener foundation.VoidCallback) foundation.ListenerHandle
- func (l *LocalListeners) ClearListeners()
- func (l *LocalListeners) NotifyListeners()
- func (l *LocalListeners) RemoveListener(handle foundation.ListenerHandle)
- func (l *LocalListeners) SetErrorReporter(r foundation.ErrorReporter)
- type LocalStatusListeners
- func (l *LocalStatusListeners) AddStatusListener(listener AnimationStatusListener) StatusListenerHandle
- func (l *LocalStatusListeners) ClearStatusListeners()
- func (l *LocalStatusListeners) NotifyStatusListeners(status AnimationStatus)
- func (l *LocalStatusListeners) RemoveStatusListener(handle StatusListenerHandle)
- func (l *LocalStatusListeners) SetErrorReporter(r foundation.ErrorReporter)
- type ParametricCurve
- type ProxyAnimation
- type RepeatOpts
- type ReverseAnimation
- func (r *ReverseAnimation) AddListener(listener foundation.VoidCallback) foundation.ListenerHandle
- func (r *ReverseAnimation) Parent() Animation[float64]
- func (r *ReverseAnimation) RemoveListener(handle foundation.ListenerHandle)
- func (r *ReverseAnimation) Status() AnimationStatus
- func (r *ReverseAnimation) String() string
- func (r *ReverseAnimation) Value() float64
- type SawTooth
- type Split
- type SplitOpts
- type StatusListenerHandle
- type StopOpts
- type ThreePointCubic
- type Threshold
- type TrainHoppingAnimation
- type Tween
- func NewColorTween(begin, end foundation.Opt[ui.Color]) *Tween[foundation.Opt[ui.Color]]
- func NewConstantTween[T any](value T) *Tween[T]
- func NewIntTween(begin, end int) *Tween[int]
- func NewRectTween(begin, end foundation.Opt[ui.Rect]) *Tween[foundation.Opt[ui.Rect]]
- func NewReverseTween[T any](parent *Tween[T]) *Tween[T]
- func NewSizeTween(begin, end foundation.Opt[ui.Size]) *Tween[foundation.Opt[ui.Size]]
- func NewStepTween(begin, end int) *Tween[int]
- func NewTween[T any](begin, end T) *Tween[T]
- func NewTweenEnd[T any](end T) *Tween[T]
- func NewTweenFunc[T any](begin, end T, lerp TweenLerp[T]) *Tween[T]
- func NewTweenFuncEnd[T any](end T, lerp TweenLerp[T]) *Tween[T]
- func (t *Tween[T]) FillBegin()
- func (t *Tween[T]) HasBegin() bool
- func (t *Tween[T]) Lerp(at float64) T
- func (t *Tween[T]) SetName(name string) *Tween[T]
- func (t *Tween[T]) SetNullable(isNone func(T) bool) *Tween[T]
- func (t *Tween[T]) String() string
- func (t *Tween[T]) Transform(at float64) T
- func (t *Tween[T]) WithoutBegin() *Tween[T]
- type TweenLerp
- type TweenSequence
- type TweenSequenceItem
Constants ¶
This section is empty.
Variables ¶
var AnimationStyleNoAnimation = AnimationStyle{ Duration: foundation.Some(time.Duration(0)), ReverseDuration: foundation.Some(time.Duration(0)), }
AnimationStyleNoAnimation is an AnimationStyle with the durations set to zero, which disables an animation.
Flutter: animation/animation_style.dart AnimationStyle.noAnimation
var Curves = CurvesCollection{ Linear: linearCurve{}, Decelerate: decelerateCurve{}, FastLinearToSlowEaseIn: Cubic{0.18, 1.0, 0.04, 1.0}, FastEaseInToSlowEaseOut: ThreePointCubic{ui.Offset{Dx: 0.056, Dy: 0.024}, ui.Offset{Dx: 0.108, Dy: 0.3085}, ui.Offset{Dx: 0.198, Dy: 0.541}, ui.Offset{Dx: 0.3655, Dy: 1.0}, ui.Offset{Dx: 0.5465, Dy: 0.989}}, Ease: Cubic{0.25, 0.1, 0.25, 1.0}, EaseIn: Cubic{0.42, 0.0, 1.0, 1.0}, EaseInToLinear: Cubic{0.67, 0.03, 0.65, 0.09}, EaseInSine: Cubic{0.47, 0.0, 0.745, 0.715}, EaseInQuad: Cubic{0.55, 0.085, 0.68, 0.53}, EaseInCubic: Cubic{0.55, 0.055, 0.675, 0.19}, EaseInQuart: Cubic{0.895, 0.03, 0.685, 0.22}, EaseInQuint: Cubic{0.755, 0.05, 0.855, 0.06}, EaseInExpo: Cubic{0.95, 0.05, 0.795, 0.035}, EaseInCirc: Cubic{0.6, 0.04, 0.98, 0.335}, EaseInBack: Cubic{0.6, -0.28, 0.735, 0.045}, EaseOut: Cubic{0.0, 0.0, 0.58, 1.0}, LinearToEaseOut: Cubic{0.35, 0.91, 0.33, 0.97}, EaseOutSine: Cubic{0.39, 0.575, 0.565, 1.0}, EaseOutQuad: Cubic{0.25, 0.46, 0.45, 0.94}, EaseOutCubic: Cubic{0.215, 0.61, 0.355, 1.0}, EaseOutQuart: Cubic{0.165, 0.84, 0.44, 1.0}, EaseOutQuint: Cubic{0.23, 1.0, 0.32, 1.0}, EaseOutExpo: Cubic{0.19, 1.0, 0.22, 1.0}, EaseOutCirc: Cubic{0.075, 0.82, 0.165, 1.0}, EaseOutBack: Cubic{0.175, 0.885, 0.32, 1.275}, EaseInOut: Cubic{0.42, 0.0, 0.58, 1.0}, EaseInOutSine: Cubic{0.445, 0.05, 0.55, 0.95}, EaseInOutQuad: Cubic{0.455, 0.03, 0.515, 0.955}, EaseInOutCubic: Cubic{0.645, 0.045, 0.355, 1.0}, EaseInOutCubicEmphasized: ThreePointCubic{ui.Offset{Dx: 0.05, Dy: 0}, ui.Offset{Dx: 0.133333, Dy: 0.06}, ui.Offset{Dx: 0.166666, Dy: 0.4}, ui.Offset{Dx: 0.208333, Dy: 0.82}, ui.Offset{Dx: 0.25, Dy: 1}}, EaseInOutQuart: Cubic{0.77, 0.0, 0.175, 1.0}, EaseInOutQuint: Cubic{0.86, 0.0, 0.07, 1.0}, EaseInOutExpo: Cubic{1.0, 0.0, 0.0, 1.0}, EaseInOutCirc: Cubic{0.785, 0.135, 0.15, 0.86}, EaseInOutBack: Cubic{0.68, -0.55, 0.265, 1.55}, FastOutSlowIn: Cubic{0.4, 0.0, 0.2, 1.0}, SlowMiddle: Cubic{0.15, 0.85, 0.85, 0.15}, BounceIn: bounceInCurve{}, BounceOut: bounceOutCurve{}, BounceInOut: bounceInOutCurve{}, ElasticIn: ElasticInCurve{0.4}, ElasticOut: ElasticOutCurve{0.4}, ElasticInOut: ElasticInOutCurve{0.4}, }
Curves is the collection of the standard curves.
Flutter: animation/curves.dart Curves
Functions ¶
func CatmullRomCurveValidateControlPoints ¶
func CatmullRomCurveValidateControlPoints(controlPoints []ui.Offset, tension float64, reasons *[]string) bool
CatmullRomCurveValidateControlPoints reports whether the control points make a valid curve: at least two, with x strictly between 0 and 1 and increasing, and a curve with a single y for each x. When reasons is not nil, it gets a text for each problem found.
Flutter: animation/curves.dart CatmullRomCurve.validateControlPoints
func Curve2DFindInverse ¶
Curve2DFindInverse finds the parameter t where the curve's x is the given x, by bisection.
Flutter: animation/curves.dart Curve2D.findInverse
func CurveEqual ¶
CurveEqual reports whether two curves are the same value: equal curves of the same type (a Cubic with the same numbers), or the same pointer. A CurveFunc can't be compared, so it is never equal to anything but a nil curve.
Flutter: no counterpart (the == operator of Curve)
func DescribeAnimation ¶
DescribeAnimation is the text that Flutter's Animation.toString gives for the animation: its identity and a symbol for its status.
Flutter: animation/animation.dart Animation.toString
func InitAnimatableBase ¶
func InitAnimatableBase[T any](b *AnimatableBase[T], self Animatable[T])
InitAnimatableBase sets the outer type of an embedded AnimatableBase.
Flutter: no counterpart (the self pattern, SPEC §12.5)
func IsAnimating ¶
IsAnimating reports whether the animation is running, forward or reverse.
Flutter: animation/animation.dart Animation.isAnimating
func IsCompleted ¶
IsCompleted reports whether the animation is stopped at the end.
Flutter: animation/animation.dart Animation.isCompleted
func IsDismissed ¶
IsDismissed reports whether the animation is stopped at the beginning.
Flutter: animation/animation.dart Animation.isDismissed
func IsForwardOrCompleted ¶
IsForwardOrCompleted reports whether the animation is running forward or is at the end.
Flutter: animation/animation.dart Animation.isForwardOrCompleted
Types ¶
type Animatable ¶
type Animatable[T any] interface { // Transform returns the value of the animatable at t. // // Flutter: animation/tween.dart Animatable.transform Transform(t float64) T // Evaluate returns the value of the animatable at the value of the animation. // // Flutter: animation/tween.dart Animatable.evaluate Evaluate(animation Animation[float64]) T // Animate returns an animation of T that follows the parent. // // Flutter: animation/tween.dart Animatable.animate Animate(parent Animation[float64]) Animation[T] // Chain returns an animatable that passes t through the parent first. // // Flutter: animation/tween.dart Animatable.chain Chain(parent Animatable[float64]) Animatable[T] }
Animatable is an object that maps a double t, usually from 0.0 to 1.0, to a value of type T. Tween, CurveTween and TweenSequence are Animatables; embed AnimatableBase (see InitAnimatableBase) to get the other methods in a type of your own that implements Transform.
Flutter: animation/tween.dart Animatable
func NewAnimatableFromCallback ¶
func NewAnimatableFromCallback[T any](callback AnimatableCallback[T]) Animatable[T]
NewAnimatableFromCallback creates an animatable that calls the function.
Flutter: animation/tween.dart Animatable.fromCallback
type AnimatableBase ¶
type AnimatableBase[T any] struct { // contains filtered or unexported fields }
AnimatableBase has Evaluate, Animate and Chain for a type that implements Transform. Embed it and call InitAnimatableBase with the outer type.
Flutter: animation/tween.dart Animatable
func (*AnimatableBase[T]) Animate ¶
func (b *AnimatableBase[T]) Animate(parent Animation[float64]) Animation[T]
Animate returns an animation of T that follows the parent.
Flutter: animation/tween.dart Animatable.animate
func (*AnimatableBase[T]) Chain ¶
func (b *AnimatableBase[T]) Chain(parent Animatable[float64]) Animatable[T]
Chain returns an animatable that passes t through the parent first.
Flutter: animation/tween.dart Animatable.chain
func (*AnimatableBase[T]) Evaluate ¶
func (b *AnimatableBase[T]) Evaluate(animation Animation[float64]) T
Evaluate returns the value of the animatable at the value of the animation.
Flutter: animation/tween.dart Animatable.evaluate
type AnimatableCallback ¶
AnimatableCallback computes a value from the animation's t.
Flutter: animation/tween.dart AnimatableCallback
type AnimateOpts ¶
type AnimateOpts struct {
// Duration is the length of the animation; the default is the controller's
// Duration (ReverseDuration for AnimateBack when it is set), scaled by the
// distance left.
Duration foundation.Opt[time.Duration]
// Curve is the curve of the animation; the default is Curves.Linear.
Curve Curve
}
AnimateOpts are the optional parameters of AnimateTo and AnimateBack.
Flutter: animation/animation_controller.dart AnimationController.animateTo
type Animation ¶
type Animation[T any] interface { foundation.ValueListenable[T] // AddStatusListener calls the listener every time the status of the // animation changes. // // Flutter: animation/animation.dart Animation.addStatusListener AddStatusListener(listener AnimationStatusListener) StatusListenerHandle // RemoveStatusListener stops calling the listener. // // Flutter: animation/animation.dart Animation.removeStatusListener RemoveStatusListener(handle StatusListenerHandle) // Status is the current status of the animation. // // Flutter: animation/animation.dart Animation.status Status() AnimationStatus }
Animation is a value of type T that changes over time, with a status. The listeners are called when the value changes; the status listeners when the status changes. An Animation[float64] is a foundation.ValueListenable[float64], so it can drive a widget that takes one.
Flutter: animation/animation.dart Animation
var AlwaysComplete Animation[float64] = &constAnimation[float64]{1, AnimationStatusCompleted, "kAlwaysCompleteAnimation"}
AlwaysComplete is an animation that is always complete (value 1, status completed). Using it involves less overhead than an AnimationController with an initial value of 1. It is for APIs that expect an animation when nothing should animate.
Flutter: animation/animations.dart kAlwaysCompleteAnimation
var AlwaysDismissed Animation[float64] = &constAnimation[float64]{0, AnimationStatusDismissed, "kAlwaysDismissedAnimation"}
AlwaysDismissed is an animation that is always dismissed (value 0, status dismissed).
Flutter: animation/animations.dart kAlwaysDismissedAnimation
func Drive ¶
func Drive[U any](parent Animation[float64], child Animatable[U]) Animation[U]
Drive chains an Animatable to the animation: the result is an animation of U that follows the parent.
Flutter: animation/animation.dart Animation.drive
func NewAlwaysStoppedAnimation ¶
NewAlwaysStoppedAnimation creates an animation that is always stopped at the value; its status is always AnimationStatusForward. Its value and status can never change, so its listeners are never called and it is safe to reuse it in many places.
Flutter: animation/animations.dart AlwaysStoppedAnimation.new
func NewAnimationFromValueListenable ¶
func NewAnimationFromValueListenable[T any](listenable foundation.ValueListenable[T], transformer func(T) T) Animation[T]
NewAnimationFromValueListenable creates an animation that has the value of the listenable, passed through the transformer if there is one (nil for none). It has no status of its own: it is always AnimationStatusForward.
Flutter: animation/animation.dart Animation.fromValueListenable
type AnimationBehavior ¶
type AnimationBehavior int
AnimationBehavior is how an AnimationController behaves when animations are disabled in the system (the accessibility setting).
Flutter: animation/animation_controller.dart AnimationBehavior
const ( // AnimationBehaviorUnspecified is the zero value: the controller's default, // which is AnimationBehaviorNormal (AnimationBehaviorPreserve for an // unbounded controller). AnimationBehaviorUnspecified AnimationBehavior = iota // AnimationBehaviorNormal makes the animations run much faster (a twentieth // of the duration) when the system disables animations. // // Flutter: animation/animation_controller.dart AnimationBehavior.normal AnimationBehaviorNormal // AnimationBehaviorPreserve keeps the animation running at the same speed // even if the system disables animations. // // Flutter: animation/animation_controller.dart AnimationBehavior.preserve AnimationBehaviorPreserve )
func (AnimationBehavior) String ¶
func (b AnimationBehavior) String() string
String is the name of the behavior.
Flutter: animation/animation_controller.dart AnimationBehavior
type AnimationController ¶
type AnimationController struct {
LocalListeners
LocalStatusListeners
// LowerBound is the value at which the animation is dismissed.
//
// Flutter: animation/animation_controller.dart AnimationController.lowerBound
LowerBound float64
// UpperBound is the value at which the animation is completed.
//
// Flutter: animation/animation_controller.dart AnimationController.upperBound
UpperBound float64
// DebugLabel names the controller in debug output.
//
// Flutter: animation/animation_controller.dart AnimationController.debugLabel
DebugLabel string
// AnimationBehavior is how the controller reacts to the system disabling
// animations.
//
// Flutter: animation/animation_controller.dart AnimationController.animationBehavior
AnimationBehavior AnimationBehavior
// Duration is the length of the animation in the forward direction.
//
// Flutter: animation/animation_controller.dart AnimationController.duration
Duration foundation.Opt[time.Duration]
// ReverseDuration is the length of the animation in the reverse direction.
//
// Flutter: animation/animation_controller.dart AnimationController.reverseDuration
ReverseDuration foundation.Opt[time.Duration]
// contains filtered or unexported fields
}
AnimationController is an animation that is controlled: it plays forward or backward, can be stopped, set to a value, or run with a simulation. By default it goes linearly from 0 to 1 in its duration, once per frame while the app runs. It calls its listeners when the value changes and its status listeners when the status changes.
The controller asks its vsync (a TickerProvider) for a ticker, so that it runs only while its widget is shown. Call Dispose when you are done with it.
Flutter: animation/animation_controller.dart AnimationController
func NewAnimationController ¶
func NewAnimationController(vsync scheduler.TickerProvider, opts ...AnimationControllerOpts) *AnimationController
NewAnimationController creates a controller with the bounds 0 and 1 (see the options). The vsync gives it its ticker; a widget State embeds a ticker provider for it. In debug builds it panics with the tag AnimationControllerBoundsInvalid when the upper bound is below the lower one.
Flutter: animation/animation_controller.dart AnimationController.new
func NewAnimationControllerUnbounded ¶
func NewAnimationControllerUnbounded(vsync scheduler.TickerProvider, opts ...AnimationControllerOpts) *AnimationController
NewAnimationControllerUnbounded creates a controller that is not bounded: its value can be any number, with the bounds at minus and plus infinity. The default AnimationBehavior is AnimationBehaviorPreserve, and the initial value is 0.
Flutter: animation/animation_controller.dart AnimationController.unbounded
func (*AnimationController) AnimateBack ¶
func (c *AnimationController) AnimateBack(target float64, opts ...AnimateOpts) *scheduler.TickerFuture
AnimateBack drives the animation from its current value to the target, in the reverse direction.
Flutter: animation/animation_controller.dart AnimationController.animateBack
func (*AnimationController) AnimateBackWith ¶
func (c *AnimationController) AnimateBackWith(simulation physics.Simulation) *scheduler.TickerFuture
AnimateBackWith drives the animation with a simulation, in the reverse direction.
Flutter: animation/animation_controller.dart AnimationController.animateBackWith
func (*AnimationController) AnimateTo ¶
func (c *AnimationController) AnimateTo(target float64, opts ...AnimateOpts) *scheduler.TickerFuture
AnimateTo drives the animation from its current value to the target, in the forward direction.
Flutter: animation/animation_controller.dart AnimationController.animateTo
func (*AnimationController) AnimateWith ¶
func (c *AnimationController) AnimateWith(simulation physics.Simulation) *scheduler.TickerFuture
AnimateWith drives the animation with a simulation, in the forward direction. The value is clamped to the bounds. The animation is done when the simulation is.
Flutter: animation/animation_controller.dart AnimationController.animateWith
func (*AnimationController) Dispose ¶
func (c *AnimationController) Dispose()
Dispose releases the resources of the controller: its ticker and listeners. It must be called once, and the controller can't be used afterwards. In debug builds a second call panics with the tag AnimationControllerDisposedTwice.
Flutter: animation/animation_controller.dart AnimationController.dispose
func (*AnimationController) Fling ¶
func (c *AnimationController) Fling(opts ...FlingOpts) *scheduler.TickerFuture
Fling drives the animation with a spring (the default is critically damped) towards the upper bound, or the lower bound if the velocity is negative. In debug builds it panics with the tag AnimationControllerFlingUnderdamped when the spring is underdamped.
Flutter: animation/animation_controller.dart AnimationController.fling
func (*AnimationController) Forward ¶
func (c *AnimationController) Forward(from ...float64) *scheduler.TickerFuture
Forward starts running the animation forward, towards UpperBound, from the current value or from the value given. The returned future completes when the animation ends, and is canceled if it is stopped. In debug builds it panics with the tag AnimationControllerNoDuration when there is no Duration, and AnimationControllerDisposed after Dispose.
Flutter: animation/animation_controller.dart AnimationController.forward
func (*AnimationController) IsAnimating ¶
func (c *AnimationController) IsAnimating() bool
IsAnimating is whether the animation is running (its ticker is active), even when the ticker is muted.
Flutter: animation/animation_controller.dart AnimationController.isAnimating
func (*AnimationController) IsDisposed ¶
func (c *AnimationController) IsDisposed() bool
IsDisposed is whether Dispose was called.
Flutter: no counterpart (Flutter reads the ticker, which is null after dispose)
func (*AnimationController) LastElapsedDuration ¶
func (c *AnimationController) LastElapsedDuration() foundation.Opt[time.Duration]
LastElapsedDuration is the amount of time the ticker has been running for the current animation, as of the last frame; none if the animation is not running.
Flutter: animation/animation_controller.dart AnimationController.lastElapsedDuration
func (*AnimationController) Repeat ¶
func (c *AnimationController) Repeat(opts ...RepeatOpts) *scheduler.TickerFuture
Repeat starts running the animation in a loop, between Min and Max. The returned future never completes while the animation repeats (when Count is set it completes after that many repetitions). In debug builds it panics with the tag AnimationControllerRepeatInvalid when the range or the count is not valid, and AnimationControllerNoDuration without a period or Duration.
Flutter: animation/animation_controller.dart AnimationController.repeat
func (*AnimationController) Reset ¶
func (c *AnimationController) Reset()
Reset sets the value to the lower bound, which stops the animation and makes its status dismissed.
Flutter: animation/animation_controller.dart AnimationController.reset
func (*AnimationController) Resync ¶
func (c *AnimationController) Resync(vsync scheduler.TickerProvider)
Resync replaces the ticker with one from the new vsync, carrying over the running animation (see Ticker.AbsorbTicker).
Flutter: animation/animation_controller.dart AnimationController.resync
func (*AnimationController) Reverse ¶
func (c *AnimationController) Reverse(from ...float64) *scheduler.TickerFuture
Reverse starts running the animation in reverse, towards LowerBound, from the current value or from the value given. In debug builds it panics with the tag AnimationControllerNoDuration when there is neither Duration nor ReverseDuration.
Flutter: animation/animation_controller.dart AnimationController.reverse
func (*AnimationController) SetValue ¶
func (c *AnimationController) SetValue(newValue float64)
SetValue stops the animation and sets its value (clamped to the bounds). The listeners are called, and the status listeners if the status changed.
Flutter: animation/animation_controller.dart AnimationController.value=
func (*AnimationController) Status ¶
func (c *AnimationController) Status() AnimationStatus
Status is the current status of the animation.
Flutter: animation/animation_controller.dart AnimationController.status
func (*AnimationController) Stop ¶
func (c *AnimationController) Stop(opts ...StopOpts)
Stop stops running the animation. It does not change the value; the future that the animation returned is canceled (or completed, with Canceled false).
Flutter: animation/animation_controller.dart AnimationController.stop
func (*AnimationController) String ¶
func (c *AnimationController) String() string
String describes the controller.
Flutter: animation/animation_controller.dart AnimationController.toStringDetails
func (*AnimationController) Toggle ¶
func (c *AnimationController) Toggle(from ...float64) *scheduler.TickerFuture
Toggle runs the animation in reverse if it is going forward or completed, and forward otherwise.
Flutter: animation/animation_controller.dart AnimationController.toggle
func (*AnimationController) Value ¶
func (c *AnimationController) Value() float64
Value is the current value of the animation, from LowerBound to UpperBound.
Flutter: animation/animation_controller.dart AnimationController.value
func (*AnimationController) Velocity ¶
func (c *AnimationController) Velocity() float64
Velocity is the rate of change of the value, per second; 0 when the animation is not running.
Flutter: animation/animation_controller.dart AnimationController.velocity
func (*AnimationController) View ¶
func (c *AnimationController) View() Animation[float64]
View is the controller as a plain animation: it hides the methods that control it.
Flutter: animation/animation_controller.dart AnimationController.view
type AnimationControllerOpts ¶
type AnimationControllerOpts struct {
// Value is the initial value; the default is LowerBound (0 for unbounded).
Value foundation.Opt[float64]
// Duration is the length of the animation in the forward direction.
Duration foundation.Opt[time.Duration]
// ReverseDuration is the length of the animation in the reverse direction;
// without it, Duration is used.
ReverseDuration foundation.Opt[time.Duration]
// DebugLabel names the controller in debug output.
DebugLabel string
// LowerBound is the value at which the animation is dismissed; the default
// is 0. Not used by NewAnimationControllerUnbounded.
LowerBound float64
// UpperBound is the value at which the animation is completed; the default
// is 1. Not used by NewAnimationControllerUnbounded.
UpperBound foundation.Opt[float64]
// AnimationBehavior is how the controller reacts to the system disabling
// animations; the default is AnimationBehaviorNormal, and
// AnimationBehaviorPreserve for an unbounded controller.
AnimationBehavior AnimationBehavior
// ErrorReporter receives the errors of the listeners; the default is the
// vsync's Environment.ErrorReporter, if it has one.
ErrorReporter foundation.ErrorReporter
}
AnimationControllerOpts are the optional parameters of NewAnimationController and NewAnimationControllerUnbounded.
Flutter: animation/animation_controller.dart AnimationController.new
type AnimationStatus ¶
type AnimationStatus int
AnimationStatus is the status of an animation.
Flutter: animation/animation.dart AnimationStatus
const ( // AnimationStatusUnspecified is the zero value; it is not a real status. // // Flutter: no counterpart AnimationStatusUnspecified AnimationStatus = iota // AnimationStatusDismissed means the animation is stopped at the beginning. // // Flutter: animation/animation.dart AnimationStatus.dismissed AnimationStatusDismissed // AnimationStatusForward means the animation is running from beginning to // end. // // Flutter: animation/animation.dart AnimationStatus.forward AnimationStatusForward // AnimationStatusReverse means the animation is running backwards, from end to // beginning. // // Flutter: animation/animation.dart AnimationStatus.reverse AnimationStatusReverse // AnimationStatusCompleted means the animation is stopped at the end. // // Flutter: animation/animation.dart AnimationStatus.completed AnimationStatusCompleted )
The values of AnimationStatus follow Flutter's declaration order.
func (AnimationStatus) IsAnimating ¶
func (s AnimationStatus) IsAnimating() bool
IsAnimating reports whether the animation is running: forward or reverse.
Flutter: animation/animation.dart AnimationStatus.isAnimating
func (AnimationStatus) IsCompleted ¶
func (s AnimationStatus) IsCompleted() bool
IsCompleted reports whether the status is AnimationStatusCompleted.
Flutter: animation/animation.dart AnimationStatus.isCompleted
func (AnimationStatus) IsDismissed ¶
func (s AnimationStatus) IsDismissed() bool
IsDismissed reports whether the status is AnimationStatusDismissed.
Flutter: animation/animation.dart AnimationStatus.isDismissed
func (AnimationStatus) IsForwardOrCompleted ¶
func (s AnimationStatus) IsForwardOrCompleted() bool
IsForwardOrCompleted reports whether the animation is running forward, or is at the end.
Flutter: animation/animation.dart AnimationStatus.isForwardOrCompleted
func (AnimationStatus) Name ¶
func (s AnimationStatus) Name() string
Name is the name of the status as Dart writes it, such as "forward".
Flutter: animation/animation.dart AnimationStatus.name
func (AnimationStatus) String ¶
func (s AnimationStatus) String() string
String is the name with the enum, such as "AnimationStatus.forward".
Flutter: animation/animation.dart AnimationStatus
type AnimationStatusListener ¶
type AnimationStatusListener func(status AnimationStatus)
AnimationStatusListener is called when the status of an animation changes.
Flutter: animation/animation.dart AnimationStatusListener
type AnimationStyle ¶
type AnimationStyle struct {
// Curve is the curve of the animation in the forward direction.
//
// Flutter: animation/animation_style.dart AnimationStyle.curve
Curve Curve
// Duration is the length of the animation in the forward direction.
//
// Flutter: animation/animation_style.dart AnimationStyle.duration
Duration foundation.Opt[time.Duration]
// ReverseCurve is the curve of the animation in the reverse direction.
//
// Flutter: animation/animation_style.dart AnimationStyle.reverseCurve
ReverseCurve Curve
// ReverseDuration is the length of the animation in the reverse direction.
//
// Flutter: animation/animation_style.dart AnimationStyle.reverseDuration
ReverseDuration foundation.Opt[time.Duration]
}
AnimationStyle is used to override the default parameters of an animation: its curves and durations. A field that is not set (nil, or none) means the widget's default.
Flutter: animation/animation_style.dart AnimationStyle
func LerpAnimationStyle ¶
func LerpAnimationStyle(a, b *AnimationStyle, t float64) *AnimationStyle
LerpAnimationStyle linearly interpolates between two styles. The curves are interpolated by averaging their values, and the durations linearly. A nil style has no fields set.
Flutter: animation/animation_style.dart AnimationStyle.lerp
func NewAnimationStyle ¶
func NewAnimationStyle(opts ...AnimationStyle) AnimationStyle
NewAnimationStyle creates an AnimationStyle; the fields of the options are the ones of the style.
Flutter: animation/animation_style.dart AnimationStyle.new
func (AnimationStyle) CopyWith ¶
func (s AnimationStyle) CopyWith(o AnimationStyle) AnimationStyle
CopyWith is a copy of the style with the fields that are set in the argument replaced.
Flutter: animation/animation_style.dart AnimationStyle.copyWith
func (AnimationStyle) Equals ¶
func (s AnimationStyle) Equals(o AnimationStyle) bool
Equals is whether the two styles have the same curves and durations.
Flutter: animation/animation_style.dart AnimationStyle.==
func (AnimationStyle) Merge ¶
func (s AnimationStyle) Merge(other *AnimationStyle) AnimationStyle
Merge is a copy of the style with the fields that are set in the other style replaced.
Flutter: animation/animation_style.dart AnimationStyle.merge
func (AnimationStyle) String ¶
func (s AnimationStyle) String() string
String describes the style.
Flutter: animation/animation_style.dart AnimationStyle.debugFillProperties
type AnimationWithParent ¶
type AnimationWithParent[P any] struct { // Parent is the animation that this one follows. Parent Animation[P] }
AnimationWithParent has the listener methods of an animation that follows a parent animation, and its status. Embed it and give the Parent.
Flutter: animation/animations.dart AnimationWithParentMixin
func (AnimationWithParent[P]) AddListener ¶
func (a AnimationWithParent[P]) AddListener(listener foundation.VoidCallback) foundation.ListenerHandle
AddListener adds the listener to the parent.
Flutter: animation/animations.dart AnimationWithParentMixin.addListener
func (AnimationWithParent[P]) AddStatusListener ¶
func (a AnimationWithParent[P]) AddStatusListener(listener AnimationStatusListener) StatusListenerHandle
AddStatusListener adds the listener to the parent.
Flutter: animation/animations.dart AnimationWithParentMixin.addStatusListener
func (AnimationWithParent[P]) RemoveListener ¶
func (a AnimationWithParent[P]) RemoveListener(handle foundation.ListenerHandle)
RemoveListener removes the listener from the parent.
Flutter: animation/animations.dart AnimationWithParentMixin.removeListener
func (AnimationWithParent[P]) RemoveStatusListener ¶
func (a AnimationWithParent[P]) RemoveStatusListener(handle StatusListenerHandle)
RemoveStatusListener removes the listener from the parent.
Flutter: animation/animations.dart AnimationWithParentMixin.removeStatusListener
func (AnimationWithParent[P]) Status ¶
func (a AnimationWithParent[P]) Status() AnimationStatus
Status is the status of the parent.
Flutter: animation/animations.dart AnimationWithParentMixin.status
type CatmullRomCurve ¶
type CatmullRomCurve struct {
// ControlPoints are the points that the curve passes through, between (0, 0)
// and (1, 1).
ControlPoints []ui.Offset
// Tension is how tightly the curve bends, from 0 to 1.
Tension float64
// contains filtered or unexported fields
}
CatmullRomCurve is a curve from a Catmull-Rom spline through the control points, which begins at (0, 0) and ends at (1, 1); each x of the control points must be between 0 and 1 and increase.
Flutter: animation/curves.dart CatmullRomCurve
func NewCatmullRomCurve ¶
func NewCatmullRomCurve(controlPoints []ui.Offset, tension ...float64) *CatmullRomCurve
NewCatmullRomCurve creates the curve; its samples are computed when it is first used. In debug builds it panics with the tag CatmullRomCurveInvalid when the control points are not valid (see CatmullRomCurveValidateControlPoints).
Flutter: animation/curves.dart CatmullRomCurve.new
func NewCatmullRomCurvePrecompute ¶
func NewCatmullRomCurvePrecompute(controlPoints []ui.Offset, tension ...float64) *CatmullRomCurve
NewCatmullRomCurvePrecompute creates the curve and computes its samples at once.
Flutter: animation/curves.dart CatmullRomCurve.precompute
func (*CatmullRomCurve) Flipped ¶
func (c *CatmullRomCurve) Flipped() Curve
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
func (*CatmullRomCurve) Transform ¶
func (c *CatmullRomCurve) Transform(t float64) float64
Transform returns the value of the curve at t.
Flutter: animation/curves.dart CatmullRomCurve.transformInternal
type CatmullRomSpline ¶
type CatmullRomSpline struct {
// contains filtered or unexported fields
}
CatmullRomSpline is a 2D spline that passes smoothly through the control points, using a centripetal Catmull-Rom parametrization.
Flutter: animation/curves.dart CatmullRomSpline
func NewCatmullRomSpline ¶
func NewCatmullRomSpline(controlPoints []ui.Offset, opts ...CatmullRomSplineOpts) *CatmullRomSpline
NewCatmullRomSpline creates the spline; the segments are computed when it is first used. It panics with the tag CatmullRomSplineInvalid in debug builds when the tension is not from 0 to 1 or there are fewer than four points.
Flutter: animation/curves.dart CatmullRomSpline.new
func NewCatmullRomSplinePrecompute ¶
func NewCatmullRomSplinePrecompute(controlPoints []ui.Offset, opts ...CatmullRomSplineOpts) *CatmullRomSpline
NewCatmullRomSplinePrecompute creates the spline and computes its segments at once.
Flutter: animation/curves.dart CatmullRomSpline.precompute
func (*CatmullRomSpline) SamplingSeed ¶
func (s *CatmullRomSpline) SamplingSeed() int
SamplingSeed is the seed that Curve2DGenerateSamples uses: it comes from the first segment, so the samples are the same for the same spline.
Flutter: animation/curves.dart CatmullRomSpline.samplingSeed
type CatmullRomSplineOpts ¶
type CatmullRomSplineOpts struct {
// Tension is how tightly the curve bends, from 0 (the default) to 1.
Tension float64
// StartHandle is the point before the first control point; the default
// extends the first segment backwards.
StartHandle foundation.Opt[ui.Offset]
// EndHandle is the point after the last control point; the default extends
// the last segment forwards.
EndHandle foundation.Opt[ui.Offset]
}
CatmullRomSplineOpts are the optional parameters of NewCatmullRomSpline.
Flutter: animation/curves.dart CatmullRomSpline.new
type CompoundAnimation ¶
type CompoundAnimation[T comparable] struct { LazyListeners LocalListeners LocalStatusListeners // First is the first animation; its status takes precedence if neither moves. First Animation[T] // Next is the second animation. Next Animation[T] // contains filtered or unexported fields }
CompoundAnimation combines two animations: the value comes from a function of them, and the status is the status of Next if it is moving, otherwise the status of First. Either can be a CompoundAnimation itself.
Flutter: animation/animations.dart CompoundAnimation
func NewAnimationMax ¶
func NewAnimationMax[T int | float64](first, next Animation[T]) *CompoundAnimation[T]
NewAnimationMax creates an animation of the maximum of two others. Either can be an AnimationMax itself, to combine more.
Flutter: animation/animations.dart AnimationMax
func NewAnimationMean ¶
func NewAnimationMean(left, right Animation[float64]) *CompoundAnimation[float64]
NewAnimationMean creates an animation of the mean of two others. Its status is the status of the right animation if it moves, otherwise the status of the left one.
Flutter: animation/animations.dart AnimationMean
func NewAnimationMin ¶
func NewAnimationMin[T int | float64](first, next Animation[T]) *CompoundAnimation[T]
NewAnimationMin creates an animation of the minimum of two others. Either can be an AnimationMin itself, to combine more.
Flutter: animation/animations.dart AnimationMin
func NewCompoundAnimation ¶
func NewCompoundAnimation[T comparable](name string, first, next Animation[T], combine func(first, next T) T) *CompoundAnimation[T]
NewCompoundAnimation creates an animation of the two, whose value is combine(first.Value(), next.Value()). The name is used in String.
Flutter: animation/animations.dart CompoundAnimation.new
func (*CompoundAnimation[T]) Status ¶
func (c *CompoundAnimation[T]) Status() AnimationStatus
Status is the status of Next if it is moving, otherwise the status of First.
Flutter: animation/animations.dart CompoundAnimation.status
func (*CompoundAnimation[T]) String ¶
func (c *CompoundAnimation[T]) String() string
String describes the animation.
Flutter: animation/animations.dart CompoundAnimation.toString
func (*CompoundAnimation[T]) Value ¶
func (c *CompoundAnimation[T]) Value() T
Value is the combination of the values of the two animations.
Flutter: animation/animations.dart CompoundAnimation.value
type Cubic ¶
type Cubic struct{ A, B, C, D float64 }
Cubic is a cubic polynomial mapping of the unit interval: a Bézier curve from (0, 0) to (1, 1) with the control points (A, B) and (C, D).
Flutter: animation/curves.dart Cubic
func (Cubic) Flipped ¶
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
type Curve ¶
type Curve interface {
ParametricCurve[float64]
// Flipped is the curve mirrored on both axes.
//
// Flutter: animation/curves.dart Curve.flipped
Flipped() Curve
}
Curve is a map of the unit interval to the unit interval, with Transform(0) near 0 and Transform(1) near 1; it is used to ease animations.
Flutter: animation/curves.dart Curve
type Curve2D ¶
type Curve2D interface {
ParametricCurve[ui.Offset]
}
Curve2D is a curve of the unit interval to 2D points.
Flutter: animation/curves.dart Curve2D
type Curve2DGenerateSamplesOpts ¶
type Curve2DGenerateSamplesOpts struct {
// Start is the beginning of the range; the default is 0.
Start float64
// End is the end of the range; the default is 1.
End float64
// Tolerance is how flat a part of the curve must be to stop dividing it; the
// default is 1e-10.
Tolerance float64
}
Curve2DGenerateSamplesOpts are the optional parameters of Curve2DGenerateSamples.
Flutter: animation/curves.dart Curve2D.generateSamples
type Curve2DSample ¶
type Curve2DSample struct {
// T is the parameter of the sample.
T float64
// Value is the point of the curve at T.
Value ui.Offset
}
Curve2DSample is a sample of a Curve2D: a value at a parameter t.
Flutter: animation/curves.dart Curve2DSample
func Curve2DGenerateSamples ¶
func Curve2DGenerateSamples(c Curve2D, opts ...Curve2DGenerateSamplesOpts) []Curve2DSample
Curve2DGenerateSamples samples the curve so that a line between the samples is within the tolerance of it. It panics with the tag Curve2DRangeInvalid when the end is not after the start.
Deviation: the points to sample are chosen with a seeded pseudo random number generator like Flutter's, but not the same one, so the samples differ slightly while the curve they describe is the same within the tolerance (SPEC §12.10).
Flutter: animation/curves.dart Curve2D.generateSamples
func (Curve2DSample) String ¶
func (s Curve2DSample) String() string
String describes the sample.
Flutter: animation/curves.dart Curve2DSample.toString
type CurveFunc ¶
CurveFunc is a Curve made of a function that gives the values for t between 0 and 1 (exclusive): Transform returns 0 and 1 for them without calling it.
Flutter: animation/curves.dart Curve (a subclass that overrides transformInternal)
type CurveTween ¶
type CurveTween struct {
AnimatableBase[float64]
// Curve is the curve to apply.
//
// Flutter: animation/tween.dart CurveTween.curve
Curve Curve
}
CurveTween is an animatable that applies a curve to t.
Flutter: animation/tween.dart CurveTween
func NewCurveTween ¶
func NewCurveTween(curve Curve) *CurveTween
NewCurveTween creates a tween that applies the curve.
Flutter: animation/tween.dart CurveTween.new
func (*CurveTween) String ¶
func (c *CurveTween) String() string
String describes the tween.
Flutter: animation/tween.dart CurveTween.toString
func (*CurveTween) Transform ¶
func (c *CurveTween) Transform(t float64) float64
Transform returns t for 0 and 1 and the curve's value between.
Flutter: animation/tween.dart CurveTween.transform
type CurvedAnimation ¶
type CurvedAnimation struct {
AnimationWithParent[float64]
// Curve is the curve used in the forward direction.
Curve Curve
// ReverseCurve is the curve used in the reverse direction; nil uses Curve in
// both directions. If the parent changes direction without first reaching
// completed or dismissed, the animation stays on the same curve, to avoid
// jumps.
ReverseCurve Curve
// IsDisposed is whether Dispose was called.
IsDisposed bool
// contains filtered or unexported fields
}
CurvedAnimation is an animation that applies a curve to another animation, with a different curve for the reverse direction if you like. Depending on the curve, its output can have a wider range than its input (elastic curves overshoot). It adds a status listener to its parent, so call Dispose when it is no longer needed, and do not create one in a build method.
Flutter: animation/animations.dart CurvedAnimation
func NewCurvedAnimation ¶
func NewCurvedAnimation(parent Animation[float64], curve Curve, reverseCurve ...Curve) *CurvedAnimation
NewCurvedAnimation creates the animation. The reverse curve (nil for none) is used when the parent runs in reverse.
Flutter: animation/animations.dart CurvedAnimation.new
func (*CurvedAnimation) Dispose ¶
func (a *CurvedAnimation) Dispose()
Dispose removes the listener that the animation added to its parent.
Flutter: animation/animations.dart CurvedAnimation.dispose
func (*CurvedAnimation) String ¶
func (a *CurvedAnimation) String() string
String describes the animation.
Flutter: animation/animations.dart CurvedAnimation.toString
func (*CurvedAnimation) Value ¶
func (a *CurvedAnimation) Value() float64
Value is the value of the parent passed through the active curve. In debug builds it panics with the tag CurveEndpointInvalid when the curve does not map 0 to near 0 and 1 to near 1.
Flutter: animation/animations.dart CurvedAnimation.value
type CurvesCollection ¶
type CurvesCollection struct {
// Linear is a linear animation curve: the identity.
Linear Curve
// Decelerate is a curve that is shaped like a quadratic ease out.
Decelerate Curve
// FastLinearToSlowEaseIn is a cubic curve that starts fast and ends slowly.
FastLinearToSlowEaseIn Cubic
// FastEaseInToSlowEaseOut is a curve of two cubics, fast in and slow out.
FastEaseInToSlowEaseOut ThreePointCubic
// Ease is a cubic animation curve that speeds up quickly and ends slowly.
Ease Cubic
// EaseIn is a cubic animation curve that starts slowly and ends quickly.
EaseIn Cubic
// EaseInToLinear is a cubic that starts slowly and ends linearly.
EaseInToLinear Cubic
// EaseInSine is a cubic that starts slowly (sinusoidal).
EaseInSine Cubic
// EaseInQuad is a cubic that starts slowly (quadratic).
EaseInQuad Cubic
// EaseInCubic is a cubic that starts slowly (cubic).
EaseInCubic Cubic
// EaseInQuart is a cubic that starts slowly (quartic).
EaseInQuart Cubic
// EaseInQuint is a cubic that starts slowly (quintic).
EaseInQuint Cubic
// EaseInExpo is a cubic that starts slowly (exponential).
EaseInExpo Cubic
// EaseInCirc is a cubic that starts slowly (circular).
EaseInCirc Cubic
// EaseInBack is a cubic that starts by going backwards.
EaseInBack Cubic
// EaseOut is a cubic that starts quickly and ends slowly.
EaseOut Cubic
// LinearToEaseOut is a cubic that starts linearly and ends slowly.
LinearToEaseOut Cubic
// EaseOutSine is a cubic that ends slowly (sinusoidal).
EaseOutSine Cubic
// EaseOutQuad is a cubic that ends slowly (quadratic).
EaseOutQuad Cubic
// EaseOutCubic is a cubic that ends slowly (cubic).
EaseOutCubic Cubic
// EaseOutQuart is a cubic that ends slowly (quartic).
EaseOutQuart Cubic
// EaseOutQuint is a cubic that ends slowly (quintic).
EaseOutQuint Cubic
// EaseOutExpo is a cubic that ends slowly (exponential).
EaseOutExpo Cubic
// EaseOutCirc is a cubic that ends slowly (circular).
EaseOutCirc Cubic
// EaseOutBack is a cubic that overshoots its end and comes back.
EaseOutBack Cubic
// EaseInOut is a cubic that starts and ends slowly.
EaseInOut Cubic
// EaseInOutSine is a cubic that starts and ends slowly (sinusoidal).
EaseInOutSine Cubic
// EaseInOutQuad is a cubic that starts and ends slowly (quadratic).
EaseInOutQuad Cubic
// EaseInOutCubic is a cubic that starts and ends slowly (cubic).
EaseInOutCubic Cubic
// EaseInOutCubicEmphasized is a curve of two cubics with an emphasized
// middle.
EaseInOutCubicEmphasized ThreePointCubic
// EaseInOutQuart is a cubic that starts and ends slowly (quartic).
EaseInOutQuart Cubic
// EaseInOutQuint is a cubic that starts and ends slowly (quintic).
EaseInOutQuint Cubic
// EaseInOutExpo is a cubic that starts and ends slowly (exponential).
EaseInOutExpo Cubic
// EaseInOutCirc is a cubic that starts and ends slowly (circular).
EaseInOutCirc Cubic
// EaseInOutBack is a cubic that goes back at the start and overshoots at the
// end.
EaseInOutBack Cubic
// FastOutSlowIn is the standard Material motion curve: fast out, slow in.
FastOutSlowIn Cubic
// SlowMiddle is a cubic that is slow in the middle.
SlowMiddle Cubic
// BounceIn is an oscillating curve that grows in magnitude.
BounceIn Curve
// BounceOut is an oscillating curve that shrinks in magnitude.
BounceOut Curve
// BounceInOut is an oscillating curve that first grows and then shrinks.
BounceInOut Curve
// ElasticIn is an oscillating curve that grows in magnitude.
ElasticIn ElasticInCurve
// ElasticOut is an oscillating curve that shrinks in magnitude.
ElasticOut ElasticOutCurve
// ElasticInOut is an oscillating curve that grows and then shrinks.
ElasticInOut ElasticInOutCurve
}
CurvesCollection holds the standard curves. The one value of it is Curves; it is read-only.
Flutter: animation/curves.dart Curves
type ElasticInCurve ¶
type ElasticInCurve struct{ Period float64 }
ElasticInCurve is an oscillating curve that grows in magnitude.
Flutter: animation/curves.dart ElasticInCurve
func NewElasticInCurve ¶
func NewElasticInCurve(period ...float64) ElasticInCurve
NewElasticInCurve creates the curve; the period (the default is 0.4) is the duration of each oscillation.
Flutter: animation/curves.dart ElasticInCurve.new
func (ElasticInCurve) Flipped ¶
func (c ElasticInCurve) Flipped() Curve
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
func (ElasticInCurve) String ¶
func (c ElasticInCurve) String() string
String describes the curve.
Flutter: animation/curves.dart ElasticInCurve.toString
func (ElasticInCurve) Transform ¶
func (c ElasticInCurve) Transform(t float64) float64
Transform returns the value of the curve at t.
Flutter: animation/curves.dart ElasticInCurve.transformInternal
type ElasticInOutCurve ¶
type ElasticInOutCurve struct{ Period float64 }
ElasticInOutCurve is an oscillating curve that grows and then shrinks in magnitude.
Flutter: animation/curves.dart ElasticInOutCurve
func NewElasticInOutCurve ¶
func NewElasticInOutCurve(period ...float64) ElasticInOutCurve
NewElasticInOutCurve creates the curve; the period (the default is 0.4) is the duration of each oscillation.
Flutter: animation/curves.dart ElasticInOutCurve.new
func (ElasticInOutCurve) Flipped ¶
func (c ElasticInOutCurve) Flipped() Curve
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
func (ElasticInOutCurve) String ¶
func (c ElasticInOutCurve) String() string
String describes the curve.
Flutter: animation/curves.dart ElasticInOutCurve.toString
func (ElasticInOutCurve) Transform ¶
func (c ElasticInOutCurve) Transform(t float64) float64
Transform returns the value of the curve at t.
Flutter: animation/curves.dart ElasticInOutCurve.transformInternal
type ElasticOutCurve ¶
type ElasticOutCurve struct{ Period float64 }
ElasticOutCurve is an oscillating curve that shrinks in magnitude while overshooting its bounds.
Flutter: animation/curves.dart ElasticOutCurve
func NewElasticOutCurve ¶
func NewElasticOutCurve(period ...float64) ElasticOutCurve
NewElasticOutCurve creates the curve; the period (the default is 0.4) is the duration of each oscillation.
Flutter: animation/curves.dart ElasticOutCurve.new
func (ElasticOutCurve) Flipped ¶
func (c ElasticOutCurve) Flipped() Curve
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
func (ElasticOutCurve) String ¶
func (c ElasticOutCurve) String() string
String describes the curve.
Flutter: animation/curves.dart ElasticOutCurve.toString
func (ElasticOutCurve) Transform ¶
func (c ElasticOutCurve) Transform(t float64) float64
Transform returns the value of the curve at t.
Flutter: animation/curves.dart ElasticOutCurve.transformInternal
type Environment ¶
type Environment interface {
// DisableAnimations is whether the system asks for animations to be off
// (SemanticsBinding.disableAnimations).
DisableAnimations() bool
// ErrorReporter receives the errors of the listeners of the controller.
ErrorReporter() foundation.ErrorReporter
}
Environment is what an AnimationController asks of its vsync (the TickerProvider) besides the tickers, in place of Flutter's global SemanticsBinding and FlutterError.onError. A TickerProvider that implements it is asked for them; one that does not gets "animations are enabled" and no error reporter.
Flutter: no counterpart (Flutter reads SemanticsBinding.instance)
type FlingOpts ¶
type FlingOpts struct {
// Velocity is the velocity in the animation's range per second; the default
// is 1. A negative velocity flings towards LowerBound.
Velocity foundation.Opt[float64]
// SpringDescription is the spring that drives the fling; the default is a
// critically damped one (mass 1, stiffness 500).
SpringDescription foundation.Opt[physics.SpringDescription]
// AnimationBehavior overrides the controller's behavior for this fling.
AnimationBehavior AnimationBehavior
}
FlingOpts are the optional parameters of Fling.
Flutter: animation/animation_controller.dart AnimationController.fling
type FlippedCurve ¶
type FlippedCurve struct{ Curve Curve }
FlippedCurve is a curve that is the reversed inversion of another: 1 - curve(1 - t). It makes an ease out from an ease in.
Flutter: animation/curves.dart FlippedCurve
func NewFlippedCurve ¶
func NewFlippedCurve(curve Curve) FlippedCurve
NewFlippedCurve creates the curve.
Flutter: animation/curves.dart FlippedCurve.new
func (FlippedCurve) Flipped ¶
func (c FlippedCurve) Flipped() Curve
Flipped is the curve that was flipped.
Flutter: animation/curves.dart Curve.flipped
func (FlippedCurve) String ¶
func (c FlippedCurve) String() string
String describes the curve.
Flutter: animation/curves.dart FlippedCurve.toString
func (FlippedCurve) Transform ¶
func (c FlippedCurve) Transform(t float64) float64
Transform returns the value of the curve at t.
Flutter: animation/curves.dart FlippedCurve.transformInternal
type FlippedTweenSequence ¶
type FlippedTweenSequence struct{ *TweenSequence[float64] }
FlippedTweenSequence is a TweenSequence of float64 that runs backwards: it has 1 - sequence(1 - t).
Flutter: animation/tween_sequence.dart FlippedTweenSequence
func NewFlippedTweenSequence ¶
func NewFlippedTweenSequence(items []TweenSequenceItem[float64]) *FlippedTweenSequence
NewFlippedTweenSequence creates the flipped sequence of the items.
Flutter: animation/tween_sequence.dart FlippedTweenSequence.new
func (*FlippedTweenSequence) Transform ¶
func (f *FlippedTweenSequence) Transform(t float64) float64
Transform returns 1 - the sequence at 1 - t.
Flutter: animation/tween_sequence.dart FlippedTweenSequence.transform
type Interval ¶
type Interval struct {
// Begin is the largest value for which the curve is 0.
Begin float64
// End is the smallest value for which the curve is 1.
End float64
// Curve is the curve between Begin and End; the default is Curves.Linear.
Curve Curve
}
Interval is a curve that is 0.0 until Begin, then follows another curve until End, then 1.0.
Flutter: animation/curves.dart Interval
func NewInterval ¶
NewInterval creates the curve; the curve (nil for linear) is applied between begin and end.
Flutter: animation/curves.dart Interval.new
func (Interval) Flipped ¶
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
type LazyListeners ¶
type LazyListeners struct {
// OnStartListening is called when the first listener is added.
OnStartListening func()
// OnStopListening is called when the last listener is removed.
OnStopListening func()
// contains filtered or unexported fields
}
LazyListeners counts the listeners of an animation so that it can attach to its parents only while someone listens. Embed it, set the two functions and call DidRegisterListener and DidUnregisterListener from the listener methods.
Flutter: animation/listener_helpers.dart AnimationLazyListenerMixin
func (*LazyListeners) DidRegisterListener ¶
func (l *LazyListeners) DidRegisterListener()
DidRegisterListener counts a listener that was added.
Flutter: animation/listener_helpers.dart AnimationLazyListenerMixin.didRegisterListener
func (*LazyListeners) DidUnregisterListener ¶
func (l *LazyListeners) DidUnregisterListener()
DidUnregisterListener counts a listener that was removed.
Flutter: animation/listener_helpers.dart AnimationLazyListenerMixin.didUnregisterListener
func (*LazyListeners) IsListening ¶
func (l *LazyListeners) IsListening() bool
IsListening reports whether there are listeners.
Flutter: animation/listener_helpers.dart AnimationLazyListenerMixin.isListening
type Lerper ¶
Lerper is a type that can interpolate between two of its values: Tween uses it when the type of the tween has it (ui.Color, ui.Offset, ui.Size and ui.Rect do).
Flutter: animation/tween.dart Tween (the +, - and * operators of T)
type LocalListeners ¶
type LocalListeners struct {
// OnRegister is called before a listener is added.
OnRegister func()
// OnUnregister is called after a listener that was there is removed.
OnUnregister func()
// contains filtered or unexported fields
}
LocalListeners keeps the listeners of an animation and calls them. Embed it in an animation: it has AddListener, RemoveListener and NotifyListeners. The listeners are called in the order they were added, and a listener that is removed during the notification is not called; an error that one of them panics with is reported (see SetErrorReporter) and the others are still called.
Flutter: animation/listener_helpers.dart AnimationLocalListenersMixin
func (*LocalListeners) AddListener ¶
func (l *LocalListeners) AddListener(listener foundation.VoidCallback) foundation.ListenerHandle
AddListener calls the listener whenever the value changes.
Flutter: animation/listener_helpers.dart AnimationLocalListenersMixin.addListener
func (*LocalListeners) ClearListeners ¶
func (l *LocalListeners) ClearListeners()
ClearListeners removes every listener, without calling OnUnregister.
Flutter: animation/listener_helpers.dart AnimationLocalListenersMixin.clearListeners
func (*LocalListeners) NotifyListeners ¶
func (l *LocalListeners) NotifyListeners()
NotifyListeners calls the listeners.
Flutter: animation/listener_helpers.dart AnimationLocalListenersMixin.notifyListeners
func (*LocalListeners) RemoveListener ¶
func (l *LocalListeners) RemoveListener(handle foundation.ListenerHandle)
RemoveListener stops calling the listener; one that is not there is ignored.
Flutter: animation/listener_helpers.dart AnimationLocalListenersMixin.removeListener
func (*LocalListeners) SetErrorReporter ¶
func (l *LocalListeners) SetErrorReporter(r foundation.ErrorReporter)
SetErrorReporter sets where the errors of the listeners go; without one the first error is thrown again after all the listeners were called.
Flutter: no counterpart (Flutter reports with FlutterError.reportError)
type LocalStatusListeners ¶
type LocalStatusListeners struct {
// OnRegister is called before a listener is added.
OnRegister func()
// OnUnregister is called after a listener that was there is removed.
OnUnregister func()
// contains filtered or unexported fields
}
LocalStatusListeners keeps the status listeners of an animation and calls them, like LocalListeners.
Flutter: animation/listener_helpers.dart AnimationLocalStatusListenersMixin
func (*LocalStatusListeners) AddStatusListener ¶
func (l *LocalStatusListeners) AddStatusListener(listener AnimationStatusListener) StatusListenerHandle
AddStatusListener calls the listener whenever the status changes.
Flutter: animation/listener_helpers.dart AnimationLocalStatusListenersMixin.addStatusListener
func (*LocalStatusListeners) ClearStatusListeners ¶
func (l *LocalStatusListeners) ClearStatusListeners()
ClearStatusListeners removes every status listener, without calling OnUnregister.
Flutter: animation/listener_helpers.dart AnimationLocalStatusListenersMixin.clearStatusListeners
func (*LocalStatusListeners) NotifyStatusListeners ¶
func (l *LocalStatusListeners) NotifyStatusListeners(status AnimationStatus)
NotifyStatusListeners calls the status listeners with the status.
Flutter: animation/listener_helpers.dart AnimationLocalStatusListenersMixin.notifyStatusListeners
func (*LocalStatusListeners) RemoveStatusListener ¶
func (l *LocalStatusListeners) RemoveStatusListener(handle StatusListenerHandle)
RemoveStatusListener stops calling the listener.
Flutter: animation/listener_helpers.dart AnimationLocalStatusListenersMixin.removeStatusListener
func (*LocalStatusListeners) SetErrorReporter ¶
func (l *LocalStatusListeners) SetErrorReporter(r foundation.ErrorReporter)
SetErrorReporter sets where the errors of the listeners go.
Flutter: no counterpart (Flutter reports with FlutterError.reportError)
type ParametricCurve ¶
type ParametricCurve[T any] interface { // Transform returns the value of the curve at t. // // Flutter: animation/curves.dart ParametricCurve.transform Transform(t float64) T }
ParametricCurve is a mapping of the unit interval to type T. Transform panics with the tag CurveParameterOutOfRange in debug builds when t is outside 0 to 1.
Flutter: animation/curves.dart ParametricCurve
type ProxyAnimation ¶
type ProxyAnimation struct {
LazyListeners
LocalListeners
LocalStatusListeners
// contains filtered or unexported fields
}
ProxyAnimation is an animation that is a proxy for another animation: the parent can change after the proxy was handed to someone else.
Flutter: animation/animations.dart ProxyAnimation
func NewProxyAnimation ¶
func NewProxyAnimation(parent Animation[float64]) *ProxyAnimation
NewProxyAnimation creates a proxy animation. Without a parent (nil) the proxy has the status AnimationStatusDismissed and the value 0.
Flutter: animation/animations.dart ProxyAnimation.new
func (*ProxyAnimation) Parent ¶
func (p *ProxyAnimation) Parent() Animation[float64]
Parent is the animation whose value this animation proxies.
Flutter: animation/animations.dart ProxyAnimation.parent
func (*ProxyAnimation) SetParent ¶
func (p *ProxyAnimation) SetParent(value Animation[float64])
SetParent changes the animation to proxy. The listeners of the proxy are moved to the new parent, and called when the value or the status differ.
Flutter: animation/animations.dart ProxyAnimation.parent
func (*ProxyAnimation) Status ¶
func (p *ProxyAnimation) Status() AnimationStatus
Status is the status of the parent.
Flutter: animation/animations.dart ProxyAnimation.status
func (*ProxyAnimation) String ¶
func (p *ProxyAnimation) String() string
String describes the animation.
Flutter: animation/animations.dart ProxyAnimation.toString
func (*ProxyAnimation) Value ¶
func (p *ProxyAnimation) Value() float64
Value is the value of the parent.
Flutter: animation/animations.dart ProxyAnimation.value
type RepeatOpts ¶
type RepeatOpts struct {
// Min is the lower value of the repetition; the default is LowerBound.
Min foundation.Opt[float64]
// Max is the upper value of the repetition; the default is UpperBound.
Max foundation.Opt[float64]
// Reverse makes the animation go back and forth instead of jumping from the
// end to the start.
Reverse bool
// Period is the length of one repetition; the default is the controller's
// Duration.
Period foundation.Opt[time.Duration]
// Count is the number of repetitions; the default is to repeat forever. It
// must be greater than zero.
Count foundation.Opt[int]
}
RepeatOpts are the optional parameters of Repeat.
Flutter: animation/animation_controller.dart AnimationController.repeat
type ReverseAnimation ¶
type ReverseAnimation struct {
LazyListeners
LocalStatusListeners
// contains filtered or unexported fields
}
ReverseAnimation is an animation that is the reverse of another: while the parent runs forward from 0 to 1, this one runs in reverse from 1 to 0.
Flutter: animation/animations.dart ReverseAnimation
func NewReverseAnimation ¶
func NewReverseAnimation(parent Animation[float64]) *ReverseAnimation
NewReverseAnimation creates the animation that reverses the parent.
Flutter: animation/animations.dart ReverseAnimation.new
func (*ReverseAnimation) AddListener ¶
func (r *ReverseAnimation) AddListener(listener foundation.VoidCallback) foundation.ListenerHandle
AddListener adds the listener to the parent.
Flutter: animation/animations.dart ReverseAnimation.addListener
func (*ReverseAnimation) Parent ¶
func (r *ReverseAnimation) Parent() Animation[float64]
Parent is the animation whose value and direction this one reverses.
Flutter: animation/animations.dart ReverseAnimation.parent
func (*ReverseAnimation) RemoveListener ¶
func (r *ReverseAnimation) RemoveListener(handle foundation.ListenerHandle)
RemoveListener removes the listener from the parent.
Flutter: animation/animations.dart ReverseAnimation.removeListener
func (*ReverseAnimation) Status ¶
func (r *ReverseAnimation) Status() AnimationStatus
Status is the reverse of the status of the parent.
Flutter: animation/animations.dart ReverseAnimation.status
func (*ReverseAnimation) String ¶
func (r *ReverseAnimation) String() string
String describes the animation.
Flutter: animation/animations.dart ReverseAnimation.toString
func (*ReverseAnimation) Value ¶
func (r *ReverseAnimation) Value() float64
Value is 1 minus the value of the parent.
Flutter: animation/animations.dart ReverseAnimation.value
type SawTooth ¶
type SawTooth struct{ Count int }
SawTooth is a sawtooth curve that repeats a given number of times over the unit interval; its value goes from 0 to 1 each time.
Flutter: animation/curves.dart SawTooth
func (SawTooth) Flipped ¶
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
type Split ¶
type Split struct {
// Split is the progress at which the curve changes, from 0 to 1.
Split float64
// BeginCurve is the curve before the split; the default is Curves.Linear.
BeginCurve Curve
// EndCurve is the curve after the split; the default is Curves.EaseOutCubic.
EndCurve Curve
}
Split is a curve that progresses according to BeginCurve until Split, then according to EndCurve.
Flutter: animation/curves.dart Split
func (Split) Flipped ¶
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
type SplitOpts ¶
type SplitOpts struct {
// BeginCurve is the curve before the split; the default is Curves.Linear.
BeginCurve Curve
// EndCurve is the curve after the split; the default is Curves.EaseOutCubic.
EndCurve Curve
}
SplitOpts are the optional parameters of NewSplit.
Flutter: animation/curves.dart Split.new
type StatusListenerHandle ¶
type StatusListenerHandle struct {
// contains filtered or unexported fields
}
StatusListenerHandle identifies a status listener that was added to an animation, to remove it. The zero value identifies none.
Flutter: no counterpart (Dart removes a listener by its function)
type StopOpts ¶
type StopOpts struct {
// Canceled is whether the future of the animation is canceled instead of
// completed; the default is true.
Canceled foundation.Opt[bool]
}
StopOpts are the optional parameters of Stop.
Flutter: animation/animation_controller.dart AnimationController.stop
type ThreePointCubic ¶
type ThreePointCubic struct {
// A1 is the first control point of the first curve.
A1 ui.Offset
// B1 is the second control point of the first curve.
B1 ui.Offset
// Midpoint is the end point of the first curve and the start of the second.
Midpoint ui.Offset
// A2 is the first control point of the second curve.
A2 ui.Offset
// B2 is the second control point of the second curve.
B2 ui.Offset
}
ThreePointCubic is a curve made of two cubic Bézier curves that meet at a midpoint.
Flutter: animation/curves.dart ThreePointCubic
func NewThreePointCubic ¶
func NewThreePointCubic(a1, b1, midpoint, a2, b2 ui.Offset) ThreePointCubic
NewThreePointCubic creates the curve.
Flutter: animation/curves.dart ThreePointCubic.new
func (ThreePointCubic) Flipped ¶
func (c ThreePointCubic) Flipped() Curve
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
func (ThreePointCubic) String ¶
func (c ThreePointCubic) String() string
String describes the curve.
Flutter: animation/curves.dart ThreePointCubic.toString
func (ThreePointCubic) Transform ¶
func (c ThreePointCubic) Transform(t float64) float64
Transform returns the value of the curve at t.
Flutter: animation/curves.dart ThreePointCubic.transformInternal
type Threshold ¶
type Threshold struct{ Threshold float64 }
Threshold is a curve that is 0 until the threshold, then jumps to 1.
Flutter: animation/curves.dart Threshold
func (Threshold) Flipped ¶
Flipped is the curve mirrored on both axes.
Flutter: animation/curves.dart Curve.flipped
type TrainHoppingAnimation ¶
type TrainHoppingAnimation struct {
LocalListeners
LocalStatusListeners
// OnSwitchedTrain is called when the animation switches to be driven by the
// second animation. It is not called when both started at the same value; the
// second is then used from the start.
OnSwitchedTrain func()
// contains filtered or unexported fields
}
TrainHoppingAnimation starts by proxying one animation, and when the value of that animation crosses the value of the second (because the second goes the other way, or one overtakes the other), it hops to proxying the second. It tracks both animations even without listeners of its own, so call Dispose to shut it down.
Flutter: animation/animations.dart TrainHoppingAnimation
func NewTrainHoppingAnimation ¶
func NewTrainHoppingAnimation(currentTrain, nextTrain Animation[float64], onSwitchedTrain func()) *TrainHoppingAnimation
NewTrainHoppingAnimation creates the animation. The next train (nil for none) is the animation to hop to; without it, this animation only proxies the current one.
Flutter: animation/animations.dart TrainHoppingAnimation.new
func (*TrainHoppingAnimation) CurrentTrain ¶
func (t *TrainHoppingAnimation) CurrentTrain() Animation[float64]
CurrentTrain is the animation that currently drives this one; it changes from the first animation to the second when OnSwitchedTrain is called.
Flutter: animation/animations.dart TrainHoppingAnimation.currentTrain
func (*TrainHoppingAnimation) Dispose ¶
func (t *TrainHoppingAnimation) Dispose()
Dispose frees the resources of the animation; it can't be used afterwards.
Flutter: animation/animations.dart TrainHoppingAnimation.dispose
func (*TrainHoppingAnimation) Status ¶
func (t *TrainHoppingAnimation) Status() AnimationStatus
Status is the status of the current train.
Flutter: animation/animations.dart TrainHoppingAnimation.status
func (*TrainHoppingAnimation) String ¶
func (t *TrainHoppingAnimation) String() string
String describes the animation.
Flutter: animation/animations.dart TrainHoppingAnimation.toString
func (*TrainHoppingAnimation) Value ¶
func (t *TrainHoppingAnimation) Value() float64
Value is the value of the current train.
Flutter: animation/animations.dart TrainHoppingAnimation.value
type Tween ¶
type Tween[T any] struct { AnimatableBase[T] // Begin is the value at t = 0. // // Flutter: animation/tween.dart Tween.begin Begin T // End is the value at t = 1. // // Flutter: animation/tween.dart Tween.end End T // contains filtered or unexported fields }
Tween is a linear interpolation between a beginning and ending value. Its type must be float64 or have a Lerp method (see Lerper), or give a function to NewTweenFunc. For int values use NewIntTween or NewStepTween.
Flutter: animation/tween.dart Tween
func NewColorTween ¶
func NewColorTween(begin, end foundation.Opt[ui.Color]) *Tween[foundation.Opt[ui.Color]]
NewColorTween creates a tween between two colors. A color that is none counts as transparent when the other one is some, as Color.lerp does with null.
Flutter: animation/tween.dart ColorTween
func NewConstantTween ¶
NewConstantTween creates a tween that has the same value at every t.
Flutter: animation/tween.dart ConstantTween
func NewIntTween ¶
NewIntTween creates a tween between two ints that rounds each value.
Flutter: animation/tween.dart IntTween
func NewRectTween ¶
func NewRectTween(begin, end foundation.Opt[ui.Rect]) *Tween[foundation.Opt[ui.Rect]]
NewRectTween creates a tween between two rectangles. A rectangle that is none counts as zero when the other one is some, as Rect.lerp does with null.
Flutter: animation/tween.dart RectTween
func NewReverseTween ¶
NewReverseTween creates a tween that runs the parent backwards: it begins at the parent's end.
Flutter: animation/tween.dart ReverseTween.new
func NewSizeTween ¶
func NewSizeTween(begin, end foundation.Opt[ui.Size]) *Tween[foundation.Opt[ui.Size]]
NewSizeTween creates a tween between two sizes. A size that is none counts as zero when the other one is some, as Size.lerp does with null.
Flutter: animation/tween.dart SizeTween
func NewStepTween ¶
NewStepTween creates a tween between two ints that rounds each value down, which makes steps.
Flutter: animation/tween.dart StepTween
func NewTween ¶
NewTween creates a tween from begin to end with the built-in interpolation of the type T. It panics with the tag TweenLerpMissing when T is neither float64 nor a Lerper.
Flutter: animation/tween.dart Tween.new
func NewTweenEnd ¶
NewTweenEnd creates a tween that has only an end, like Flutter's Tween(end: x) with a null begin. See NewTween for the interpolation.
Flutter: animation/tween.dart Tween.new
func NewTweenFunc ¶
NewTweenFunc creates a tween from begin to end that interpolates with the function.
Flutter: animation/tween.dart Tween.lerp
func NewTweenFuncEnd ¶
NewTweenFuncEnd creates a tween that has only an end and interpolates with the function.
Flutter: animation/tween.dart Tween.new
func (*Tween[T]) FillBegin ¶
func (t *Tween[T]) FillBegin()
FillBegin sets the beginning to the end if the tween has none, which is Flutter's `tween.begin ??= tween.end`.
Flutter: animation/tween.dart Tween.begin
func (*Tween[T]) HasBegin ¶
HasBegin is false for a tween made with NewTweenEnd or NewTweenFuncEnd until FillBegin is called.
Flutter: animation/tween.dart Tween.begin (null)
func (*Tween[T]) Lerp ¶
Lerp returns the value of the tween at t, without the special cases of Transform for 0 and 1.
Flutter: animation/tween.dart Tween.lerp
func (*Tween[T]) SetName ¶
SetName sets the name that String shows, such as "AlignmentTween"; a tween of your own type uses it as the class name. It returns the tween.
Flutter: no counterpart (the name of the Dart class)
func (*Tween[T]) SetNullable ¶
SetNullable says which values of the tween are null, for the tweens of nullable types (ColorTween's none): a null begin counts as no begin, like Flutter's `begin ??= end`. It returns the tween.
Flutter: no counterpart (Dart's null)
func (*Tween[T]) Transform ¶
Transform returns Begin at 0, End at 1 and the interpolated value between.
Flutter: animation/tween.dart Tween.transform
func (*Tween[T]) WithoutBegin ¶
WithoutBegin makes the tween one that has only an end (Flutter's null begin): HasBegin is false and FillBegin gives it a beginning. It returns the tween.
Flutter: animation/tween.dart Tween.begin (null)
type TweenLerp ¶
TweenLerp interpolates between two values of the type.
Flutter: animation/tween.dart Tween.lerp
type TweenSequence ¶
type TweenSequence[T any] struct { AnimatableBase[T] // contains filtered or unexported fields }
TweenSequence lets a sequence of animatables run one after the other, each for a share of the time that follows its weight.
Flutter: animation/tween_sequence.dart TweenSequence
func NewTweenSequence ¶
func NewTweenSequence[T any](items []TweenSequenceItem[T]) *TweenSequence[T]
NewTweenSequence creates a sequence of the items. It panics with the tag TweenSequenceInvalid when there are no items or a weight is not greater than zero.
Flutter: animation/tween_sequence.dart TweenSequence.new
func (*TweenSequence[T]) String ¶
func (s *TweenSequence[T]) String() string
String describes the sequence.
Flutter: animation/tween_sequence.dart TweenSequence.toString
func (*TweenSequence[T]) Transform ¶
func (s *TweenSequence[T]) Transform(t float64) T
Transform returns the value of the item that t falls in.
Flutter: animation/tween_sequence.dart TweenSequence.transform
type TweenSequenceItem ¶
type TweenSequenceItem[T any] struct { // Tween is the animatable of the item. // // Flutter: animation/tween_sequence.dart TweenSequenceItem.tween Tween Animatable[T] // Weight is the item's share of the sequence; it must be greater than zero. // // Flutter: animation/tween_sequence.dart TweenSequenceItem.weight Weight float64 }
TweenSequenceItem is one animatable of a TweenSequence and its weight.
Flutter: animation/tween_sequence.dart TweenSequenceItem