text stringlengths 1 372 |
|---|
a look at some of the major classes in the |
animations library, and flutter’s animation architecture. |
animation and motion widgets |
a catalog of some of the animation widgets |
provided in the flutter APIs. |
the animation library in the flutter API documentation |
the animation API for the flutter framework. this link |
takes you to a technical overview page for the library. |
<topic_end> |
<topic_start> |
animations tutorial |
<topic_end> |
<topic_start> |
what you'll learn |
this tutorial shows you how to build explicit animations in flutter. |
after introducing some of the essential concepts, classes, |
and methods in the animation library, it walks you through 5 |
animation examples. the examples build on each other, |
introducing you to different aspects of the animation library. |
the flutter SDK also provides built-in explicit animations, |
such as FadeTransition, SizeTransition, |
and SlideTransition. these simple animations are |
triggered by setting a beginning and ending point. |
they are simpler to implement |
than custom explicit animations, which are described here. |
<topic_end> |
<topic_start> |
essential animation concepts and classes |
<topic_end> |
<topic_start> |
what's the point? |
the animation system in flutter is based on typed |
animation objects. widgets can either incorporate |
these animations in their build functions directly by |
reading their current value and listening to their state |
changes or they can use the animations as the basis of |
more elaborate animations that they pass along to |
other widgets. |
<topic_end> |
<topic_start> |
animation<double> |
in flutter, an animation object knows nothing about what |
is onscreen. an animation is an abstract class that |
understands its current value and its state (completed or dismissed). |
one of the more commonly used animation types is animation<double>. |
an animation object sequentially generates |
interpolated numbers between two values over a certain duration. |
the output of an animation object might be linear, |
a curve, a step function, or any other mapping you can devise. |
depending on how the animation object is controlled, |
it could run in reverse, or even switch directions in the |
middle. |
animations can also interpolate types other than double, such as |
Animation<Color> or Animation<Size>. |
an animation object has state. its current value is |
always available in the .value member. |
an animation object knows nothing about rendering or |
build() functions. |
<topic_end> |
<topic_start> |
CurvedAnimation |
a CurvedAnimation defines the animation’s progress |
as a non-linear curve. |
<code_start> |
animation = CurvedAnimation(parent: controller, curve: Curves.easeIn); |
<code_end> |
info note |
the curves class defines many commonly used curves, |
or you can create your own. for example: |
browse the curves documentation for a complete listing |
(with visual previews) of the curves constants that ship with flutter. |
CurvedAnimation and AnimationController (described in the next section) |
are both of type animation<double>, so you can pass them interchangeably. |
the CurvedAnimation wraps the object it’s modifying—you |
don’t subclass AnimationController to implement a curve. |
<topic_end> |
<topic_start> |
AnimationController |
AnimationController is a special animation |
object that generates a new value whenever the hardware |
is ready for a new frame. by default, |
an AnimationController linearly produces the numbers |
from 0.0 to 1.0 during a given duration. |
for example, this code creates an animation object, |
but does not start it running: |
<code_start> |
controller = |
AnimationController(duration: const duration(seconds: 2), vsync: this); |
<code_end> |
AnimationController derives from animation<double>, so it can be used |
wherever an animation object is needed. however, the AnimationController |
has additional methods to control the animation. for example, you start |
an animation with the .forward() method. the generation of numbers is |
tied to the screen refresh, so typically 60 numbers are generated per |
second. after each number is generated, each animation object calls the |
attached listener objects. to create a custom display list for each |
child, see RepaintBoundary. |
when creating an AnimationController, you pass it a vsync argument. |
the presence of vsync prevents offscreen animations from consuming |
unnecessary resources. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.