summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-animations.tex
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-animations.tex')
-rw-r--r--Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-animations.tex389
1 files changed, 296 insertions, 93 deletions
diff --git a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-animations.tex b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-animations.tex
index 6a7f606f43d..a692412fb35 100644
--- a/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-animations.tex
+++ b/Master/texmf-dist/doc/generic/pgf/text-en/pgfmanual-en-tikz-animations.tex
@@ -24,7 +24,12 @@ picture, but a change of, say, the opacity of a path is also an animation.
\tikzname\ allows you to specify such animations using special keys and
notations.
%
-\begin{codeexample}[width=8cm,animation list={0.7,1.4,2.1,2.8},animation scale=.25]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ width=8cm,
+ animation list={0.7,1.4,2.1,2.8},
+ animation scale=.25,
+]
\begin{tikzpicture}[
animate/orbit/.style 2 args = {
myself:shift = {
@@ -66,7 +71,7 @@ Adding an animation to a \tikzname\ picture is done as follows:
As a simple example, let us move a circle within thirty seconds by three
centimeters to the left:
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \draw :xshift = {0s = "0cm", 30s = "-3cm", repeats} (0,0) circle (5mm);
\end{codeexample}
@@ -150,7 +155,7 @@ attributes that can be animated:
\item Graphic scopes, which are created by numerous command, including the
|{scope}| environment, the |\scopes| command, but also |\tikz| itself
creates a graphic scope and so does each node and even each path.
- \item View boxes, which can only be created using the |view| library.
+ \item View boxes, which can only be created using the |views| library.
\item Paths, which you create using the |\path| command or commands like
|\draw| that call |\path| internally. However, the (usually background)
path of a node can also be animated. Note that ``animating the path''
@@ -258,12 +263,18 @@ creating these timelines.
you will use it with a |{scope}| environment, inside the options of a node,
or directly with the |\tikz| command:
%
-\begin{codeexample}[animation list = {0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list = {0.5,1,1.5,2},
+]
\tikz \node [fill, text = white, animate = {
myself:fill = {0s = "red", 2s = "blue", begin on = click }}] {Click me};
\end{codeexample}
%
-\begin{codeexample}[animation list = {0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list = {0.5,1,1.5,2},
+]
\tikz [animate = {a node:fill = {0s = "red", 2s = "blue",
begin on = click}}]
\node (a node) [fill, text = white] {Click me};
@@ -277,7 +288,7 @@ creating these timelines.
styles for this key path and use them. For instance, we can define a
|shake| animation like this:
%
-\begin{codeexample}[width=4cm]
+\begin{codeexample}[width=4cm,preamble={\usetikzlibrary{animations}}]
\tikzset{
animate/shake/.style = {myself:xshift = { begin on=click,
0s = "0mm", 50ms = "#1", 150ms = "-#1", 250ms = "#1", 300ms = "0mm" }}}
@@ -333,7 +344,10 @@ an entry:
like |begin on|, are also added to the timeline of the object--attribute
pair.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz [animate = {
object = node, attribute = fill, time = 0s, value = red, entry,
object = node, attribute = fill, time = 2s, value = blue, entry,
@@ -345,7 +359,10 @@ an entry:
object and the attribute in each line, they retain their values unless they
are overwritten. Thus, we could also have written:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz [animate = {
object = node, attribute = fill, time = 0s, value = red, entry,
time = 2s, value = blue, entry,
@@ -364,7 +381,10 @@ an entry:
attributes (that is, between timelines), but the times for any given
timeline must be given in non-decreasing order:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz [animate = {
object = node, attribute = fill, time = 0s, value = red, entry,
object = node2, attribute = draw, entry,
@@ -404,7 +424,10 @@ Section~\ref{section-anim-syntax-obj}.
|name path| key is not the same as |name|; it is an older key from the
intersections package and not related.)
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz [animate = { object = b, :fill = {0s = "red", 2s = "blue",
begin on = click }}] {
\node (a) [fill, text = white, minimum width=1.5cm] at (0,1cm) {a};
@@ -412,7 +435,10 @@ Section~\ref{section-anim-syntax-obj}.
\node (c) [fill, text = white, minimum width=1.5cm] at (0,0mm) {c}; }
\end{codeexample}
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz [animate = { object = b, :fill = {0s = "red", 2s = "blue",
begin on = click },
object = c, :fill = {0s = "green", 2s = "blue",
@@ -452,7 +478,10 @@ Section~\ref{section-anim-syntax-obj}.
exact list of possible attributes is documented in
Section~\ref{section-anim-attrs}.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz [animate = {attribute = fill, n: = { 0s = "red", 2s = "blue",
begin on = click } }]
\node (n) [fill, text = white] {The node};
@@ -479,7 +508,10 @@ Section~\ref{section-anim-syntax-obj}.
object, the attribute, and the value of this key. We can now specify two
separate timelines:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz [animate = {
id = 1, n:shift = { 0s = "{(0,0)}", 2s = "{(0,5mm)}", begin on = click },
id = 2, n:shift = { 0s = "{(0,0)}", 2s = "{(5mm,0)}", begin on = click }
@@ -557,7 +589,10 @@ the effects accumulate).
is interpreted as an offset to the time in the previous use of the time
key:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :fill = { begin on = click,
0s = "white",
500ms later = "red",
@@ -598,9 +633,12 @@ time = 2s later % same as time = 7s
One application of forks is in the definition of keys that add a
certain part to a longer animation. Consider for instance the
- definition of a |hilight| key:
+ definition of a |highlight| key:
%
-\begin{codeexample}[animation list={1.05,1.1,1.15,1.2,2.05,2.1,2.15,2.2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={1.05,1.1,1.15,1.2,2.05,2.1,2.15,2.2},
+]
\tikz [animate/highlight/.style = {
scope = { fork = #1,
:fill = { 0s = "black", 0.1s = "white", 0.2s = "black"} }
@@ -746,7 +784,10 @@ makes this easy:
Executed the \meta{options} inside a \TeX\ scope. In particular, all
settings made inside the scope have no effect after the end of the |scope|.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node [animate = { myself: = { begin on = click,
scope = { attribute = fill, repeats = 3, 0s = "red", 2s = "red!50" },
scope = { attribute = draw, 0s = "red", 2s = "red!50" }
@@ -839,7 +880,7 @@ animate = {
\end{codeexample}
Next, we do the same, but ``in two steps'': First, we set the object to
-|my node|, but leave the attribute open and, then, set the attribute, but leave
+|mynode|, but leave the attribute open and, then, set the attribute, but leave
the object:
%
\begin{codeexample}[code only]
@@ -952,7 +993,10 @@ allows you to use a special syntax with nodes and scopes:
Let us have a look at some examples. First, we use the syntax to set the fill
opacity of a node:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node
:fill opacity = { 0s="1", 2s="0", begin on=click }
[fill = blue!20, draw = blue, ultra thick, circle] {Here!};
@@ -960,7 +1004,10 @@ opacity of a node:
%
Next, we additionally rotate the node:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node
:fill opacity = { 0s="1", 2s="0", begin on=click }
:rotate = { 0s="0", 2s="90", begin on=click }
@@ -971,7 +1018,10 @@ Note that there is no comma between consecutive uses of the colon syntax in
this case. We could have exchanged the order of the options and the uses of the
colon syntax:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node
:fill opacity = { 0s="1", 2s="0", begin on=click }
[fill = blue!20, draw = blue, ultra thick, circle]
@@ -980,7 +1030,10 @@ colon syntax:
We can also use the special syntax with the |\tikz| command itself:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz :fill opacity = { 0s="1", 2s="0", begin on=click }
:rotate = { 0s="0", 2s="90", begin on=click }
[ultra thick]
@@ -1254,7 +1307,10 @@ However, when an object inside the scope has its color set explicitly, this
color overrules the color of the scope.
\begin{tikzanimateattribute}{fill, draw}
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz :fill = {0s = "red", 2s = "blue", begin on = click}
[text = white, fill = orange ] {
\node [fill] at (0mm,0) {A};
@@ -1268,7 +1324,10 @@ color overrules the color of the scope.
The |text| attribute only applies to nodes and you need to directly animate
the |text| attribute of each node individually.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz [my anim/.style={ animate = {
myself:text = {0s = "red", 2s = "blue", begin on = click}}},
text = white, fill = orange ] {
@@ -1280,7 +1339,10 @@ color overrules the color of the scope.
Unlike the |fill| and |draw| colors, you cannot animate the |text| color
for scopes:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz [animate = {myself:text = {0s = "red", 2s = "blue",
begin on = click}},
text = white, fill = orange ] {
@@ -1303,7 +1365,10 @@ color overrules the color of the scope.
for drawing using the attributes |fill opacity| and |draw opacity|, which
are exactly the same as the usual \tikzname\ keys of the same names.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :fill opacity = { 0s="1", 2s="0", begin on=click }
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
@@ -1314,7 +1379,10 @@ color overrules the color of the scope.
which it is applied as a transparency group. In essence, ``this attribute
does what you want'' at least in most situations.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :opacity = { 0s="1", 2s="0", begin on=click }
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
@@ -1327,7 +1395,10 @@ color overrules the color of the scope.
rendered. The (only) two possible values for this attribute are |false| and
|true|.
%
-\begin{codeexample}[animation list={1,2,3,4}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={1,2,3,4},
+]
\tikz :visible = {begin on=click, 0s="false", 2s="false"}
\node (node) [fill = blue!20, draw = blue, very thick, circle] {Click me!};
\end{codeexample}
@@ -1340,7 +1411,11 @@ color overrules the color of the scope.
object ``enters'' the stage and ``leaves'' once more when it is no longer
``on stage''.
%
-\begin{codeexample}[animation list={-1,0,1,2,3},animation bb={(1.3,-0.7) rectangle (2.7,0.7)}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={-1,0,1,2,3},
+ animation bb={(1.3,-0.7) rectangle (2.7,0.7)},
+]
\tikz [animate = {example:stage = {
begin on = {click, of next=node},
0s="true", 2s="true" }}] {
@@ -1361,7 +1436,10 @@ since the animation attributes simply have that same names as the properties
that they animate and the syntax for setting is also the same:
\begin{tikzanimateattribute}{line width}
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :line width = { 0s="1pt", 2s="5mm", begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
@@ -1378,13 +1456,19 @@ that they animate and the syntax for setting is also the same:
identical. The interpolation of the values is done for each position of the
sequences individually, and also on the phase.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :dash = { 0s="on 10pt off 1pt phase 0pt",
2s="on 1pt off 10pt phase 0pt", begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :dash = { 0s="on 1cm off 1pt phase 0pt",
2s="on 1cm off 1pt phase 1cm", begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
@@ -1395,7 +1479,10 @@ that they animate and the syntax for setting is also the same:
also set, namely to the current dash pattern that is in force when the
animation is created.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :dash phase = { 0s="0pt", 2s="1cm", begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle, dashed] {Click me!};
\end{codeexample}
@@ -1408,7 +1495,10 @@ however, also animate the path itself:
\begin{tikzanimateattribute}{path}
When you animate a path, the values are, of course, paths themselves:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :path = {
0s = "{(0,-1) .. controls (0,0) and (0,0) .. (0,1) -- (1,1)}",
2s = "{(0,-1) .. controls (-1,0) and (-1,0) .. (-1,1) -- (.5,-1)}",
@@ -1432,7 +1522,10 @@ however, also animate the path itself:
example shows, where we used the fact that a circle consists of
four Bézier curves):
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :path = {
0s = "{(0,0) circle [radius=1cm]}",
2s = "{(0,0)
@@ -1505,7 +1598,11 @@ however, also animate the path itself:
Here is an example:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2},animation bb={(-0.1,-0.1) rectangle (1.1,1.1)}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+ animation bb={(-0.1,-0.1) rectangle (1.1,1.1)},
+]
\tikz [very thick] {
\node (node) at (-2,0)
[fill = blue!20, draw = blue, very thick, circle] {Click me!};
@@ -1540,7 +1637,10 @@ Let us start with the ``standard'' attributes that are also available as keys
in \tikzname:
\begin{tikzanimateattribute}{scale, xscale, yscale}
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :scale = { 0s="1", 2s="0.2", begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
@@ -1549,7 +1649,10 @@ in \tikzname:
\begin{tikzanimateattribute}{rotate}
The |rotate| key adds an animation of the rotation:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :rotate = { 0s="45", 2s="90", begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
@@ -1562,12 +1665,18 @@ in \tikzname:
The keys add an animation of the skew (given in degrees) or slant (given as
in the |xslant| and |yslant| key):
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :xskew = { 0s="0", 2s="45", begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :xslant = { 0s="-1", 2s="1", begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
@@ -1575,13 +1684,19 @@ in \tikzname:
\end{tikzanimateattribute}
\begin{tikzanimateattribute}{xshift, yshift}
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :shift = { 0s="{(0,0)}", 2s="{(5mm,-5mm)}",
begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :xshift = { 0s="0pt", 2s="5mm", begin on=click}
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
@@ -1593,7 +1708,10 @@ in \tikzname:
specify a sequence of coordinates in the same way as you would use the
|shift| key in \tikzname:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz \node :shift = { 0s = "{(0,0)}", 2s = "{(5mm,-5mm)}",
begin on = click }
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
@@ -1613,7 +1731,10 @@ in \tikzname:
fractions of the distance along the path. A value of |"0"| refers to
the beginning of the path and |"1"| refers to the end:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,1.2);
\draw (1,.5) circle [radius=1mm];
@@ -1631,7 +1752,10 @@ in \tikzname:
use |sloped|, the object will be continuously rotated so that it always
points along the path.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,1.2);
\draw (1,.5) circle [radius=1mm];
@@ -1655,7 +1779,10 @@ right'', where is ``the right''? By default, movements and transformations like
which defaults to the local coordinate system of the to-be-animated object.
Consider the following example:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,2.2);
\node :rotate = { 0s="0", 2s="45", begin on=click}
@@ -1674,7 +1801,10 @@ system, which is at |(1,1)| in the picture's coordinate system.
Let us, by comparison, do a rotation of a scope surrounding the node where the
origin is not (yet) shifted:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,2.2);
\scoped :rotate = { 0s="0", 2s="45", begin on={click, of next=n} }
@@ -1695,7 +1825,10 @@ expect'', but you can modify it using the following keys:
|(1,1)| relative to the picture's origin and the |origin| key shifts it one
centimeter to the right.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,2.2);
\node :rotate = { 0s="0", 2s="45", begin on=click,
@@ -1724,7 +1857,10 @@ expect'', but you can modify it using the following keys:
transformation matrix), which can by numerically instable when you use
ill-conditioned transformations.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,2.2);
\node :xshift = { 0s="0cm", 2s="5mm", begin on=click,
@@ -1733,7 +1869,10 @@ expect'', but you can modify it using the following keys:
}
\end{codeexample}
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,2.2);
\node :xshift = { 0s="0cm", 2s="5mm", begin on=click,
@@ -1782,7 +1921,10 @@ coordinate system.
\begin{tikzanimateattribute}{position}
Compare the two animations, one with |:position|, one with |:shift|.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,1.2);
\draw (1,.5) circle [radius=1mm] (1.5,0) circle [radius=1mm];
@@ -1793,7 +1935,10 @@ coordinate system.
%
Compare this to a shift:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,1.2);
\draw (1,.5) circle [radius=1mm] (1.5,0) circle [radius=1mm];
@@ -1806,7 +1951,10 @@ coordinate system.
|:shift|, which is especially useful for specifying that a node ``travels''
between positions of the canvas:
%
-\begin{codeexample}[animation list={0.5,1,1.5,2}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2},
+]
\tikz {
\draw [help lines] (-0.2,-0.2) grid (2.2,1.2);
\draw (1,1) circle [radius=1mm] (1.5,0) circle [radius=1mm];
@@ -1839,10 +1987,14 @@ The final method of changing the transformation matrix is to animate a
using the |meet| or |slice| keys from the |views| library, see
Section~\ref{section-library-views}. You can then animate the view using
the |view| attribute. The values passed to the |entry| key follow the same
- syntax as the views in the view library (though you only animate the
+ syntax as the views in the |views| library (though you only animate the
to-be-viewed rectangle).
%
-\begin{codeexample}[animation list={0.5,1,1.5,2},animation bb={(1.1,-0.9) rectangle (2.9,0.9)}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations,views}},
+ animation list={0.5,1,1.5,2},
+ animation bb={(1.1,-0.9) rectangle (2.9,0.9)},
+]
\tikz [very thick] {
\node (node) [fill = blue!20, draw = blue, very thick, circle] {Click me!};
@@ -1879,7 +2031,10 @@ the to-be-animated attribute. The following keys allows you to change this:
A ``base'' value is a value that is used for the attribute whenever the
timeline is \emph{not} active:
%
-\begin{codeexample}[animation list = {0.5,1,1.5,2,2.5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list = {0.5,1,1.5,2,2.5},
+]
\tikz \node [fill = green, text = white] :fill =
{ 1s = "red", 2s = "blue", base = "orange", begin on = click }
{Click me};
@@ -1895,7 +2050,10 @@ the to-be-animated attribute. The following keys allows you to change this:
set the base. However, you can also use the |base| key in other ways; most
noticeably, you can use it \emph{after} some value:
%
-\begin{codeexample}[animation list = {0.5,1,1.5,2,2.5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list = {0.5,1,1.5,2,2.5},
+]
\tikz \node [fill = green, text = white] :fill =
{ 1s = {"red" = base}, 2s = "blue", begin on = click }
{Click me};
@@ -1905,7 +2063,10 @@ the to-be-animated attribute. The following keys allows you to change this:
the quotes of a value. This is particularly useful for setting up a base
value that is also used in a timeline:
%
-\begin{codeexample}[animation list = {0.5,1,1.5,2,2.5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list = {0.5,1,1.5,2,2.5},
+]
\tikz \node [fill = green, text = white] :fill =
{ 1s = "red" base, 2s = "blue", begin on = click }
{Click me};
@@ -1918,12 +2079,18 @@ the to-be-animated attribute. The following keys allows you to change this:
with the last value. You can also think of this as having the animation
``freeze'' at the end.
%
-\begin{codeexample}[animation list = {0.5,1,1.5,2,2.5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list = {0.5,1,1.5,2,2.5},
+]
\tikz \node :fill = { 1s="red", 2s="blue", forever, begin on=click}
[fill = green!50!black, text = white] {Click me};
\end{codeexample}
%
-\begin{codeexample}[animation list = {0.5,1,1.5,2,2.5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list = {0.5,1,1.5,2,2.5},
+]
\tikz \node [fill = green!50!black, text = white]
:fill = { 1s = "red", 2s = "blue", begin on = click }
{Click me};
@@ -1968,7 +2135,7 @@ to these questions.
will run, relative to the moment when the graphic is displayed from 3\,s to
4\,s.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{animations}}]
\tikz \node [fill = green!50!black, text = white]
:rotate = { 1s = "0", 5s = "90", begin = 2s, end = 4s }
{Click me};
@@ -2005,7 +2172,7 @@ the moment a specific \emph{event} happens using the following key:
referenced object is the node with the label |2| since it is the most
recently referenced node with \meta{id} |X|.
%
-\begin{codeexample}[width=3cm]
+\begin{codeexample}[width=3cm,preamble={\usetikzlibrary{animations}}]
\tikz [very thick] {
\node (X) at (1,1.2) [fill = blue!20, draw = blue, circle] {1};
\node (X) at (1,0.4) [fill = orange!20, draw = orange, circle] {2};
@@ -2021,7 +2188,7 @@ the moment a specific \emph{event} happens using the following key:
the next) object with the given \meta{id}, not to a previous one. This,
in the next example, the referenced node is the one with label |3|.
%
-\begin{codeexample}[width=3cm]
+\begin{codeexample}[width=3cm,preamble={\usetikzlibrary{animations}}]
\tikz [very thick] {
\node (X) at (1,1.2) [fill = blue!20, draw = blue, circle] {1};
\node (X) at (1,0.4) [fill = blue!20, draw = blue, circle] {2};
@@ -2050,7 +2217,7 @@ the moment a specific \emph{event} happens using the following key:
when the user clicks on the triggering object with a mouse (or
something equivalent).
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node :rotate = { 0s="0", 2s="90", begin on = {click}}
[fill = blue!20, draw = blue, circle, ultra thick] {Here!};
\end{codeexample}
@@ -2060,7 +2227,7 @@ the moment a specific \emph{event} happens using the following key:
Shorthand for |event=mousedown|. The event gets triggered when the
user presses a mouse button down on the object.
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node :rotate = { 0s="0", 2s="90", begin on = {mouse down}}
[fill = blue!20, draw = blue, circle, ultra thick] {Here!};
\end{codeexample}
@@ -2070,7 +2237,7 @@ the moment a specific \emph{event} happens using the following key:
Shorthand for |event=mouseup| and gets triggered, of course, when a
pressed button is released on the object.
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node :rotate = { 0s="0", 2s="90", begin on = {mouse up} }
[fill = blue!20, draw = blue, circle, ultra thick] {Here!};
\end{codeexample}
@@ -2080,7 +2247,7 @@ the moment a specific \emph{event} happens using the following key:
Shorthand for |event=mouseover|. The event gets triggered the
moment the mouse cursor moves over the object.
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node :rotate = { 0s="0", 2s="90", begin on = {mouse over} }
[fill = blue!20, draw = blue, circle, ultra thick] {Here!};
\end{codeexample}
@@ -2091,7 +2258,7 @@ the moment a specific \emph{event} happens using the following key:
times, namely each time the mouse moves while being ``over'' the
object.
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node :rotate = { 0s="0", 2s="90", begin on = {mouse move} }
[fill = blue!20, draw = blue, circle, ultra thick] {Here!};
\end{codeexample}
@@ -2101,7 +2268,7 @@ the moment a specific \emph{event} happens using the following key:
Shorthand for |event=mouseout|. The opposite of |mouse over|:
triggered when the mouse leaves the object.
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node :rotate = { 0s="0", 2s="90", begin on = {mouse out} }
[fill = blue!20, draw = blue, circle, ultra thick] {Here!};
\end{codeexample}
@@ -2113,7 +2280,7 @@ the moment a specific \emph{event} happens using the following key:
|of whom|. This means that the current animation will begin when
some other animation begins.
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node [animate = {
myself:rotate = { 0s="0", 2s="90", begin on = {begin, of next=anim}},
myself:xshift = { 0s="0mm", 2s="5mm", begin on = {click}, name=anim}
@@ -2128,7 +2295,7 @@ the moment a specific \emph{event} happens using the following key:
This means that the current animation will \emph{begin} when some
other animation \emph{ends}.
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node [animate = {
myself:rotate = { 0s="0", 2s="90", begin on = {end, of next=anim}},
myself:xshift = { 0s="0mm", 2s="5mm", begin on = {click}, name=anim }
@@ -2156,11 +2323,14 @@ the moment a specific \emph{event} happens using the following key:
\meta{number} times.
%
\begin{codeexample}[
- animation list={
- 0.333/\frac{1}{3},0.666/\frac{2}{3},1,
- 1.333/1\frac{1}{3},1.666/1\frac{2}{3},2,
- 2.333/2\frac{1}{3},2.666/2\frac{2}{3},3,
- 3.333/2\frac{1}{3},3.666/2\frac{2}{3},4}]
+ preamble={\usetikzlibrary{animations}},
+ animation list={
+ 0.333/\frac{1}{3},0.666/\frac{2}{3},1,
+ 1.333/1\frac{1}{3},1.666/1\frac{2}{3},2,
+ 2.333/2\frac{1}{3},2.666/2\frac{2}{3},3,
+ 3.333/2\frac{1}{3},3.666/2\frac{2}{3},4%
+ },
+]
\tikz
\node [animate = { myself: = {
:rotate = { 0s="0", 2s="90", begin on = {repeat = 2, of next = anim },
@@ -2200,7 +2370,7 @@ should happen:
\item |false| means that once the animation has started once, it will
never be restarted.
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node :rotate = { 0s="0", 2s="90",
restart = false, begin on = {click}}
[fill = blue!20, draw = blue, circle, ultra thick] {Here!};
@@ -2210,7 +2380,7 @@ should happen:
\item |when not active| means that the animation will restart when the
event is triggered, but \emph{not} while the animation is running.
%
-\begin{codeexample}[width=2cm]
+\begin{codeexample}[width=2cm,preamble={\usetikzlibrary{animations}}]
\tikz \node :rotate = { 0s="0", 2s="90",
restart = when not active, begin on = {click}}
[fill = blue!20, draw = blue, circle, ultra thick] {Here!};
@@ -2237,7 +2407,10 @@ the |end on| allows you to stop is early when some event happens:
\begin{itemize}
\item Empty, in which case the timeline repeats forever.
%
-\begin{codeexample}[animation list={1,2,3,4,5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={1,2,3,4,5},
+]
\tikz \node :rotate = { 0s = "0", 2s = "90",
repeats, begin on = click }
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
@@ -2246,7 +2419,10 @@ the |end on| allows you to stop is early when some event happens:
\item A \meta{number} (like |2| or |3.25|), in which case the timeline
repeats \meta{number} times.
%
-\begin{codeexample}[animation list={1,2,3,4,5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={1,2,3,4,5},
+]
\tikz \node :rotate = { 0s = "0", 2s = "90",
repeats = 1.75, begin on = click }
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
@@ -2256,7 +2432,10 @@ the |end on| allows you to stop is early when some event happens:
which case the timeline repeats however often necessary so that it
stops exactly after \meta{time}.
%
-\begin{codeexample}[animation list={1,2,3,4,5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={1,2,3,4,5},
+]
\tikz \node :rotate = { 0s = "0", 2s = "90",
repeats = for 3.5s, begin on = click }
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
@@ -2278,13 +2457,19 @@ the |end on| allows you to stop is early when some event happens:
jump back, and so on for five times. In contrast, when the repeats
are accumulating, the scope will move by 5\,cm over 5\,s in total.
%
-\begin{codeexample}[animation list={1,2,3,4,5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={1,2,3,4,5},
+]
\tikz \node :rotate = { 0s = "0", 2s = "90", begin on = click,
repeats = accumulating }
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
\end{codeexample}
%
-\begin{codeexample}[animation list={1,2,3,4,5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={1,2,3,4,5},
+]
\tikz \node :rotate = { 0s = "0", 2s = "90", begin on = click,
repeats = for 4s accumulating }
[fill = blue!20, draw = blue, ultra thick, circle] {Click me!};
@@ -2354,7 +2539,10 @@ entry control={0.9}{1},
start position, then a smooth arrival at the end position, and, finally
both.
%
-\begin{codeexample}[animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}},
+]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
@@ -2365,7 +2553,10 @@ entry control={0.9}{1},
}
\end{codeexample}
-\begin{codeexample}[animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}},
+]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
@@ -2376,7 +2567,10 @@ entry control={0.9}{1},
}
\end{codeexample}
-\begin{codeexample}[animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}},
+]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
@@ -2409,7 +2603,10 @@ entry control={0.9}{1},
key with an animation having only two times is particularly easy, since we
only need to set |ease| once:
%
-\begin{codeexample}[animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.333/\frac{1}{3},0.666/\frac{2}{3},1,1.333/1\frac{1}{3},1.666/1\frac{2}{3}},
+]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click, ease, 0s = "0cm", 2s = "-10mm" }
@@ -2428,7 +2625,10 @@ from one value to the next. There are two keys for this:
value. This is similar to an exit control where the curve is ``infinitely
flat''.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2,2.5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2,2.5},
+]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
@@ -2446,7 +2646,10 @@ from one value to the next. There are two keys for this:
value right at the beginning of the time interval. It is similar to an
entry control specifying a ``flat'' curve.
%
-\begin{codeexample}[animation list={0.5,1,1.5,2,2.5}]
+\begin{codeexample}[
+ preamble={\usetikzlibrary{animations}},
+ animation list={0.5,1,1.5,2,2.5},
+]
\tikz {
\foreach \i in {0,0.1,...,1} \draw (-0.9,.9-\i) -- ++(1.8,0);
\node :yshift = { begin on = click,
@@ -2481,7 +2684,7 @@ animation at different points in time and which can then be inserted alongside
each other into the printed document. This approach has been used with the
examples of animations in this manual.
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{animations}}]
\foreach \t in {0.5, 1, 1.5, 2}
\tikz [make snapshot of = \t]
\fill :fill = {0s="black", 2s="red"} (0,0) circle [radius = 5mm];
@@ -2498,7 +2701,7 @@ Creating snapshots is done using the following key:
computation match the computations done by viewer applications as best as
possible).
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{animations}}]
\tikz [make snapshot of = 1s] {
\fill :fill = { 0s = "black", 2s = "white" } (0,0) rectangle ++(1,1);
\fill :fill = { 1s = "black", 3s = "white" } (2,0) rectangle ++(1,1);
@@ -2522,7 +2725,7 @@ Creating snapshots is done using the following key:
Computationally, for the timeline the \meta{start time} is subtracted
from the snapshot's \meta{time} when the value needs to be determined:
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{animations}}]
\tikz [make snapshot of = 1s] {
\fill :fill = { 0s = "black", 2s = "white",
begin snapshot = 1s } (0,0) rectangle ++(1,1);
@@ -2565,7 +2768,7 @@ Creating snapshots is done using the following key:
the timeline, while this key would not apply the animation at all (it has
already ended at time $t + \epsilon$).
%
-\begin{codeexample}[]
+\begin{codeexample}[preamble={\usetikzlibrary{animations}}]
\tikz [make snapshot of = 2s]
\fill :fill = { 0s = "green", 2s = "red" } (0,0) rectangle ++(1,1);
\tikz [make snapshot after = 2s]