Debian Codegraph @

texmf-dist/doc/generic/pgf/pgfmanual-en-pgfsys-animations.tex

raw
1 % Copyright 2019 by Till Tantau
2 %
3 % This file may be distributed and/or modified
4 %
5 % 1. under the LaTeX Project Public License and/or
6 % 2. under the GNU Free Documentation License.
7 %
8 % See the file doc/generic/pgf/licenses/LICENSE for more details.
9
10
11 \section{Animation System Layer}
12 \label{section-pgfsys-anim}
13
14 \begin{codeexample}[setup code,hidden]
15 \makeatletter
16
17 \def\animationexample#1#2#3{%
18 \tikz[fill=blue!25, draw=blue, ultra thick] {
19 \pgfidrefnextuse{\objid}{#1}
20 \pgfsysanimkeywhom{\objid}{#2}
21 \pgfidrefnextuse{\nodeid}{node}
22 \pgfsysanimkeyevent{\nodeid}{}{click}{}{begin}
23 #3
24 \node [font=\footnotesize, circle, fill, draw, align=center]
25 (node) {Click \\ here};
26 }%
27 }
28 \end{codeexample}
29
30 In conjunction with the right output format (namely \textsc{svg}), you can
31 specify that certain parts of you graphics can be animated. For this, there are
32 a number of commands that cover, currently, what \textsc{svg 1.1} can do
33 regarding animations. For a detailed introduction to animations, please see
34 Section~\ref{section-base-animations}; the current section assumes that you are
35 familiar with the concepts explained there.
36
37 The animation system consists of two layer itself: Commands starting with
38 |\pgfsys@anim...| and commands starting with |\pgfsysanim|. These work as
39 follows:
40 %
41 \begin{enumerate}
42 \item The commands starting with |\pgfsys@anim...| insert the actual
43 animation commands into the output stream. A driver must implement
44 these commands.
45 \item The command starting with |\pgfsysanim...| provide an. These
46 commands, which are the ones that should be called by higher layers,
47 implement the snapshot mechanism: When the command
48 |\pgfsysanimsnapshot| is used, the |\pgfsysanim...| commands do
49 \emph{not} call the |\pgfsys@anim...| commands but, instead, insert
50 non-animation commands to show the values of the attributes at the
51 snapshot's time. To use this abstraction layer, you have to load the
52 file |pgfsysanimations.code.tex|, which is not loaded by default (but
53 is loaded by the \pgfname\ module |animations|).
54 \end{enumerate}
55
56 The bottom line is that if you wish to implement a new driver, you need to
57 implement the |\pgfsys@anim...| commands, if you use the animation layer, you
58 call the |\pgfsysanim...| commands.
59
60
61 \subsection{Animations and Snapshots}
62
63 To add an animation to a graphic, use the following command (as described
64 above, the first command is the one you actually call, the second is the one a
65 driver implements):
66
67 \begin{command}{\pgfsysanimate\marg{attribute}}
68 \end{command}
69
70 \begin{command}{\pgfsys@animate\marg{attribute}}
71 The system layer animation subsystem follows the following philosophy: An
72 animation always concerns an \emph{attribute} of a \emph{graphic object}. A
73 \emph{timeline} specifies how the attribute changes its value over time.
74 Finally, a set of \emph{keys} configures the animation as a whole like
75 whether the timeline repeats or a event that triggers the start of the
76 animation. The four parts of an animation, namely the \emph{attribute}, the
77 \emph{graphic object}, the \emph{timeline}, and the \emph{keys}, are
78 specified in different ways:
79 %
80 \begin{enumerate}
81 \item You choose the \emph{attribute} using the system layer command
82 |\pgfsysanimate|.
83 \item The \emph{graphic object} whose attribute is to be animated is
84 \emph{always} specified by naming the ID of the graphic object
85 \emph{before} this object is created, see
86 Section~\ref{section-sys-id}. (However, in the context of
87 \tikzname, it suffices that the animation is given in the object's
88 options since these are executed before the actual object is
89 created).
90 \item The \emph{timeline} is specified using the commands
91 |\pgfsysanimkeytime|, which specifies a time in seconds, and
92 |\pgfsys@animation@val...|, which specify a value at this
93 particular time. The timeline specifies for a sequence of times the
94 values the attribute will have at these times. In between these
95 \emph{key times,} the value is interpolated.
96 \item The \emph{animation keys} are specified by commands starting
97 |\pgfsys@animation@...| and have the following effect: They set
98 some property (like, say, whether the animation repeats or whether
99 its effect is additive) to a given value \emph{for the current
100 \TeX\ scope,} but do not create any animations. Rather, when
101 |\pgfsysanimate| is called, a snapshot of the current values of all
102 animation keys is taken and added to this animation of the
103 attribute.
104
105 When you set an animation key to a value, this will replace the
106 value previously stored for the key (all keys are empty by default
107 at the beginning).
108
109 Note that animation keys are local to \TeX\ scopes, not graphics
110 scopes; indeed, they have little to do with the settings of the
111 graphics scope other than the fact that a graphic scope is also a
112 \TeX\ scope and thereby influence the values of these keys.
113 \end{enumerate}
114
115 A typical example of how all of this works is the following:
116 %
117 \begin{codeexample}[code only]
118 \pgfsysanimkeyrepeatindefinite % Both of the following animations
119 % repeat indefinitely
120 {
121 \pgfsysanimkeywhom{\someid}{}% The id of a later object
122 \pgfsysanimkeyevent{}{}{click}{0}{begin}% Begin on a click ...
123 \pgfsysanimkeytime{5}{1}{1}{0}{0} % Timeline starts after 5s
124 \pgfsysanimvalscalar{0} % With a value of 0
125 \pgfsysanimkeytime{8}{1}{1}{0}{0} % Timeline ends after 8s
126 \pgfsysanimvalscalar{0.9} % With a value of 0.9
127 \pgfsysanimate{fillopacity}% ... and the attribute is the fill opacity
128 }
129 {
130 \pgfsysanimkeywhom{\someid}{}% The id of a later object
131 \pgfsysanimkeyoffset{0}{begin}% Begin right away ...
132 \pgfsysanimkeytime{1}{1}{1}{0}{0} % Timeline starts after 1s
133 \pgfsysanimvalcurrent % With the current value
134 \pgfsysanimkeytime{5}{1}{1}{0}{0} % Timeline ends after 5s
135 \pgfsysanimvaldimension{5pt} % With a value of 5pt
136 \pgfsysanimate{linewidth}% ... and the attribute is the line width
137 }
138 \end{codeexample}
139 %
140 As a real-life example, consider the following definitions, which will be
141 used in many examples in the rest of this section: Both take three
142 parameters: The \pgfname/\tikzname\ name of a to-be animated object, a type
143 (relevant for objects that have subtypes or parts), and some code for
144 triggering the actual animation. The animation will always start when the
145 button is clicked. The second macro sets up things in such a way that the
146 animation will last two seconds, while the first leaves the timing open.
147 %
148 \begin{codeexample}[code only]
149 \def\animationexample#1#2#3{
150 \tikz[fill=blue!25, draw=blue, ultra thick] {
151 \pgfidrefnextuse{\objid}{#1}
152 \pgfsysanimkeywhom{\objid}{#2}
153 \pgfidrefnextuse{\nodeid}{node}
154 \pgfsysanimkeyevent{\nodeid}{}{click}{}{begin}
155 #3
156 \node [font=\scriptsize, circle, fill, draw, align=center]
157 (node) {Click \\ here};
158 }
159 }
160 \end{codeexample}
161 %
162 Now the example, where the circle will disappear, when clicked:
163 %
164 \begin{codeexample}[
165 preamble={\usetikzlibrary{animations}},
166 animation list={0.5,1,1.5,2}]
167 \animationexample{node}{}{
168 \pgfsysanimkeytime{0}{1}{1}{0}{0}
169 \pgfsysanimvalscalar{1}
170 \pgfsysanimkeytime{2}{1}{1}{0}{0}
171 \pgfsysanimvalscalar{0}
172 \pgfsysanimate{opacity}
173 }
174 \end{codeexample}
175 %
176 \end{command}
177
178 The ``opposite'' of |\pgfsysanimate| is the following command:
179
180 \begin{command}{\pgfsysanimsnapshot\marg{time}}
181 Use this command in a scope prior to calling any other commands documented
182 in this section concerning the configuration of animations. In this case,
183 all uses of |\pgfsysanimate| inside the \TeX\ scope no longer insert an
184 animation into the output file. Instead, a ``snapshot'' is inserted of what
185 the animation ``would like at time \meta{time}''. For instance, if an
186 animation inserts a movement of an object by 4cm over a time of 2s and you
187 take a snapshot with $\meta{time} = 2\mathrm s$, you get a picture in which
188 the object is moved by 1cm.
189
190 A lot of care has been taken to make the output produced by the snapshot be
191 as close as possible as what the animation really would look like at time
192 \meta{time}, but note the following restrictions:
193 %
194 \begin{enumerate}
195 \item Interactive events of all kinds (like |click| or |mouseover|)
196 make little sense for snapshots, which are created once and for all
197 during the typesetting of the document. For this reason, all events
198 are ignored for snapshots (even sync bases, and |begin| and |end|
199 events, which might make some sense also in a snapshot setting).
200
201 However, there is one command which helps you with ``simulating''
202 the effect of events:
203 %
204 \begin{command}{\pgfsysanimkeysnapshotstart\marg{time offset}}
205 This command specifies that for the current animation the
206 ``moment |0s|'' of the timeline is at \meta{time offset}. Thus,
207 it works like |\pgfsysanimkeyoffset|, only the offset is now
208 solely for the snapshot timeline. It has no effect on the
209 actual animation.
210 \end{command}
211 %
212 \item The command |\pgfsysanimvalcurrent| cannot be used with snapshots
213 since \pgfname\ has no chance of computing the correct current
214 value. You always have to specify the start value explicitly.
215 \item The computation of time splines (entry and exit splines) and the
216 accumulation of values after a large number of repeats may not be
217 numerically stable.
218 \end{enumerate}
219 %
220 \begin{codeexample}[width=5cm,preamble={\usetikzlibrary{animations}}]
221 \foreach \t in {0.5,1,1.5,2} {
222 \pgfsysanimsnapshot{\t}
223 \tikz {
224 \pgfidrefnextuse{\objid}{node}
225 \pgfsysanimkeywhom{\objid}{}
226 \pgfsysanimkeytime{0}{1}{1}{0}{0}
227 \pgfsysanimvalscalar{1}
228 \pgfsysanimkeytime{2}{1}{1}{0}{0}
229 \pgfsysanimvalscalar{0}
230 \pgfsysanimate{opacity}
231 \node (node) [draw = blue, very thick, fill=blue!20, circle] {Hi};
232 }
233 }
234 \end{codeexample}
235 %
236 \end{command}
237
238 \begin{command}{\pgfsysanimsnapshotafter\marg{time}}
239 Works like the previous command, only the ``moment'' that \meta{time}
240 refers to is conceptually $\meta{time} + \epsilon$: When timeline specifies
241 several values for \meta{time}, this command will select the last value at
242 \meta{time}, while |\pgfsnapshot| will select the first value at
243 \meta{time}. Similarly, when a timeline ends at \meta{time}, |\pgfsnapshot|
244 will select the last value of the timeline while |\pgfsnapshotafter| will
245 not apply the animation any more.
246 \end{command}
247
248
249 \subsection{Commands for Animating an Attribute: Color, Opacity, Visibility, Staging}
250
251 The commands from this and the next sections specify that some attribute should
252 be animated. We start with rather basic animation attributes for color,
253 visibility, and opacity.
254
255 \begin{sysanimateattribute}{opacity}
256 Adds an animation of the opacity to the graphic object specified using
257 |\pgfsysanimkeywhom|. If the driver supports this, this is a bit different
258 from animating the fill and stroke opacities individually: Paths are
259 treated as transparency groups for this key. Typically, ``this is what you
260 want''.
261
262 Specify values with |\pgfsysanimvalscalar|.
263 %
264 \begin{codeexample}[
265 preamble={\usetikzlibrary{animations}},
266 animation list={0.5,1,1.5,2},
267 ]
268 \animationexample{node}{}{
269 \pgfsysanimkeytime{0}{1}{1}{0}{0}
270 \pgfsysanimvalscalar{1}
271 \pgfsysanimkeytime{2}{1}{1}{0}{0}
272 \pgfsysanimvalscalar{0}
273 \pgfsysanimate{opacity}
274 }
275 \end{codeexample}
276 %
277 \end{sysanimateattribute}
278
279 \begin{sysanimateattribute}{fillopacity}
280 Adds an animation of only the opacity of fill operations.
281
282 Specify values with |\pgfsysanimvalscalar|.
283 %
284 \begin{codeexample}[
285 preamble={\usetikzlibrary{animations}},
286 animation list={0.5,1,1.5,2},
287 ]
288 \animationexample{node}{}{
289 \pgfsysanimkeytime{0}{1}{1}{0}{0}
290 \pgfsysanimvalscalar{1}
291 \pgfsysanimkeytime{2}{1}{1}{0}{0}
292 \pgfsysanimvalscalar{0}
293 \pgfsysanimate{fillopacity}
294 }
295 \end{codeexample}
296 %
297 \end{sysanimateattribute}
298
299 \begin{sysanimateattribute}{strokeopacity}
300 Adds an animation of only the opacity of draw (stroke) operations.
301
302 Specify values with |\pgfsysanimvalscalar|.
303 %
304 \begin{codeexample}[
305 preamble={\usetikzlibrary{animations}},
306 animation list={0.5,1,1.5,2},
307 ]
308 \animationexample{node}{}{
309 \pgfsysanimkeytime{0}{1}{1}{0}{0}
310 \pgfsysanimvalscalar{1}
311 \pgfsysanimkeytime{2}{1}{1}{0}{0}
312 \pgfsysanimvalscalar{0}
313 \pgfsysanimate{strokeopacity}
314 }
315 \end{codeexample}
316 %
317 \end{sysanimateattribute}
318
319 \begin{sysanimateattribute}{visibility}
320 Adds an animation of the ``visibility''.
321
322 Specify values with |\pgfsysanimvaltext|. However, only two values are
323 allowed: |visible| and |hidden|.
324 %
325 \begin{codeexample}[
326 preamble={\usetikzlibrary{animations}},
327 animation list={-1,0,1,2,3},
328 ]
329 \animationexample{node}{}{
330 \pgfsysanimkeytime{0}{1}{1}{0}{0}
331 \pgfsysanimvaltext{hidden}
332 \pgfsysanimkeytime{2}{1}{1}{0}{0}
333 \pgfsysanimvaltext{hidden}
334 \pgfsysanimate{visibility}
335 }
336 \end{codeexample}
337 %
338 \end{sysanimateattribute}
339
340 \begin{sysanimateattribute}{strokecolor}
341 Adds an animation of the stroke color.
342
343 Specify values with |\pgfsysanimvalcolorrgb| and friends.
344 %
345 \begin{codeexample}[
346 preamble={\usetikzlibrary{animations}},
347 animation list={0.5,1,1.5,2},
348 ]
349 \animationexample{node}{}{
350 \pgfsysanimkeytime{0}{1}{1}{0}{0}
351 \pgfsysanimvalcolorrgb{0}{0}{0}
352 \pgfsysanimkeytime{2}{1}{1}{0}{0}
353 \pgfsysanimvalcolorrgb{1}{0}{0}
354 \pgfsysanimate{strokecolor}
355 }
356 \end{codeexample}
357 %
358 \end{sysanimateattribute}
359
360 \begin{sysanimateattribute}{fillcolor}
361 Adds an animation of the fill color.
362
363 Specify values with |\pgfsysanimvalcolorrgb| and friends.
364 %
365 \begin{codeexample}[
366 preamble={\usetikzlibrary{animations}},
367 animation list={0.5,1,1.5,2},
368 ]
369 \animationexample{node}{}{
370 \pgfsysanimkeytime{0}{1}{1}{0}{0}
371 \pgfsysanimvalcolorrgb{0}{0}{0}
372 \pgfsysanimkeytime{2}{1}{1}{0}{0}
373 \pgfsysanimvalcolorrgb{1}{0}{0}
374 \pgfsysanimate{fillcolor}
375 }
376 \end{codeexample}
377 %
378 \end{sysanimateattribute}
379
380
381 \subsection{Commands for Animating an Attribute: Paths and Their Rendering}
382
383 The following attributes influence paths and how they are rendered.
384
385 \begin{sysanimateattribute}{path}
386 Adds an animation of the path itself. That means that the path will morph
387 its form from one path to another. When morphing a path, all ``values'',
388 which are the paths, must consist of the \emph{exact same} path
389 construction commands; they may only differ with respect to the numbers
390 used in these descriptions.
391
392 Specify values with |\pgfsysanimvalpath|.
393 %
394 \begin{codeexample}[
395 preamble={\usetikzlibrary{animations}},
396 animation list={0.5,1,1.5,2},
397 animation bb={(0.9,-0.1)rectangle(2.1,1.1)},
398 ]
399 \animationexample{my path}{path}{
400 \pgfsysanimkeytime{0}{1}{1}{0}{0}
401 \pgfsysanimvalpath{\pgfsys@moveto{1cm}{0cm}%
402 \pgfsys@lineto{1cm}{1cm}%
403 \pgfsys@lineto{2cm}{0cm}}
404 \pgfsysanimkeytime{2}{1}{1}{0}{0}
405 \pgfsysanimvalpath{\pgfsys@moveto{1cm}{1cm}%
406 \pgfsys@lineto{2cm}{1cm}%
407 \pgfsys@lineto{1cm}{0cm}}
408 \pgfsysanimate{path}
409 \filldraw [ultra thick,draw=blue,fill=blue!20, name=my path]
410 (1,0) -- (1,1) -- (2,0); }
411 \end{codeexample}
412
413 You can attach arrow tips to paths that are animated and these arrow tips
414 will correctly ``rotate and move along'' with the path's end points
415 \emph{if} you take the following points into considerations:
416 %
417 \begin{itemize}
418 \item Arrow tips that ``rotate and move along'' with a path must be
419 specified using a special animation command, see below. The normal
420 arrow tips added to a path would \emph{not} be animated
421 automatically and, indeed, if you add arrow tips to a path using
422 |\pgfsetarrows| and then animate the path, you will get an error
423 message.
424 \item Internally, the arrow tips that ``rotate and move along'' are
425 drawn using so-called \emph{markers}. These are little graphic
426 objects that can be added to the start and end of paths and that
427 are automatically rotated and move along with the path.
428
429 In principle, the rendering rules used by \textsc{svg} for markers
430 are the same as for normal arrow tips: The markers are rotated and
431 moved so that the point along a tangent of the path at the start or
432 end of the path. However, when it comes to special cases such as a
433 path with multiple segments, a path with degenerate segments, a
434 closed path, and so on, the rules used by for instance \textsc{svg}
435 may differ from the placement that \pgfname\ will compute.
436
437 Thus, it is best to add arrow tips only to ``normal'' paths
438 consisting of a single open path segment whose ends can be
439 shortened a bit without causing degeneration.
440 \item When an arrow tip is added to a path, the path must typically be
441 shortened a bit so that the \emph{tip} of the arrow ends where the
442 path would usually end. This shortening is not done by the system
443 layer for to-be-animated paths; you must compute and then animate
444 these shortened paths yourself. (However, the basic layer animation
445 module will do this for you, so you only have to worry about this
446 when you use the system layer directly.)
447 \end{itemize}
448
449 Let us now have a look at how we add arrow tip markers:
450 %
451 \begin{command}{\pgfsysanimkeytipmarkers\marg{start marker}\marg{end marker}}
452 \end{command}
453 %
454 \begin{command}{\pgfsys@animation@tip@markers\marg{start marker}\marg{end marker}}
455 This command specifies that during a path animation the two markers
456 provided as parameters should be added (and rotated and moved along
457 with the path) at the start and end. The \meta{start marker} must
458 either be empty (in which case no marker is added at the start) or it
459 must be a macro storing a value returned by the command
460 |\pgfsys@marker@declare|. In this case, the marker declared symbol will
461 be added to the start during the animation. The same situation applies
462 to the end of the path.
463
464 As pointed out earlier, only arrow tips / markers added to paths using
465 this command will be animated along with the path. In particular, you
466 should \emph{not} add arrow tips to to-be-animated paths using
467 |\pgfsetarrow|. However, when you use a base value
468 (|\pgfsys@animation@base|) to set a path, the arrow tips will also be
469 added to this base path.
470
471 To sum up, the ``correct'' way of adding arrow tips to a path that is
472 animated is to proceed as follows:
473 %
474 \begin{enumerate}
475 \item You specify arrow tips for a path using this command.
476 \item You specify times and values of the to-be-animated path,
477 shortened as necessary to accommodate the length of the arrow
478 tips.
479 \item You specify the first (or, possibly, some other) value in the
480 time--value sequence as a base value.
481 \item You create a path animation that applies to a future path.
482 \item You create this future path as an empty path without arrow
483 tips and draw it. Because of the setting of the base value,
484 instead of the empty path the base path will be used as the
485 ``real'' path and the animation's arrow tips will be added as
486 arrow tips.
487 \end{enumerate}
488
489 When you have more than one animation for a given path, these different
490 animations may use different arrow tips / markers. This allows you to
491 animate (change) which arrow tip is used on a path over time.
492 %
493 \begin{codeexample}[
494 preamble={\usetikzlibrary{animations}},
495 animation list={0.5,1,1.5,2},
496 animation bb={(0.7,-0.3)rectangle(2.3,1.3)},
497 ]
498 % Declare a marker:
499 \pgfsys@marker@declare\mymarker{%
500 \pgfscope%
501 \pgfsetcolor{red!75}%
502 \pgfpathmoveto{\pgfpoint{0pt}{5pt}}\pgfpathlineto{\pgfpoint{8pt}{0pt}}%
503 \pgfpathlineto{\pgfpoint{0pt}{0pt}}\pgfpathclose%
504 \pgfusepathqfill%
505 \endpgfscope%
506 \pgfpathmoveto{\pgfpoint{0pt}{5pt}}\pgfpathlineto{\pgfpoint{8pt}{0pt}}%
507 \pgfpathlineto{\pgfpoint{0pt}{-5pt}}\pgfpathclose%
508 \pgfusepathqstroke%
509 }%
510 \animationexample{my path}{path}{
511 \pgfsysanimkeytipmarkers{\mymarker}{\mymarker}
512 \pgfsysanimkeybase
513 \pgfsysanimvalpath{\pgfsys@moveto{1cm}{0cm}%
514 \pgfsys@lineto{1cm}{1cm}%
515 \pgfsys@lineto{2cm}{0cm}}
516 \pgfsysanimkeytime{0}{1}{1}{0}{0}
517 \pgfsysanimvalpath{\pgfsys@moveto{1cm}{0cm}%
518 \pgfsys@lineto{1cm}{1cm}%
519 \pgfsys@lineto{2cm}{0cm}}
520 \pgfsysanimkeytime{2}{1}{1}{0}{0}
521 \pgfsysanimvalpath{\pgfsys@moveto{1cm}{1cm}%
522 \pgfsys@lineto{2cm}{1cm}%
523 \pgfsys@lineto{1cm}{0cm}}
524 \pgfsysanimate{path}
525 \filldraw [ultra thick,draw=blue,fill=blue!20, name=my path];
526 \path (1,0) (2,1);}
527 \end{codeexample}
528 \end{command}
529 \end{sysanimateattribute}
530
531 \begin{sysanimateattribute}{linewidth}
532 Adds an animation of the line width.
533
534 Specify values with |\pgfsysanimvaldimension|.
535 %
536 \begin{codeexample}[
537 preamble={\usetikzlibrary{animations}},
538 animation list={0.5,1,1.5,2},
539 ]
540 \animationexample{node}{}{
541 \pgfsysanimkeytime{0}{1}{1}{0}{0}
542 \pgfsysanimvaldimension{1pt}
543 \pgfsysanimkeytime{2}{1}{1}{0}{0}
544 \pgfsysanimvaldimension{10pt}
545 \pgfsysanimate{linewidth}
546 }
547 \end{codeexample}
548 %
549 \end{sysanimateattribute}
550
551 \begin{sysanimateattribute}{dash}
552 Adds an animation of the dash phase and pattern (like |\pgfsys@setdash|).
553
554 Specify values with |\pgfsysanimvaldash|.
555 %
556 \begin{codeexample}[
557 preamble={\usetikzlibrary{animations}},
558 animation list={0.5,1,1.5,2},
559 ]
560 \animationexample{node}{}{
561 \pgfsysanimkeytime{0}{1}{1}{0}{0}
562 \pgfsysanimvaldash{1pt,10pt}{0pt}
563 \pgfsysanimkeytime{2}{1}{1}{0}{0}
564 \pgfsysanimvaldash{10pt,3pt}{0pt}
565 \pgfsysanimate{dash}
566 }
567 \end{codeexample}
568 %
569 \begin{codeexample}[
570 preamble={\usetikzlibrary{animations}},
571 animation list={0.5,1,1.5,2},
572 ]
573 \animationexample{node}{}{
574 \pgfsysanimkeytime{0}{1}{1}{0}{0}
575 \pgfsysanimvaldash{1cm,1pt}{0pt}
576 \pgfsysanimkeytime{2}{1}{1}{0}{0}
577 \pgfsysanimvaldash{1cm,1pt}{1cm}
578 \pgfsysanimate{dash}
579 }
580 \end{codeexample}
581 %
582 \begin{codeexample}[
583 preamble={\usetikzlibrary{animations}},
584 animation list={0.5,1,1.5,2},
585 ]
586 \animationexample{node}{}{
587 \pgfsysanimkeytime{0}{1}{1}{0}{0}
588 \pgfsysanimvaldash{3pt,1pt}{0pt}
589 \pgfsysanimkeytime{2}{1}{1}{0}{0}
590 \pgfsysanimvaldash{1pt,3pt}{10pt}
591 \pgfsysanimate{dash}
592 }
593 \end{codeexample}
594 %
595 \end{sysanimateattribute}
596
597
598 \subsection{Commands for Animating an Attribute: Transformations and Views}
599
600 The commands in this section allow you to animate the canvas transformation
601 matrix of a scope. However, there is one command that needs to be explained
602 first.
603
604 \begin{command}{\pgfsysanimkeycanvastransform\marg{pre}\marg{post}}
605 \end{command}
606 %
607 \begin{command}{\pgfsys@animation@canvas@transform\marg{pre}\marg{post}}
608 In order to animate the canvas, you specify that, for instance, the canvas
609 should be shifted over, say, one second by 2cm from left to right. In order
610 to specify this, you specify that an additional shift should be added to
611 the canvas transformation matrix that starts out as $(0,0)$ and ends at
612 $(2\,\mathrm{cm},0)$. However, it is not immediately clear what ``to the
613 right'' or $(2\,\mathrm{cm},0)$ actually means: ``Right'' relative to the
614 paper? ``Right'' relative to the coordinate system at the point when the
615 animation is created? ``Right'' relative to the object's local coordinate
616 system?
617
618 Using this command you can specify the coordinate system relative to which
619 all canvas animations are specified. In detail, when you add an animation
620 $a$ of the canvas of an object foo, the following happens:
621 %
622 \begin{enumerate}
623 \item We start with the canvas transformation matrix that is installed
624 when the object starts. More precisely, this is the canvas
625 transformation matrix that is in force when the command
626 |\pgfsys@begin@idscope| is called for the object. The canvas
627 transformation matrix that is in force when the animation is
628 created (which is typically ``way before'' the object is created
629 and may even be in a totally different graphics scope) is
630 irrelevant for the animation.
631 \item Now, when the object is created, the code \meta{pre} is executed.
632 It should call |\pgfsys@transformcm| at most once. This canvas
633 transformation is added to the object's canvas transformation.
634 \item Now, the animation $a$ of the canvas is relative to the resulting
635 canvas transformation. That means, when the animation shifts the
636 object ``to the right'' the animation will actually be along the
637 current direction of ``right'' in the canvas transformation
638 resulting from the two transformations above.
639 \item Finally, at the point of creation of the to-be-animation object
640 the code \meta{post} is executed. Again, the code should call
641 |\pgfsys@transformcm| at most once. The resulting transformation is
642 also added to the object's canvas transformation, but does
643 \emph{not} influence the animation.
644 \end{enumerate}
645
646 The net effect of the above is that, normally, you use the \meta{pre} code
647 to setup a transformation matrix relative to which you wish to perform your
648 animation and, normally, you use \meta{post} to undo this transformation
649 (using the inverted matrix) to ensure that when no animation is in force,
650 the object is placed at the same position as if no animation were used.
651
652 Let us now have a look at some examples. We use the following macro, which
653 takes a pre and a post code and animates a red ball over 1cm to the right
654 in two seconds and rotates the blue ball over 90$^\circ$ around the origin.
655 The ball is placed at $(1,0)$.
656 %
657 \begin{codeexample}[code only,setup code]
658 \def\animationcanvasexample#1#2{%
659 \animationexample{ball}{}{%
660 \pgfsysanimkeycanvastransform{#1}{#2}%
661 \pgfsysanimkeytime{0}{1}{1}{0}{0}
662 \pgfsysanimvaltranslate{0cm}{0cm}%
663 \pgfsysanimkeytime{2}{1}{1}{0}{0}
664 \pgfsysanimvaltranslate{1cm}{0cm}%
665 \pgfsysanimate{translate}
666 \fill [ball color=red,name=ball] (1,0) circle [radius=3mm]; }
667 \animationexample{ball}{}{%
668 \pgfsysanimkeycanvastransform{#1}{#2}%
669 \pgfsysanimkeytime{0}{1}{1}{0}{0}
670 \pgfsysanimvalscalar{0}%
671 \pgfsysanimkeytime{2}{1}{1}{0}{0}
672 \pgfsysanimvalscalar{90}%
673 \pgfsysanimate{rotate}
674 \fill [ball color=blue,name=ball] (1,0) circle [radius=3mm]; } }
675 \end{codeexample}
676 %
677 % TODOsp: codeexamples: this definition is needed for the next 4 `codeexample`s
678 % but because of the hash sign it can't simply be added `pre`
679 \def\animationcanvasexample#1#2{%
680 \animationexample{ball}{}{%
681 \pgfsysanimkeycanvastransform{#1}{#2}%
682 \pgfsysanimkeytime{0}{1}{1}{0}{0}
683 \pgfsysanimvaltranslate{0cm}{0cm}%
684 \pgfsysanimkeytime{2}{1}{1}{0}{0}
685 \pgfsysanimvaltranslate{1cm}{0cm}%
686 \pgfsysanimate{translate}
687 \fill [ball color=red,name=ball] (1,0) circle [radius=3mm]; }
688 \animationexample{ball}{}{%
689 \pgfsysanimkeycanvastransform{#1}{#2}%
690 \pgfsysanimkeytime{0}{1}{1}{0}{0}
691 \pgfsysanimvalscalar{0}%
692 \pgfsysanimkeytime{2}{1}{1}{0}{0}
693 \pgfsysanimvalscalar{90}%
694 \pgfsysanimate{rotate}
695 \fill [ball color=blue,name=ball] (1,0) circle [radius=3mm]; } }
696
697 \begin{codeexample}[
698 width=9.9cm,
699 preamble={\usetikzlibrary{animations}},
700 animation list={0.5,1,1.5,2},
701 ]
702 \animationcanvasexample
703 {}
704 {}
705 \end{codeexample}
706 %
707 \begin{codeexample}[
708 width=9.9cm,
709 preamble={\usetikzlibrary{animations}},
710 animation list={0.5,1,1.5,2},
711 ]
712 \animationcanvasexample
713 {\pgfsys@transformshift{10mm}{0mm}}
714 {\pgfsys@transformshift{-10mm}{0mm}}
715 \end{codeexample}
716 %
717 \begin{codeexample}[
718 width=9.9cm,
719 preamble={\usetikzlibrary{animations}},
720 animation list={0.5,1,1.5,2},
721 ]
722 \animationcanvasexample
723 {\pgfsys@transformcm{0.5}{0.5}{-0.5}{0.5}
724 {0pt}{0pt}}
725 {}
726 \end{codeexample}
727 %
728 \begin{codeexample}[
729 width=9.9cm,
730 preamble={\usetikzlibrary{animations}},
731 animation list={0.5,1,1.5,2},
732 ]
733 \animationcanvasexample
734 {\pgfsys@transformcm{0.5}{0.5}{-0.5}{0.5}
735 {0pt}{0pt}}
736 {\pgfsys@transformcm{1}{-1}{1}{1}
737 {0pt}{0pt}}
738 \end{codeexample}
739 %
740 \end{command}
741
742 \begin{sysanimateattribute}{translate}
743 Adds an (additional) translate animation. Effectively, this causes the
744 group to be shifted to different positions.
745
746 Specify values with |\pgfsysanimvaltranslate|.
747 %
748 \begin{codeexample}[
749 preamble={\usetikzlibrary{animations}},
750 animation list={0.5,1,1.5,2},
751 ]
752 \animationexample{node}{}{
753 \pgfsysanimkeytime{0}{1}{1}{0}{0}
754 \pgfsysanimvaltranslate{0cm}{0cm}%
755 \pgfsysanimkeytime{2}{1}{1}{0}{0}
756 \pgfsysanimvaltranslate{5mm}{-1cm}
757 \pgfsysanimate{translate}
758 }
759 \end{codeexample}
760 %
761 \end{sysanimateattribute}
762
763 \begin{sysanimateattribute}{scale}
764 Adds an animation of the scaling relative to the origin. This causes a
765 scaling of the canvas, including fonts and line widths.
766
767 Specify values with |\pgfsysanimvalscale|.
768 %
769 \begin{codeexample}[
770 preamble={\usetikzlibrary{animations}},
771 animation list={0.5,1,1.5,2},
772 ]
773 \animationexample{node}{}{
774 \pgfsysanimkeytime{0}{1}{1}{0}{0}
775 \pgfsysanimvalscale{1}{1}%
776 \pgfsysanimkeytime{2}{1}{1}{0}{0}
777 \pgfsysanimvalscale{0.5}{2}
778 \pgfsysanimate{scale}
779 }
780 \end{codeexample}
781 %
782 \end{sysanimateattribute}
783
784 \begin{sysanimateattribute}{rotate}
785 Adds a rotation animation around the origin.
786
787 Specify values with |\pgfsysanimvalscalar|.
788 %
789 \begin{codeexample}[
790 preamble={\usetikzlibrary{animations}},
791 animation list={0.5,1,1.5,2},
792 ]
793 \animationexample{node}{}{
794 \pgfsysanimkeytime{0}{1}{1}{0}{0}
795 \pgfsysanimvalscalar{0}%
796 \pgfsysanimkeytime{2}{1}{1}{0}{0}
797 \pgfsysanimvalscalar{90}
798 \pgfsysanimate{rotate}
799 }
800 \end{codeexample}
801 %
802 \end{sysanimateattribute}
803
804 \begin{sysanimateattribute}{skewx}
805 Adds an animation of a skewing of the canvas along the $x$-axis. Unlike the
806 |slant| options of \tikzname, the skew is given in degrees.
807
808 Specify values with |\pgfsysanimvalscalar|.
809 %
810 \begin{codeexample}[
811 preamble={\usetikzlibrary{animations}},
812 animation list={0.5,1,1.5,2},
813 ]
814 \animationexample{node}{}{
815 \pgfsysanimkeytime{0}{1}{1}{0}{0}
816 \pgfsysanimvalscalar{0}%
817 \pgfsysanimkeytime{2}{1}{1}{0}{0}
818 \pgfsysanimvalscalar{45}
819 \pgfsysanimate{skewx}
820 }
821 \end{codeexample}
822 %
823 \end{sysanimateattribute}
824
825 \begin{sysanimateattribute}{skewy}
826 Adds an animation of a skewing of the canvas along the $y$-axis.
827
828 Specify values with |\pgfsysanimvalscalar|.
829 \end{sysanimateattribute}
830
831 \begin{sysanimateattribute}{motion}
832 Works a bit like |\pgfsysanimvaltranslate|: It also adds an animated shift
833 transformation of the canvas. However, instead of specifying some shift
834 coordinates as values, you now specify a whole path (which may include
835 curves). The effect is that an animated translate transformation for the
836 different points on this path gets installed. Furthermore, if you use
837 |\pgfsysanimkeyrotatealong|, an additional adaptive rotation transformation
838 will be added so that the animated graphic scope ``points along'' the path.
839
840 You specify the path along which you wish to move objects along using
841 |\pgfsysanimkeymovealong|. You use the timeline to specify how far the
842 object gets moved along this path using scalar values where |0| is the
843 beginning of the path and |1| is the end. Thus, setting the timeline to the
844 scalar value of |0| at time $t_0$ and to |1| at time $t_1$ will cause the
845 object o move along the complete path between times $t_0$ and $t_1$.
846
847 Specify values with |\pgfsysanimvalscalar|.
848
849 \begin{command}{\pgfsysanimkeymovealong\marg{path}}
850 \end{command}
851 %
852 \begin{command}{\pgfsys@animation@movealong\marg{path}}
853 Defines the \meta{path} along which the motion will occur. It will
854 simply be executed and must call |\pgfsys@lineto| and similar
855 path-construction commands, but should not call other commands.
856 %
857 \begin{codeexample}[
858 preamble={\usetikzlibrary{animations}},
859 animation list={0.5,1,1.5,2},
860 render instead={
861 \animationexample{node}{}{
862 \pgfsysanimkeymovealong{
863 \pgfsyssoftpath@movetotoken{0pt}{0pt}
864 \pgfsyssoftpath@linetotoken{0pt}{-5mm}
865 \pgfsyssoftpath@curvetosupportatoken{0pt}{-1cm}%
866 \pgfsyssoftpath@curvetosupportbtoken{0pt}{-1cm}%
867 \pgfsyssoftpath@curvetotoken{-5mm}{-1cm} }
868 \pgfsysanimkeytime{0}{1}{1}{0}{0}
869 \pgfsysanimvalscalar{0}
870 \pgfsysanimkeytime{2}{1}{1}{0}{0}
871 \pgfsysanimvalscalar{1}
872 \pgfsysanimate{motion}
873 }
874 }]
875 \animationexample{node}{}{
876 \pgfsysanimkeymovealong{
877 \pgfsyssoftpath@movetotoken{0pt}{0pt}
878 \pgfsyssoftpath@linetotoken{0pt}{-5mm}
879 \pgfsyssoftpath@curvetosupportatoken{0pt}{-1cm}%
880 \pgfsyssoftpath@curvetosupportbtoken{0pt}{-1cm}%
881 \pgfsyssoftpath@curvetotoken{-5mm}{-1cm} }
882 \pgfsysanimkeytime{0}{1}{1}{0}{0}
883 \pgfsysanimvalscalar{0}
884 \pgfsysanimkeytime{2}{1}{1}{0}{0}
885 \pgfsysanimvalscalar{1}
886 \pgfsysanimate{motion}
887 }
888 \end{codeexample}
889 \end{command}
890
891 \begin{command}{\pgfsysanimkeynorotatealong}
892 \end{command}
893 %
894 \begin{command}{\pgfsys@animation@norotatealong}
895 Indicates that no additional rotation should be added during the
896 movement. This is the default.
897 \end{command}
898
899 \begin{command}{\pgfsysanimkeyrotatealong}
900 \end{command}
901 %
902 \begin{command}{\pgfsys@animation@rotatealong}
903 Indicates that the to-be-animated group should be rotated automatically
904 so that it points along the path as time progresses. This option is
905 only applicable to motion animations.
906 %
907 \begin{codeexample}[
908 preamble={\usetikzlibrary{animations}},
909 animation list={0.5,1,1.5,2},
910 render instead={
911 \animationexample{node}{}{
912 \pgfsysanimkeyrotatealong
913 \pgfsysanimkeymovealong{
914 \pgfsyssoftpath@movetotoken{0pt}{0pt}
915 \pgfsyssoftpath@linetotoken{0pt}{-5mm}
916 \pgfsyssoftpath@curvetosupportatoken{0pt}{-1cm}%
917 \pgfsyssoftpath@curvetosupportbtoken{0pt}{-1cm}%
918 \pgfsyssoftpath@curvetotoken{-5mm}{-1cm} }
919 \pgfsysanimkeytime{0}{1}{1}{0}{0}
920 \pgfsysanimvalscalar{0}
921 \pgfsysanimkeytime{2}{1}{1}{0}{0}
922 \pgfsysanimvalscalar{1}
923 \pgfsysanimate{motion}
924 }}]
925 \animationexample{node}{}{
926 \pgfsysanimkeyrotatealong
927 \pgfsysanimkeymovealong{%
928 \pgfsyssoftpath@movetotoken{0pt}{0pt}%
929 \pgfsyssoftpath@linetotoken{0pt}{-5mm}%
930 \pgfsyssoftpath@curvetosupportatoken{0pt}{-1cm}%
931 \pgfsyssoftpath@curvetosupportbtoken{0pt}{-1cm}%
932 \pgfsyssoftpath@curvetotoken{-5mm}{-1cm}}
933 \pgfsysanimkeytime{0}{1}{1}{0}{0}
934 \pgfsysanimvalscalar{0}%
935 \pgfsysanimkeytime{2}{1}{1}{0}{0}
936 \pgfsysanimvalscalar{1}
937 \pgfsysanimate{motion}
938 }
939 \end{codeexample}
940 \end{command}
941 \end{sysanimateattribute}
942
943 \begin{sysanimateattribute}{viewbox}
944 Adds an animation of the view box. The graphic scope to which this
945 animation is added must have been created using |\pgfsys@viewboxmeet| or
946 |\pgfsys@viewboxslice|; adding it to other scopes has no effect. Note that
947 this command does \emph{not} change or animate the scope's transformation
948 matrix -- it only animates the ``what we see through the view box''.
949
950 Specify values with |\pgfsysanimvalviewbox|.
951 %
952 \begin{codeexample}[
953 width=5cm,
954 preamble={\usetikzlibrary{animations,views}},
955 animation list={0.5,1,1.5,2},
956 animation bb={(0.9,-2.1) rectangle (3.1,2.1)},
957 ]
958 \animationexample{my view}{view}{
959 \pgfsysanimkeytime{0}{1}{1}{0}{0}
960 \pgfsysanimvalviewbox{-10mm}{-20mm}{10mm}{20mm}%
961 \pgfsysanimkeytime{2}{1}{1}{0}{0}
962 \pgfsysanimvalviewbox{15mm}{-15mm}{27mm}{8mm}%
963 \pgfsysanimate{viewbox}
964 \scoped [xshift=2cm] {
965 \draw [red] (-1,-2) rectangle (1,2) node [font=\scriptsize,
966 below left, align=right] {original\\ view\\ box};
967 \scoped [meet={(-1,-2) (1,2)}, name=my view] {
968 \draw (-5mm,-15mm) rectangle (7mm,8mm)
969 node [font=\scriptsize, align=right, below left]
970 {target\\ view\\ box};
971 \filldraw (0,0) circle [radius=3mm];
972 } } }
973 \end{codeexample}
974 %
975 \end{sysanimateattribute}
976
977
978 \subsection{Commands for Specifying the Target Object}
979
980 \begin{command}{\pgfsysanimkeywhom\marg{id}\marg{type}}
981 \end{command}
982 %
983 \begin{command}{\pgfsys@animation@whom\marg{id}\marg{type}}
984 Sets the target of the animation. The \marg{id} must previously have been
985 created using |\pgfsys@new@id|, \marg{type} must be a type (the empty type
986 is also allowed). See Section~\ref{section-sys-id} for details on ids and
987 types.
988 \end{command}
989
990
991 \subsection{Commands for Specifying Timelines: Specifying Times}
992
993 Animations are specified using \emph{timelines}, which are functions mapping
994 times to values for these times. The functions are cubic splines, which are
995 specified using time--value pairs plus control points.
996
997 In order to specify a time--value pair, you first use the command
998 |\pgfsysanimkeytime| to specify a time. Next, you use |\pgfsysanimval...| to
999 specify a value, which adds the time--value pair to the timeline. Note that the
1000 times must be given in non-decreasing order. Between time--value pairs, the
1001 values are interpolated using a spline.
1002
1003 The first and last times of the timeline are a bit special: The timeline starts
1004 on the first time and the duration of the timeline is the difference between
1005 the first and last time. ``Starting'' on the start time actually means that any
1006 beginnings (see the commands for specifying beginnings and endings) get as
1007 offset the start time; similarly end times are offset by this value.
1008
1009 \begin{command}{\pgfsysanimkeytime\marg{time}\marg{entry spline
1010 control x}\marg{entry spline control y}\marg{exit spline
1011 control x}\marg{exit spline control y}%
1012 }
1013 \end{command}
1014 \begin{command}{\pgfsys@animation@time\marg{time}\marg{entry spline
1015 control x}\marg{entry spline control y}\marg{exit spline
1016 control x}\marg{exit spline control y}%
1017 }
1018 The \meta{time} is a number representing seconds (so |0.5| means 500\,ms).
1019
1020 The spline between a time--value pair and the next is specified using the
1021 four parameters following the time. The first two of these specify the
1022 second control point of the interval preceding the time--value pair (called
1023 the ``entry'' control point), the last two parameters specify the first
1024 control point of the interval following the pair (called the ``exit''
1025 control point). Consider for instance, the following calls:
1026 %
1027 \begin{codeexample}[code only]
1028 \pgfsysanimkeytime{10}{0.1}{0.2}{0.3}{0.4}
1029 \pgfsysanimvalscalar{100}
1030 \pgfsysanimkeytime{15}{0.5}{0.6}{0.7}{0.8}
1031 \pgfsysanimvalscalar{200}
1032 \end{codeexample}
1033 %
1034 This will create (at least) the time interval $[10\,\mathrm s,15\,\mathrm
1035 s]$ and the control points for this interval will be $(0.3,0.4)$ and
1036 $(0.5,0.6)$.
1037
1038 Control points are specified in a different ``coordinate'' system from the
1039 time--value pairs themselves: While the time--value pairs are specified
1040 using a number representing seconds and a value using some special
1041 commands, the control points are specified as numbers between $0$ and $1$,
1042 each time representing a fraction of the time interval or the value
1043 interval. In the example, the time interval is $[10\,\mathrm s,15\,\mathrm
1044 s]$ and the value interval is $[100,200]$. This means that a control point
1045 of $(0.3,0.4)$ actually refers to the time--value $(11.5\,\mathrm s,140)$.
1046 The ``time--value curve'' in the interval thus ``\texttt{(10s,100) ..
1047 controls (11.5s,140) and (12.5s,160) .. (15s,200)}''.
1048
1049 Note that by setting the control points always to $(1,1)$ and $(0,0)$ you
1050 get a linear interpolation between time--value pairs.
1051
1052 Two special cases are the following: When the two last parameters, the exit
1053 spline, take the special values |stay| and |0|, the attribute's value
1054 ``stays'' until the next value for the next time (it then ``jumps'' to the
1055 next value then). This corresponds, roughly, to an ``infinite'' \meta{exit
1056 spline control x}. Similarly, when the entry spline parameters take the
1057 special values |jump| and |1|, the value immediately jumps from the
1058 previous value to the next value when the previous value was specified.
1059 \end{command}
1060
1061 \begin{command}{\pgfsysanimkeybase}
1062 \end{command}
1063 %
1064 \begin{command}{\pgfsys@animation@base}
1065 This command can be used in any place where |\pgfsys@animation@time| is
1066 usually used. The effect is that the next value does not become part of the
1067 timeline, but will become the value used for the attribute when no
1068 animation is active. (Normally, when the animation is not active, no value
1069 is set at all and the value is inherited from the surrounding scope.)
1070 \end{command}
1071
1072 It may happen that there is more than one timeline active that is ``trying to
1073 modify'' a given attribute. In this case, the following rules are used to
1074 determine, which timeline ``wins'':
1075 %
1076 \begin{enumerate}
1077 \item If no animation is active at the current time (all animation either
1078 have not yet started or they have already ended), then the base value
1079 given in the animation encountered last in the code is used. (If there
1080 are no base values, the attribute is taken from the surrounding scope.)
1081 \item If there are several active animations, the one that has started last
1082 is used and the its value is used.
1083 \item If there are several active animations that have started at the same
1084 time, the one that comes last in the code is used.
1085 \end{enumerate}
1086
1087 Note that these rules do not apply to transformations of the canvas since these
1088 are always additive (or, phrased differently, they are always all active and
1089 the effects accumulate).
1090
1091
1092 \subsection{Commands for Specifying Timelines: Specifying Values}
1093
1094 The following commands are used to specify the values of a timeline. Each use
1095 of one of the following commands adds one time--value pair to the timeline.
1096 Which of the commands must be used depends on the type of the to-be-animated
1097 attribute (see the |\pgfsysanimate| command instances, which list the command
1098 that must be used).
1099
1100 \begin{command}{\pgfsysanimvalcurrent}
1101 \end{command}
1102 \begin{command}{\pgfsys@animation@val@current}
1103 Creates a time--value pairs where the value is the current value that the
1104 attribute has. This command can only be used in conjunction with ``real''
1105 animations, when you use it with a snapshot an error is raised.
1106 \end{command}
1107
1108 \begin{command}{\pgfsysanimvaltext\marg{text}}
1109 \end{command}
1110 \begin{command}{\pgfsys@animation@val@text\marg{text}}
1111 Creates a time--value pairs where the value is some text. Which texts are
1112 permissible depends on the to-be-animated attribute.
1113 \end{command}
1114
1115 \begin{command}{\pgfsysanimvalscalar\marg{number}}
1116 \end{command}
1117 \begin{command}{\pgfsys@animation@val@scalar\marg{number}}
1118 Creates a time--value pairs where the value is a number like |0.5| or
1119 |-2.25|.
1120 \end{command}
1121
1122 \begin{command}{\pgfsysanimvaldimension\marg{dimension}}
1123 \end{command}
1124 \begin{command}{\pgfsys@animation@val@dimension\marg{dimension}}
1125 Creates a time--value pairs where the value is a \TeX\ dimension like
1126 |0.5pt| or |-2in|.
1127 \end{command}
1128
1129 \begin{command}{\pgfsysanimvalcolorrgb\marg{red}\marg{green}\marg{blue}}
1130 \end{command}
1131 \begin{command}{\pgfsys@animation@val@color@rgb\marg{red}\marg{green}\marg{blue}}
1132 Creates a time--value pairs where the value is color specified by three
1133 fractional values between 0 and 1 for the red, the green, and the blue
1134 part.
1135 \end{command}
1136
1137 \begin{command}{\pgfsysanimvalcolorcmyk\marg{cyan}\marg{magenta}\marg{yellow}\marg{black}}
1138 \end{command}
1139 \begin{command}{\pgfsys@animation@val@color@cmyk\marg{cyan}\marg{magenta}\marg{yellow}\marg{black}}
1140 Creates a time--value pairs where the value is color specified by four
1141 fractional values between 0 and 1 for the cyan, magenta, yellow, and black
1142 part.
1143 \end{command}
1144
1145 \begin{command}{\pgfsysanimvalcolorcmy\marg{cyan}\marg{magenta}\marg{yellow}}
1146 \end{command}
1147 \begin{command}{\pgfsys@animation@val@color@cmy\marg{cyan}\marg{magenta}\marg{yellow}}
1148 Like the |\pgfsysanimvalcolorcmyk| only without the black part.
1149 \end{command}
1150
1151 \begin{command}{\pgfsysanimvalcolorgray\marg{gray value}}
1152 \end{command}
1153 \begin{command}{\pgfsys@animation@val@color@gray\marg{gray value}}
1154 Creates a time--value pairs where the value is gray value (a
1155 fraction between 0 and 1).
1156 \end{command}
1157
1158 \begin{command}{\pgfsysanimvalpath\marg{low-level path construction commands}}
1159 \end{command}
1160 \begin{command}{\pgfsys@animation@val@path\marg{low-level path construction command}}
1161 Creates a time--value pairs where the value is path. The \meta{low-level
1162 commands} must consist of a sequence of path construction commands like
1163 |\pgfsys@lineto| or |\pgfsyssoftpath@linetotoken| (more precisely, the
1164 commands must form a list of \TeX\ tokens and dimensions surrounded by
1165 braces). For each call of this command, the sequence of tokens and numbers
1166 must be the some. During the animation, only and exactly the numbers will
1167 be interpolated.
1168 \end{command}
1169
1170 \begin{command}{\pgfsysanimvaltranslate\marg{x dimension}\marg{y dimension}}
1171 \end{command}
1172 \begin{command}{\pgfsys@animation@val@translate\marg{x dimension}\marg{y dimension}}
1173 Creates a time--value pairs where the value is a coordinate. The dimensions
1174 must be \TeX\ dimensions.
1175 \end{command}
1176
1177 \begin{command}{\pgfsysanimvalscale\marg{x scale}\marg{y scale}}
1178 \end{command}
1179 \begin{command}{\pgfsys@animation@val@scale\marg{x scale}\marg{y scale}}
1180 Creates a time--value pairs where the value is pair of scalar values.
1181 \end{command}
1182
1183 \begin{command}{\pgfsysanimvalviewbox\marg{$x_1$}\marg{$y_1$}\marg{$x_2$}\marg{$y_2$}}
1184 \end{command}
1185 \begin{command}{\pgfsys@animation@val@viewbox\marg{$x_1$}\marg{$y_1$}\marg{$x_2$}\marg{$y_2$}}
1186 Creates a time--value pairs where the value is view box. The lower left
1187 corner is given by $(x_1,y_1)$, consisting of two \TeX\ dimensions, and the
1188 upper right corner is $(x_2,y_2)$.
1189 \end{command}
1190
1191 \begin{command}{\pgfsysanimvaldash\marg{pattern}\marg{phase}}
1192 \end{command}
1193 \begin{command}{\pgfsys@animation@val@dash\marg{pattern}\marg{phase}}
1194 Creates a time--value pairs where the value is dash pattern and phase with
1195 the same syntax as |\pgfsys@setdash|.
1196 \end{command}
1197
1198
1199 \subsection{Commands for Specifying Timing: Repeats}
1200
1201 \begin{command}{\pgfsysanimkeyrepeat{number of times}}
1202 \end{command}
1203 \begin{command}{\pgfsys@animation@repeat\marg{number of times}}
1204 Specifies that the animation should repeat the specified \meta{number of
1205 times}, which may be a fractional number.
1206 %
1207 \begin{codeexample}[
1208 width=6cm,
1209 preamble={\usetikzlibrary{animations}},
1210 animation list={1,2,3,4,5,6,7,8},
1211 ]
1212 \animationexample{node}{}{
1213 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1214 \pgfsysanimvaltranslate{0cm}{0cm}
1215 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1216 \pgfsysanimvaltranslate{0cm}{-1cm}
1217 \pgfsysanimkeyrepeat{2.5}
1218 \pgfsysanimate{translate} }
1219 \end{codeexample}
1220 %
1221 \end{command}
1222
1223 \begin{command}{\pgfsysanimkeyrepeatindefinite}
1224 \end{command}
1225 \begin{command}{\pgfsys@animation@repeat@indefinite}
1226 Specifies that the animation should repeat indefinitely.
1227 %
1228 \begin{codeexample}[
1229 width=6cm,
1230 preamble={\usetikzlibrary{animations}},
1231 animation list={1,2,3,4,5,6,7,8},
1232 ]
1233 \animationexample{node}{}{
1234 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1235 \pgfsysanimvaltranslate{0cm}{0cm}
1236 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1237 \pgfsysanimvaltranslate{0cm}{-1cm}
1238 \pgfsysanimkeyrepeatindefinite
1239 \pgfsysanimate{translate} }
1240 \end{codeexample}
1241 %
1242 \end{command}
1243
1244 \begin{command}{\pgfsysanimkeyrepeatdur\meta{seconds}}
1245 \end{command}
1246 \begin{command}{\pgfsys@animation@repeat@dur\meta{seconds}}
1247 Specifies that the animation should repeat until \meta{seconds} have
1248 elapsed.
1249 %
1250 \begin{codeexample}[
1251 width=6cm,
1252 preamble={\usetikzlibrary{animations}},
1253 animation list={1,2,3,4,5,6,7,8},
1254 ]
1255 \animationexample{node}{}{
1256 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1257 \pgfsysanimvaltranslate{0cm}{0cm}
1258 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1259 \pgfsysanimvaltranslate{0cm}{-1cm}
1260 \pgfsysanimkeyrepeatdur{5}
1261 \pgfsysanimate{translate} }
1262 \end{codeexample}
1263 %
1264 \end{command}
1265
1266
1267 \subsection{Commands for Specifying Timing: Beginning and Ending}
1268
1269 Normally, animations start when a graphic is displayed. Using the following
1270 commands, you can change this behavior: For instance, you can specify that the
1271 animation should start when, say, some button has been pressed or a key has
1272 been hit. Similarly, you can also use the commands to specify that the
1273 animation should stop early, for instance when a button is pressed.
1274
1275 Note that all of the commands for specifying a nonstandard begin (or end) of an
1276 animation's timeline refer to when the time $0\,\mathrm s$ of the timeline
1277 should actually be. If the first time--value point for a timeline is at, say,
1278 2\,s and you specify that the begin of the animation is one second after the
1279 click of a button, the attribute will attain the value specified by the
1280 time--value point three seconds after the button has been pressed.
1281
1282 All of the following commands take either the text |begin| or |end| as their
1283 last argument.
1284
1285 You can call the commands several times. This will result in several different
1286 possible beginnings (or endings).
1287
1288 \begin{command}{\pgfsysanimkeyoffset\marg{time offset}\marg{begin or end}}
1289 \end{command}
1290 \begin{command}{\pgfsys@animation@offset\marg{time offset}\marg{begin or end}}
1291 Specifies that (in addition to any other beginnings or endings) the
1292 animation's timeline should begin (or end) \meta{time offset} many seconds
1293 after the graphic is shown. For instance, in the next example the animation
1294 will start automatically after 5\,s \emph{or} when then button is pressed.
1295 %
1296 \begin{codeexample}[
1297 width=6cm,
1298 preamble={\usetikzlibrary{animations}},
1299 animation list={1,2,3,4,5,6,7,8},
1300 render instead={
1301 \animationexample{node}{}{
1302 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1303 \pgfsysanimvaltranslate{0cm}{0cm}
1304 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1305 \pgfsysanimvaltranslate{0cm}{-1cm}
1306 \pgfsysanimkeyoffset{5}{begin}
1307 \pgfsysanimkeysnapshotstart{5}
1308 \pgfsysanimate{translate} }
1309 }]
1310 \animationexample{node}{}{
1311 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1312 \pgfsysanimvaltranslate{0cm}{0cm}
1313 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1314 \pgfsysanimvaltranslate{0cm}{-1cm}
1315 \pgfsysanimkeyoffset{5}{begin}
1316 \pgfsysanimate{translate} }
1317 \end{codeexample}
1318 %
1319 \end{command}
1320
1321 \begin{command}{\pgfsysanimkeysyncbegin\marg{sync base id}\marg{type}\marg{time offset}\marg{begin or end}}
1322 \end{command}
1323 \begin{command}{\pgfsys@animation@syncbegin\marg{sync base id}\marg{type}\marg{time offset}\marg{begin or end}}
1324 Specifies that the animation should begin \meta{time offset} many seconds
1325 after the \meta{sync base id} with the given \meta{type} has begun. Here,
1326 the \meta{sync base id} must have been obtained using |\pgfsys@new@id|.
1327
1328 The idea behind a sync base is that you setup an animation and name it,
1329 other animations can start alongside this animation. An animation whose
1330 sole purpose is to orchestrate other animations in this way is called a
1331 \emph{sync base}.
1332 \end{command}
1333
1334 \begin{command}{\pgfsysanimkeysyncend\marg{sync base id}\marg{type}\marg{time offset}\marg{begin or end}}
1335 \end{command}
1336 \begin{command}{\pgfsys@animation@syncend\marg{sync base id}\marg{type}\marg{time offset}\marg{begin or end}}
1337 Works like |\pgfsysanimkeysyncbegin| only the animation begin (or ends)
1338 when the sync base ends.
1339 \end{command}
1340
1341 \begin{command}{\pgfsysanimkeyevent\marg{id}\marg{type}\marg{event name}\marg{time offset}\marg{begin or end}}
1342 \end{command}
1343 \begin{command}{\pgfsys@animation@event\marg{id}\marg{type}\marg{event name}\marg{time offset}\marg{begin or end}}
1344 Specifies that the animation should begin (or end) \meta{time offset} many
1345 seconds after a certain \emph{event} has occurred. Which events are
1346 possible depends on the specific output language, here are the events
1347 currently supported in \textsc{svg}:
1348 %
1349 \begin{itemize}
1350 \item |click| occurs when the object with the given \meta{id} and
1351 \meta{type} has been clicked.
1352 \item |focusin| and |focusout| occur when the focus enters or leaves
1353 the object.
1354 \item |mouseup|, |mousedown|, |mouseover|, |mousemove|, and |mouseout|
1355 occur when the mouse is pressed up or down on the object, moved
1356 onto the object, moved over the object, or moved off the object.
1357 \end{itemize}
1358 %
1359 \begin{codeexample}[
1360 width=2cm,
1361 preamble={\usetikzlibrary{animations}},
1362 ]
1363 \animationexample{node}{}{
1364 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1365 \pgfsysanimvaltranslate{0cm}{0cm}
1366 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1367 \pgfsysanimvaltranslate{0cm}{-1cm}
1368 \pgfsysanimkeyevent{\nodeid}{}{mouseup}{}{begin}
1369 \pgfsysanimate{translate} }
1370 \end{codeexample}
1371 %
1372 \begin{codeexample}[
1373 width=2cm,
1374 preamble={\usetikzlibrary{animations}},
1375 ]
1376 \animationexample{node}{}{
1377 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1378 \pgfsysanimvaltranslate{0cm}{0cm}
1379 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1380 \pgfsysanimvaltranslate{0cm}{-1cm}
1381 \pgfsysanimkeyevent{\nodeid}{}{mousedown}{}{begin}
1382 \pgfsysanimate{translate} }
1383 \end{codeexample}
1384 %
1385 \begin{codeexample}[
1386 width=2cm,
1387 preamble={\usetikzlibrary{animations}},
1388 ]
1389 \animationexample{node}{}{
1390 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1391 \pgfsysanimvaltranslate{0cm}{0cm}
1392 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1393 \pgfsysanimvaltranslate{0cm}{-1cm}
1394 \pgfsysanimkeyevent{\nodeid}{}{mouseover}{}{begin}
1395 \pgfsysanimate{translate} }
1396 \end{codeexample}
1397 %
1398 \begin{codeexample}[
1399 width=2cm,
1400 preamble={\usetikzlibrary{animations}},
1401 ]
1402 \animationexample{node}{}{
1403 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1404 \pgfsysanimvaltranslate{0cm}{0cm}
1405 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1406 \pgfsysanimvaltranslate{0cm}{-1cm}
1407 \pgfsysanimkeyevent{\nodeid}{}{mousemove}{}{begin}
1408 \pgfsysanimate{translate} }
1409 \end{codeexample}
1410 %
1411 \begin{codeexample}[
1412 width=2cm,
1413 preamble={\usetikzlibrary{animations}},
1414 ]
1415 \animationexample{node}{}{
1416 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1417 \pgfsysanimvaltranslate{0cm}{0cm}
1418 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1419 \pgfsysanimvaltranslate{0cm}{-1cm}
1420 \pgfsysanimkeyevent{\nodeid}{}{mouseout}{}{begin}
1421 \pgfsysanimate{translate} }
1422 \end{codeexample}
1423 %
1424 \end{command}
1425
1426 \begin{command}{\pgfsysanimkeyrepeatevent\marg{id}\marg{type}\marg{repeat count}\marg{time offset}\marg{begin or end}}
1427 \end{command}
1428 \begin{command}{\pgfsys@animation@repeat@event\marg{id}\marg{type}\marg{repeat count}\marg{time offset}\marg{begin or end}}
1429 The animation begins (or end) with a certain offset when another animation
1430 has reached a certain repeat count.
1431 %
1432 \begin{codeexample}[
1433 width=6cm,
1434 preamble={\usetikzlibrary{animations}},
1435 animation list={1,2,3,4,5,6,7,8},
1436 ]
1437 \animationexample{node}{}{
1438 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1439 \pgfsysanimvaltranslate{0cm}{0cm}
1440 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1441 \pgfsysanimvaltranslate{0cm}{-5mm}
1442 \pgfsysanimkeyrepeatdur{5}
1443 \pgfsys@new@id{\animationid}
1444 \pgfsys@use@id{\animationid}
1445 \pgfsysanimate{translate}
1446 \global\let\animationid\animationid }
1447 \tikz {
1448 \pgfidrefnextuse{\objid}{other}
1449 \pgfsysanimkeyrepeatevent{\animationid}{}{2}{0}{begin}
1450 \pgfsysanimkeysnapshotstart{4}
1451 \pgfsysanimkeywhom{\objid}{}
1452 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1453 \pgfsysanimvaltranslate{0cm}{0cm}
1454 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1455 \pgfsysanimvaltranslate{0cm}{-5mm}
1456 \pgfsysanimate{translate}
1457 \node [fill=red, text=white, circle] (other) {Other}; }
1458 \end{codeexample}
1459 %
1460 \end{command}
1461
1462 \begin{command}{\pgfsysanimkeyaccesskey\marg{character}\marg{time offset}\marg{begin or end}}
1463 \end{command}
1464 \begin{command}{\pgfsys@animation@accesskey\marg{character}\marg{time offset}\marg{begin or end}}
1465 Begin or end the animation when a certain key is pressed. Note that this
1466 event may not be supported by some browsers for security reasons (prevent
1467 key loggers).
1468 %
1469 \begin{codeexample}[
1470 width=2cm,
1471 preamble={\usetikzlibrary{animations}},
1472 ]
1473 \animationexample{node}{}{
1474 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1475 \pgfsysanimvaltranslate{0cm}{0cm}
1476 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1477 \pgfsysanimvaltranslate{0cm}{-1cm}
1478 \pgfsysanimkeyaccesskey{s}{}{begin}
1479 \pgfsysanimate{translate}
1480 }
1481 \end{codeexample}
1482 %
1483 \end{command}
1484
1485
1486 \subsection{Commands for Specifying Timing: Restart Behaviour}
1487
1488 \begin{command}{\pgfsysanimkeyrestartalways}
1489 \end{command}
1490 \begin{command}{\pgfsys@animation@restart@always}
1491 Defines that the animation can be restarted at any time. This is the
1492 default.
1493 %
1494 \begin{codeexample}[
1495 width=2cm,
1496 preamble={\usetikzlibrary{animations}},
1497 ]
1498 \animationexample{node}{}{
1499 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1500 \pgfsysanimvaltranslate{0cm}{0cm}
1501 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1502 \pgfsysanimvaltranslate{0cm}{-1cm}
1503 \pgfsysanimkeyrestartalways
1504 \pgfsysanimate{translate} }
1505 \end{codeexample}
1506 %
1507 \end{command}
1508
1509 \begin{command}{\pgfsysanimkeyrestartnever}
1510 \end{command}
1511 \begin{command}{\pgfsys@animation@restart@never}
1512 Defines that the animation cannot be restarted once it has run.
1513 %
1514 \begin{codeexample}[
1515 width=2cm,
1516 preamble={\usetikzlibrary{animations}},
1517 ]
1518 \animationexample{node}{}{
1519 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1520 \pgfsysanimvaltranslate{0cm}{0cm}
1521 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1522 \pgfsysanimvaltranslate{0cm}{-1cm}
1523 \pgfsysanimkeyrestartnever
1524 \pgfsysanimate{translate} }
1525 \end{codeexample}
1526 %
1527 \end{command}
1528
1529 \begin{command}{\pgfsysanimkeyrestartwhennotactive}
1530 \end{command}
1531 \begin{command}{\pgfsys@animation@restart@whennotactive}
1532 Defines that the animation cannot be restarted while it is running.
1533 %
1534 \begin{codeexample}[
1535 width=2cm,
1536 preamble={\usetikzlibrary{animations}},
1537 ]
1538 \animationexample{node}{}{
1539 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1540 \pgfsysanimvaltranslate{0cm}{0cm}
1541 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1542 \pgfsysanimvaltranslate{0cm}{-1cm}
1543 \pgfsysanimkeyrestartwhennotactive
1544 \pgfsysanimate{translate} }
1545 \end{codeexample}
1546 %
1547 \end{command}
1548
1549 \begin{command}{\pgfsysanimkeyfreezeatend}
1550 \end{command}
1551 \begin{command}{\pgfsys@animation@freezeatend}
1552 When an animation ends, the question is whether the ``effect'' of the
1553 animation (like changing a color or translating the coordinate system)
1554 should disappear or ``remain in force''. Using this key, you specify that
1555 at the end of the animation the last value of the attributes stays in
1556 effect.
1557 %
1558 \begin{codeexample}[
1559 width=6cm,
1560 preamble={\usetikzlibrary{animations}},
1561 animation list={1,2,3,4,5,6,7,8},
1562 ]
1563 \animationexample{node}{}{
1564 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1565 \pgfsysanimvaltranslate{0cm}{0cm}
1566 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1567 \pgfsysanimvaltranslate{0cm}{-1cm}
1568 \pgfsysanimkeyfreezeatend
1569 \pgfsysanimate{translate} }
1570 \end{codeexample}
1571 %
1572 \end{command}
1573
1574 \begin{command}{\pgfsysanimkeyremoveatend}
1575 \end{command}
1576 \begin{command}{\pgfsys@animation@removeatend{}}
1577 The opposite of |\pgfsysanimkeyfreezeatend|. This is the default.
1578 %
1579 \begin{codeexample}[
1580 width=6cm,
1581 preamble={\usetikzlibrary{animations}},
1582 animation list={1,2,3,4,5,6,7,8},
1583 ]
1584 \animationexample{node}{}{
1585 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1586 \pgfsysanimvaltranslate{0cm}{0cm}
1587 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1588 \pgfsysanimvaltranslate{0cm}{-1cm}
1589 \pgfsysanimkeyremoveatend
1590 \pgfsysanimate{translate} }
1591 \end{codeexample}
1592 %
1593 \end{command}
1594
1595
1596 \subsection{Commands for Specifying Accumulation}
1597
1598 Animations specify how an attribute of an object changes over time. When more
1599 than one animation changes the same value at the same time, the last value
1600 given for the attribute ``wins'', except for animations of the canvas, which
1601 always accumulate. Additionally, when a repeat is specified for an attribute,
1602 during each repeat the values can add up:
1603
1604 \begin{command}{\pgfsysanimkeyaccumulate{}}
1605 \end{command}
1606 \begin{command}{\pgfsys@animation@accumulate{}}
1607 Specifies that each repeat of an animation works as if the last values
1608 attained during previous repeats are added to the current value.
1609 %
1610 \begin{codeexample}[
1611 width=6cm,
1612 preamble={\usetikzlibrary{animations}},
1613 animation list={1,2,3,4,5,6,7,8},
1614 ]
1615 \animationexample{node}{}{
1616 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1617 \pgfsysanimvaltranslate{0cm}{0cm}
1618 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1619 \pgfsysanimvaltranslate{0cm}{-5mm}
1620 \pgfsysanimkeyaccumulate
1621 \pgfsysanimkeyrepeatdur{5}
1622 \pgfsysanimate{translate} }
1623 \end{codeexample}
1624 %
1625 \end{command}
1626
1627 \begin{command}{\pgfsysanimkeynoaccumulate{}}
1628 \end{command}
1629 \begin{command}{\pgfsys@animation@noaccumulate{}}
1630 Specifies that each repeat resets the to-be-animated value. This is the
1631 default.
1632 %
1633 \begin{codeexample}[
1634 width=6cm,
1635 preamble={\usetikzlibrary{animations}},
1636 animation list={1,2,3,4,5,6,7,8},
1637 ]
1638 \animationexample{node}{}{
1639 \pgfsysanimkeytime{0}{1}{1}{0}{0}
1640 \pgfsysanimvaltranslate{0cm}{0cm}
1641 \pgfsysanimkeytime{2}{1}{1}{0}{0}
1642 \pgfsysanimvaltranslate{0cm}{-5mm}
1643 \pgfsysanimkeynoaccumulate
1644 \pgfsysanimkeyrepeatdur{5}
1645 \pgfsysanimate{translate} }
1646 \end{codeexample}
1647 %
1648 \end{command}
1649
1650
1651 %%% Local Variables:
1652 %%% mode: latex
1653 %%% TeX-master: "pgfmanual"
1654 %%% End: