1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
|
% Copyright 2015 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/generic/pgf/licenses/LICENSE for more details.
\ProvidesFileRCS{pgfmoduleanimations.code.tex}
% We need the animation system abstraction:
\input pgfsysanimations.code.tex
% Animate an attribute over time
%
% #1 = an attribute
% #2 = configuration keys
%
% This command adds animation commands for the attribute given in #1
% of some future object to the current graphic scope. For instance,
% when #1 is "fill opacity" then the fill opacity of the object will
% change over time. The object to which the command refers is
% specified using a special key in #2.
%
% The keys in #2 specify how the changes occur over time. There are a
% number of keys that have an effect on the animation "as a whole"
% (like "repeats") while the most central key is the entry key. This
% key takes two parameters: a time and a value. It specifies that at
% the given time the attribute should have the specified value. The
% times must be given in ascending order. Between the times given in
% this way, the values of the attribute will be interpolated; you can
% influence the details of how this interpolation is done using
% additional keys.
%
% The keys in #2 are given in key-value syntax and can be given in any
% order, except that the entry keys must be given in order of
% ascending times.
%
% The syntax of the second parameter of the entry key depends on
% #1. Currently, these are:
%
% Attribute Value Type
% ---------------------------------------
% fill opacity scalar
% stroke opacity scalar
% opacity scalar
% visible boolean
% line width dimension
% fill color
% stroke color
% motion motion
% translate point
% scale scaling
% rotate scalar
% xskew scalar
% yskew scalar
% path path
% softpath softpath
% view viewbox
% dash phase dimension
% dash pattern dashpattern
% none any
%
% Example:
%
% \pgfanimateattribute{fill opacity}{entry={0s}{1}, entry={2s}{0}}
\def\pgfanimateattribute#1#2{%
\pgfanimateattributecode{#1}{\pgfkeys{/pgf/animation/.cd,#2}}%
}%
% Variant of \pgfanimateattribute
%
% #1 = attribute
% #2 = code
%
% Description:
%
% A version of \pgfanimateattribute where instead of keys #2 you
% provide a code #2 that calls the animation keys itself.
\def\pgfanimateattributecode#1#2{%
{%
\pgfkeys{/pgf/@animation attributes/.cd,#1}%
#2%
\csname pgf@animation@check@\pgf@animation@attribute\endcsname%
\pgfsysanimate{\pgf@animation@attribute}%
}%
}%
% Create a time snapshot
%
% #1 = a time
%
% Description:
%
% This command should be called in a scope prior to all calls of
% animation commands in that scope. When called, all animations will
% be "intercepted" and, instead of creating the animation code, normal
% code will be generated that shows the state of the animation at the
% specified "moment" #1. Since no animation code is involved, this
% works with all drivers.
%
% The command \pgfsnapshotafter works the same way as \pgfsnapshot,
% only the timing is slightly different: Conceptually, #1 is
% interpreted as "#1+epsilon". For instance, if there are two values
% specified for the time #1, then \pgfsnapshot will use the first
% while \pgfsnapshotafter will use the second. Likewise, when an
% animation ends at time #1, \pgfsnapshot will still us the
% animation's value, while \pgfsnapshotafter will not.
%
% Example:
%
% {
% \pgfsnapshot{1.2s}
% \pgfanimateattribute{fill opacity}{entry={0s}{1}, entry={2s}{0}}
% \fill (0,0) rectangle (1,1);
% }
\def\pgfsnapshot#1{\pgfparsetime{#1}\expandafter\pgfsysanimsnapshot\expandafter{\pgftimeresult}}%
\def\pgfsnapshotafter#1{\pgfparsetime{#1}\expandafter\pgfsysanimsnapshotafter\expandafter{\pgftimeresult}}%
% The animation attributes
\pgfkeys{/pgf/@animation attributes/.cd,
visible/.code=\pgf@animate@attr{visibility}{mapped}\def\pgf@anim@map@true{visible}\def\pgf@anim@map@false{hidden},
stage/.code=\pgf@animate@attr{visibility}{mapped}\def\pgf@anim@map@true{visible}\def\pgf@anim@map@false{hidden}\pgfsysanimkeybase\pgfsysanimvaltext{hidden},
opacity/.code=\pgf@animate@attr{opacity}{scalar},
fill opacity/.code=\pgf@animate@attr{fillopacity}{scalar},
draw opacity/.code=\pgf@animate@attr{strokeopacity}{scalar},
stroke opacity/.style=draw opacity,
line width/.code=\pgf@animate@attr{linewidth}{dimension},
fill/.code=\pgf@animate@attr{fillcolor}{color},
draw/.code=\pgf@animate@attr{strokecolor}{color},
color/.code=\pgf@animate@attr{color}{color},
stroke/.style=draw,
motion/.code=\pgf@animate@attr{motion}{scalar},
translate/.code=\pgf@animate@attr{translate}{point},
scale/.code=\pgf@animate@attr{scale}{scaling},
rotate/.code=\pgf@animate@attr{rotate}{scalar},
xskew/.code=\pgf@animate@attr{skewx}{scalar},
yskew/.code=\pgf@animate@attr{skewy}{scalar},
skew x/.style=xskew,
skew y/.style=yskew,
path/.code=\pgf@animate@attr{path}{path},
softpath/.code=\pgf@animate@attr{path}{softpath},
view/.code=\pgf@animate@attr{viewbox}{viewbox},
dash/.code=\pgf@animate@attr{dash}{dash},
none/.code=\pgf@animate@attr{none}{none},
}%
\def\pgf@animate@attr#1#2{%
\def\pgf@animation@attribute{#1}%
\expandafter\let\expandafter\pgfanim@type@parser\csname pgfanim@parse@type@#2\endcsname%
}%
% The time parser
%
% #1 = a time
%
% This macro parses the time in #1, but adds some support for times:
%
% 1) The postfix operator "s" is added, which has no effect.
% 2) The postfix operator "ms" is added, which divides a number by
% 1000, so "2ms" equals "0.002".
% 3) The postfix operator "min" is added, which multiplies a number by
% 60.
% 4) The postfix operator "h" is added, which multiplies a number by
% 3600.
% 5) The infix operator ":" is redefined, so that it multiplies its
% first argument by 60 and adds the second. This implies that
% "1:20" equals "80" and "01:00:00" equals "3600".
% 6) The parsing of octal numbers is switched off to allow things like
% "01:08" for 68s.
\def\pgfparsetime#1{%
\begingroup%
\pgfmathdeclareoperator{s}{@seconds}{1}{postfix}{600}%
\pgfmathdeclareoperator{m}{m@encountered}{1}{postfix}{600}%
\pgfmathdeclareoperator{i}{i@encountered}{1}{postfix}{600}%
\pgfmathdeclareoperator{n}{@minutes}{1}{postfix}{600}%
\pgfmathdeclareoperator{h}{@hours}{1}{postfix}{600}%
\pgfmathdeclareoperator{:}{time@colon}{2}{infix}{50}%
\pgfmath@octalparsingfalse%
\pgfmathparse{#1}%
\expandafter\endgroup%
\expandafter\def\expandafter\pgftimeresult\expandafter{\pgfmathresult}%
}%
\newif\ifpgfanim@m@encountered
\newif\ifpgfanim@i@encountered
\pgfmathdeclarefunction{@seconds}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\ifpgfanim@m@encountered%
\divide\pgfmath@x by1000\relax%
\fi%
\global\pgfanim@m@encounteredfalse%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
\pgfmathdeclarefunction{m@encountered}{1}{%
\global\pgfanim@m@encounteredtrue%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
\pgfmathdeclarefunction{i@encountered}{1}{%
\ifpgfanim@m@encountered%
\global\pgfanim@m@encounteredfalse%
\global\pgfanim@i@encounteredtrue%
\else%
\pgfmath@error{Unexpected i}{}%
\fi%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
\pgfmathdeclarefunction{@minutes}{1}{%
\ifpgfanim@i@encountered%
\global\pgfanim@i@encounteredfalse%
\else%
\pgfmath@error{Unexpected n}{}%
\fi%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@x60\pgfmath@x\relax%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
\pgfmathdeclarefunction{@hours}{1}{%
\begingroup%
\expandafter\pgfmath@x#1pt\relax%
\pgfmath@x3600\pgfmath@x\relax%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
\pgfmathdeclarefunction{time@colon}{2}{%
\begingroup%
\pgfmath@x=#1pt\relax%
\pgfmath@x=60\pgfmath@x\relax%
\pgfmath@y=#2pt\relax%
\advance\pgfmath@x by\pgfmath@y%
\pgfmath@returnone\pgfmath@x%
\endgroup%
}%
% Sets general animation attributes
%
% #1 = key-value pairs that are executed for the path /pgf/animation/
\def\pgfanimationset{\pgfqkeys{/pgf/animation}}%
% Sets the target animation scope that should be animated.
%
% #1 = A name that will be used with an idscope.
%
% Example:
%
% \pgfanimateattribute{fill opacity}{whom=some scope, entry={0s}{1}, entry={1s}{0}}
% \begin{scope}[name=some scope]
% \draw (0,0) -- (1,1);
% \draw (1,0) -- (2,1);
% \end{scope}
\pgfanimationset{
whom/.code={%
\pgf@anim@decomp{#1}%
\pgfidrefnextuse\pgf@anim@id\pgf@anim@id@name%
\expandafter\expandafter\expandafter\pgfsysanimkeywhom\expandafter\expandafter\expandafter{\expandafter\pgf@anim@id\expandafter}\expandafter{\pgf@anim@type}%
\let\pgf@anim@whom@id\pgf@anim@id%
\let\pgf@anim@whom@type\pgf@anim@type%
}
}%
\def\pgf@anim@decomp#1{%
\edef\pgf@temp{#1}%
\expandafter\pgfutil@in@\expandafter.\expandafter{\pgf@temp}%
\ifpgfutil@in@%
\expandafter\pgf@anim@decomp@\pgf@temp\pgf@stop%
\else%
\expandafter\pgf@anim@decomp@\pgf@temp.\pgf@stop%
\fi%
}%
\def\pgf@anim@decomp@#1.#2\pgf@stop{%
\def\pgf@anim@id@name{#1}%
\def\pgf@anim@type{#2}%
}%
% Assigns a name to this animation so that it can be used as an event
% id in another animation
%
% #1 = A name
%
% The name "previous" is special and always refers to the most recent
% animation before the animation currently being constructed.
%
% Example:
%
% \pgfanimateattribute{fill opacity}{name=anim 1, entry={0s}{1}, entry={1s}{0}}
% \pgfanimateattribute{fill opacity}{begin on={end,of=anim 1}, entry={0s}{1}, entry={1s}{0}}
\pgfanimationset{
name/.code=\pgfuseid{#1},
}%
% Configures whether an animation can be restarted
%
% Some animations can restart when certain events take place. This key
% configures this. Setting it to
%
% "true" allows a restart at any time,
% "false" does not allow a restart,
% "when not active" allows a restart only, when the element is not
% active.
%
% Example:
%
% \pgfanimateattribute{fill opacity}{entry={0s}{1}, entry={1s}{0}, restart=false}
\pgfanimationset{
restart/.is choice,
restart/.default=true,
restart/true/.code=\pgfsysanimkeyrestartalways,
restart/false/.code=\pgfsysanimkeyrestartnever,
restart/never/.code=\pgfsysanimkeyrestartnever,
restart/when not active/.code=\pgfsysanimkeyrestartwhennotactive,
}%
% Sets the number times an animation should repeat
%
% #1 = A string of the following form:
%
% [<empty> | <number> | for <time>] ["accumulating"]
%
% When empty (the default value) the animation repeats forever.
%
% When a <number> is provided, the animation will repeat <number>
% times, which need not be an integer.
%
% When a <time> is given, the repeating will stop after this much time.
%
% When the optional "accumulating" is specified, the repeat
% accumulates, otherwise each repeat begins with the original start
% value.
%
% Example:
%
% \pgfanimateattribute{fill opacity}{repeats, entry={0s}{1}, entry={6s}{0}}
% \pgfanimateattribute{fill opacity}{repeats=2, entry={0s}{1}, entry={6s}{0}}
% \pgfanimateattribute{fill opacity}{repeats=2 accumulating, entry={0s}{1}, entry={6s}{0}}
% \pgfanimateattribute{fill opacity}{repeats=for 15s, entry={0s}{1}, entry={6s}{0}}
\pgfanimationset{
repeats/.code={%
\pgfutil@in@{accumulating\pgf@stop}{#1\pgf@stop}%
\ifpgfutil@in@%
\pgfsysanimkeyaccumulate%
\pgfanim@parse@acc#1\pgf@stop%
\else%
\pgfsysanimkeynoaccumulate%
\pgfanim@parse@noacc{#1}%
\fi%
},
repeats/.default=,
repeat/.style={repeats={#1}},
repeat/.default=,
}%
\def\pgfanim@parse@acc#1accumulating\pgf@stop{%
\pgfanim@parse@noacc{#1}%
}%
\def\pgfanim@parse@noacc#1{%
\pgfutil@in@{\pgf@stop for}{\pgf@stop#1}%
\ifpgfutil@in@%
\pgfanim@parse@for#1\pgf@stop%
\else%
\def\pgf@temp{#1}%
\ifx\pgf@temp\pgfutil@empty%
\pgfsysanimkeyrepeatindefinite%
\else%
\pgfmathparse{#1}%
\expandafter\pgfsysanimkeyrepeat\expandafter{\pgfmathresult}%
\fi%
\fi%
}%
\def\pgfanim@parse@for for#1\pgf@stop{\pgfparsetime{#1}\expandafter\pgfsysanimkeyrepeatdur\expandafter{\pgftimeresult}}%
% Specifies that an animation should begin or end at a certain time
% (relative to the current context). The "begin..." options may be
% used multiple times and their effects accumulate, likewise for the
% "end..." options.
%
% #1 = A time
%
% Example:
%
% \pgfanimateattribute{fill opacity}{begin=2s, end=2.5s, entry={0s}{1}, entry={1s}{0}}
\pgfanimationset{
begin/.code=\pgfparsetime{#1}\expandafter\pgfsysanimkeyoffset\expandafter{\pgftimeresult}{begin},
end/.code=\pgfparsetime{#1}\expandafter\pgfsysanimkeyoffset\expandafter{\pgftimeresult}{end},
}%
% Specifies that an animation should begin (or end) when a certain
% event takes place.
%
% #1 = A list of key-value pairs.
%
% The following keys are allowed:
%
% event=some event : The begin / end is triggered by that event. The
% list of allowed events is defined in the SVG
% standard.
% of=some name : The event does not refer to the current group,
% but to the object named "some name", which must
% previously have been named \pgfuseid. If some
% name contains a period, the part before the
% period must be the name of the id, the part
% following it the type of the id.
% key=some key : The trigger is some key being pressed
% repeat=number : The trigger is that an animation has been
% repeated number times.
% delay=time : A delay, may be negative.
%
% These keys are executed with the path prefix /pgf/animation/events.
%
% Some of them are predefined:
%
% "click" is a shorthand for "event=click"
% "focus in" is a shorthand for "event=focusin"
% "focus out" is a shorthand for "event=focusout"
% "activate" is a shorthand for "event=activate"
% "mouse down" is a shorthand for "event=mousedown"
% "mouse up" is a shorthand for "event=mouseup"
% "mouse over" is a shorthand for "event=mouseover"
% "mouse move" is a shorthand for "event=mousemove"
% "mouse out" is a shorthand for "event=mouseout"
% "begin" is a shorthand for "event=begin"
% "end" is a shorthand for "event=end"
%
% Example:
%
% % Begin after 5s or when clicked:
% \pgfanimateattribute{fill opacity}{begin=5s, begin on=click, entry={0s}{1}, entry={1s}{0}}
%
% % Begin, when an object named "button" is clicked
% \pgfanimateattribute{fill opacity}{begin on={click, of=button}, entry={0s}{1}, entry={1s}{0}, name=another animation}
%
% % Begin 1s after some other animation ends
% \pgfanimateattribute{fill opacity}{begin on={end, of=another animation, delay=1s}, entry={0s}{1}, entry={1s}{0}}
\pgfanimationset{
begin on/.code={\pgfanim@make@event{#1}{begin}},%
end on/.code={\pgfanim@make@event{#1}{end}},
}%
\def\pgfanim@make@event#1#2{%
\let\pgfanim@event@event\pgfutil@empty%
\let\pgf@anim@id\pgfutil@empty%
\let\pgf@anim@type\pgfutil@empty%
\let\pgfanim@event@key\pgfutil@empty%
\let\pgfanim@event@repeat\pgfutil@empty%
\let\pgfanim@event@delay\pgfutil@empty%
\pgfkeys{/pgf/animation/events/.cd,#1}%
\ifx\pgfanim@event@key\pgfutil@empty%
\ifx\pgfanim@event@repeat\pgfutil@empty%
\ifx\pgfanim@event@event\pgfutil@empty%
\pgferror{No event specified}%
\else%
\pgfsysanimkeyevent{\pgf@anim@id}{\pgf@anim@type}{\pgfanim@event@event}{\pgfanim@event@delay}{#2}%
\fi%
\else%
\pgfsysanimkeyrepeatevent{\pgf@anim@id}{\pgf@anim@type}{\pgfanim@event@repeat}{\pgfanim@event@delay}{#2}%
\fi%
\else%
\pgfsysanimkeyaccesskey{\pgfanim@event@key}{\pgfanim@event@delay}{#2}%
\fi%
}%
\pgfkeys{/pgf/animation/events/.cd,
event/.store in=\pgfanim@event@event,
of/.code={%
\pgf@anim@decomp{#1}%
\pgfidrefprevuse\pgf@anim@id\pgf@anim@id@name%
\ifx\pgf@anim@id\pgfutil@empty%
\pgferror{Unknown object/node name '\pgf@anim@id@name'. Did you
mean 'of next=\pgf@anim@id@name'?}%
\fi%
},
of next/.code={%
\pgf@anim@decomp{#1}%
\pgfidrefnextuse\pgf@anim@id\pgf@anim@id@name%
},
of id/.code=\def\pgf@anim@id{#1},
key/.store in=\pgfanim@event@key,
repeat/.code=\pgfmathparse{#1}\let\pgfanim@event@repeat\pgfmathresult,
delay/.code=\pgfparsetime{#1}\let\pgfanim@event@delay\pgftimeresult,
click/.style={event=click},
focus in/.style={event=focusin},
focus out/.style={event=focusout},
mouse down/.style={event=mousedown},
mouse up/.style={event=mouseup},
mouse over/.style={event=mouseover},
mouse move/.style={event=mousemove},
mouse out/.style={event=mouseout},
begin/.style={event=begin},
end/.style={event=end},
}%
% Specifies the timeline start for a snapshot
%
% #1 = a time
%
% Description:
%
% What a snapshot is taken of an animation (using \pgfsnapshot), all
% animations normally start at time 0s. When this key is used, the
% animation's timeline start is considered to be at moment #1
% instead.
\pgfanimationset{
begin snapshot/.code=
\pgfparsetime{#1}\expandafter\pgfsysanimkeysnapshotstart\expandafter{\pgftimeresult}
}%
% Specifies the origin for transforming animations
%
% #1 = a pgf point
%
% Specifies the origin of transformations (for instance, a rotate will
% rotate around this point).
%
% Example:
%
% \pgfanimateattribute{rotate}{entry={0s}{0}, entry={1s}{90}, origin=\pgfpoint{1cm}{1cm}}
\pgfanimationset{
origin/.code={%
\pgf@process{#1}%
\edef\pgf@marshal{%
\noexpand\pgfsysanimkeycanvastransform%
{\noexpand\pgftransformshift{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}{\noexpand\pgflowlevelsynccm}}%
{\noexpand\pgftransforminvert\noexpand\pgflowlevelsynccm}%
\noexpand\pgf@anim@save@transform{\noexpand\pgftransformshift{\noexpand\pgfqpoint{\the\pgf@x}{\the\pgf@y}}}%
}%
\pgf@marshal%
},
}%
\pgfsysanimkeycanvastransform{{\pgflowlevelsynccm}}{\pgftransforminvert\pgflowlevelsynccm}%
% Specifies the transforming for the animation coordinate system
%
% #1 = code that changes the pgf coordinate system
%
% Specifies an additional transformation of the coordinate system for
% animations.
%
% Example:
%
% \pgfanimateattribute{shift}{entry={0s}{\pgfpointorigin}, entry={1s}{\pgfpoint{1cm}{0cm}}, transform=\pgftransformrotate{30}}
\pgfanimationset{
transform/.code={%
\pgfsysanimkeycanvastransform{#1{\pgflowlevelsynccm}}{\pgftransforminvert\pgflowlevelsynccm}%
\pgf@anim@save@transform{#1}%
},
}%
% Specifies a motion path.
%
% #1 = pgf commands for constructing a path
%
% Use this key to specify a motion path for the motion attribute. The
% values of the "entry" key specify fractions along this path.
%
% Example:
%
% \pgfanimateattribute{motion}{
% entry={0s}{0}, entry={1s}{1},
% along=\pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{1cm}{1cm}}
% }
\pgfanimationset{
along/.code=%
{%
\pgfsyssoftpath@getcurrentpath\pgfanim@save@path%
\pgfsyssoftpath@setcurrentpath\pgfutil@empty%
#1%
\pgfsyssoftpath@getcurrentpath\pgfanim@the@path%
\global\let\pgfanim@the@path\pgfanim@the@path%
\pgfsyssoftpath@setcurrentpath\pgfanim@save@path%
}%
\expandafter\pgf@anim@protocol@path@size\pgfanim@the@path\pgf@stop%
\expandafter\pgfsysanimkeymovealong\expandafter{\pgfanim@the@path}%
}%
% Specifies a motion soft path.
%
% #1 = a pgf soft path (result of calling \pgfsyssoftpath@getcurrentpath)
%
% Use this key to specify a motion path for the motion attribute when
% a softpath has already been constructed.
%
% Example:
%
% \pgfanimateattribute{motion}{entry={0s}{0}, entry={1s}{1},
% along softpath=\pgfsyssoftpath@movetotoken {0pt}{0pt}\pgfsyssoftpath@linetotoken {10pt}{10pt}}
\pgfanimationset{
along softpath/.code=%
\pgf@anim@protocol@path@size#1\pgf@stop%
\pgfsysanimkeymovealong{#1}%
}%
\def\pgf@anim@protocol@path@size{%
\pgfutil@ifnextchar\pgf@stop\relax\pgf@anim@protocol@path@size@%
}%
\def\pgf@anim@protocol@path@size@#1#2#3{%
\pgf@protocolanimsizes@direct{#2}{#3}%
\pgf@anim@protocol@path@size%
}%
% Configures whether the motion is rotated along the path.
%
% Example:
%
% \pgfanimateattribute{motion}{rotate along, entry={0s}{0}, entry={1s}{1},
% along=\pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{1cm}{1cm}}}
\pgfanimationset{
rotate along/.is choice,
rotate along/.default=true,
rotate along/true/.code=\pgfsysanimkeyrotatealong,
rotate along/false/.code=\pgfsysanimkeynorotatealong,
}%
% Specifies an entry
%
% #1 = A time. This time will be parsed using \pgfparsetime
% #2 = A value. The format of this value depends on the current type
% of the animation attribute. (So for an animation of the "fill
% opacity", #1 must be a scalar value, for an animation of the "fill"
% color, #1 must be a color, and so on.)
% If #2 is the special text "current value", then the current
% value will be used. For SVG, this is allowed only when exactly
% two entries are specified and this special value is used for
% the first one.
%
% Example:
%
% \pgfanimateattribute{fill opacity}{entry={0s}{0}, entry={1s}{1}}
\pgfanimationset{entry/.code 2 args=\pgf@anim@entry{#1}{#2}}%
\def\pgf@anim@entry#1#2{%
\pgf@anim@entry@giventrue%
\pgfparsetime{#1}%
\edef\pgf@marshal{\noexpand\pgfsysanimkeytime{\pgftimeresult}\pgf@anim@entry@spline\pgf@anim@exit@spline}%
\pgf@marshal%
\def\pgf@temp{#2}%
\ifx\pgf@temp\pgf@special@current@text%
\pgfsysanimvalcurrent%
\else%
\pgfanim@type@parser{#2}%
\fi%
}%
\def\pgf@special@current@text{current value}%
\newif\ifpgf@anim@entry@given
% Specifies a base value
%
% #1 = A value. The format is as for the entry key.
%
% Description:
%
% Will set the "base" value of the animation, which is a value that is
% used when the animation is not active.
%
% Example:
%
% \pgfanimateattribute{fill opacity}{base = 0.5, entry={0s}{0.5}, entry={1s}{1}}
\pgfanimationset{base/.code=\pgf@anim@base{#1}}%
\def\pgf@anim@base#1{%
\pgfsysanimkeybase%
\pgfanim@type@parser{#1}%
}%
% Specifies that there is an entry "at infinity".
%
% When an animation ends, its "effect" can either persist or it can be
% removed. Setting "freeze at end" to true will cause it to persist,
% otherwise it will be removed.
%
% Example:
%
% \pgfanimateattribute{fill opacity}{entry={0s}{1}, entry={1s}{0}, freeze at end}
\pgfanimationset{
freeze at end/.is choice,
freeze at end/.default=true,
freeze at end/true/.code=\pgfsysanimkeyfreezeatend,
freeze at end/false/.code=\pgfsysanimkeyremoveatend,
}%
% Specifies an entry or exit spline control
%
% #1 = time fraction
% #2 = attribute fraction
%
% Description:
%
% Suppose that an animation is supposed to interpolate a attribute's
% value between the two values "50" and "100" over a time of 10s. The
% simplest way of doing so is to do a linear interpolation, where the
% value as, say, 1s is 55, at 2s it is 60, and so on.
%
% Unfortunately, the linear interpolation does not "look" nice in many
% cases since the acceleration of a linear interpolation is zero
% during the animation, but infinite at the beginning and at the end;
% which looks "jerky".
%
% To avoid this, you can specify that the time--attribute curve should
% not be a straight line, but rather a curve. You specify this curve
% using a spline.
%
% The most logical "coordinate rectangle" used for this spline in our
% example would be (0s,50) and (10s,100) and we would like to specify
% something like "(0s,50) .. controls (5s,50) and (9s,100)
% .. (10s,100)". This would result in a time--attribute curve where
% the attribute at 50 changes slowly at 0s and also arrives slowly at
% 100 at 10s, but speeds up between these values.
%
% We call the first control point (5s,50) the "exit control" and call
% (9s,100) the "entry control": The first control dictates how quickly
% or slowly a time point is left, the second dictates how quickly or
% slowly we enter the next one.
%
% The control points are, however, not specified in the coordinate
% system indicated above. Rather, the rectangle (0s,50) to (10s, 100),
% gets normalized to (0,0) to (1,1). The control point (5s,50) would
% thus become (0.5,0) and (9s,100) becomes (0.9,1).
%
% Example:
%
% \pgfanimateattribute{rotate}{
% exit control={0.5}{0},
% entry control={0.9}{1},
% entry={0s}{50},
% entry={10s}{100}}
\pgfanimationset{
entry control/.code 2 args={%
\pgfmathsetmacro\pgf@temp@t{#1}%
\pgfmathsetmacro\pgf@temp@a{#2}%
\edef\pgf@anim@entry@spline{{\pgf@temp@t}{\pgf@temp@a}}%
},
exit control/.code 2 args={%
\pgfmathsetmacro\pgf@temp@t{#1}%
\pgfmathsetmacro\pgf@temp@a{#2}%
\edef\pgf@anim@exit@spline{{\pgf@temp@t}{\pgf@temp@a}}%
},
stay/.code=\let\pgf@anim@exit@spline\pgfsys@stay@text,%
jump/.code=\let\pgf@anim@entry@spline\pgfsys@jump@text,%
linear/.style={entry control={1}{1},exit control={0}{0}},
}%
\def\pgf@anim@entry@spline@base{{1}{1}}%
\def\pgf@anim@exit@spline@base{{0}{0}}%
\def\pgf@anim@reset@linear{\let\pgf@anim@entry@spline\pgf@anim@entry@spline@base\let\pgf@anim@exit@spline\pgf@anim@exit@spline@base}%
\pgf@anim@reset@linear
% Specifies how much arrow tips should be shortened (as in
% \pgfsetshortenstart)
%
% #1 = an additional shortening distance the path start.
%
% Description:
%
% Works like \pgfsetshortenstart, only for animated paths.
\pgfanimationset{
shorten </.code={%
\ifpgf@anim@entry@given%
\pgferror{You must specify shorten < prior to the path entries}%
\else%
\pgfmathsetmacro\pgf@anim@marker@extra@shorten@start{#1}%
\edef\pgf@anim@marker@extra@shorten@start{\pgf@anim@marker@extra@shorten@start pt}%
\fi%
},
shorten >/.code={%
\ifpgf@anim@entry@given%
\pgferror{You must specify shorten < prior to the path entries}%
\else%
\pgfmathsetmacro\pgf@anim@marker@extra@shorten@end{#1}%
\edef\pgf@anim@marker@extra@shorten@end{\pgf@anim@marker@extra@shorten@end pt}%
\fi%
},
}%
\def\pgf@anim@marker@extra@shorten@start{0pt}%
\def\pgf@anim@marker@extra@shorten@end{0pt}%
\def\pgf@anim@marker@shorten@start{0pt}%
\def\pgf@anim@marker@shorten@end{0pt}%
% Specifies the arrow tips used for path animations
%
% #1 = an arrow specification of the form <start>-<end> as for the
% command \pgfsetarrows
%
% Description:
%
% Specifies arrow tips that are used in a path animation. Note that in
% order to set the arrow tips of a path that is animated, you always
% have to use this command. In particular, you should *not* set arrow
% tips for the to-be-animated path, but use this key and the base key
% to install a base path with arrow tips.
\pgfanimationset{
arrows/.code={%
\ifpgf@anim@entry@given%
\pgferror{You must specify animation arrows prior to the path entries}%
\else%
\pgf@anim@parser@arrows#1\pgf@stop%
\fi%
},
}%
\def\pgf@anim@parser@arrows#1-#2\pgf@stop{%
\pgf@anim@prepare@arrow@start{#1}%
\pgf@anim@prepare@arrow@end{#2}%
\expandafter\expandafter\expandafter\pgfsysanimkeytipmarkers\expandafter\expandafter\expandafter{\expandafter\pgf@anim@marker@id@start\expandafter}\expandafter{\pgf@anim@marker@id@end}%
}%
\def\pgf@anim@prepare@arrow@start#1{%
\def\pgf@anim@temp{#1}%
\ifx\pgf@anim@temp\pgfutil@empty%
\let\pgf@anim@marker@id@start\pgfutil@empty%
\def\pgf@anim@marker@shorten@start{0pt}%
\else%
{%
\pgfsetarrowsstart{#1}%
\pgf@anim@prep@marker@arrow\pgf@start@tip@sequence\pgf@anim@marker@id\pgf@anim@marker@shorten%
\global\let\pgf@anim@marker@id@start\pgf@anim@marker@id%
\global\let\pgf@anim@temp\pgf@anim@marker@shorten%
}%
\let\pgf@anim@marker@shorten@start\pgf@anim@temp%
\fi%
}%
\def\pgf@anim@prepare@arrow@end#1{%
\def\pgf@anim@temp{#1}%
\ifx\pgf@anim@temp\pgfutil@empty%
\let\pgf@anim@marker@id@end\pgfutil@empty%
\def\pgf@anim@marker@shorten@end{0pt}%
\else%
{%
\pgfsetarrowsend{#1}%
\pgf@anim@prep@marker@arrow\pgf@end@tip@sequence\pgf@anim@marker@id\pgf@anim@marker@shorten%
\global\let\pgf@anim@marker@id@end\pgf@anim@marker@id%
}%
\let\pgf@anim@marker@shorten@end\pgf@anim@marker@shorten%
\fi%
}%
% Draw an arrow using markers
\def\pgf@anim@prep@marker@arrow#1#2#3{%
% #1 = tip sequence
% #2 = macro for storing marker code
% #3 = macro for storing shortening length
%
% First, compute id's:
{%
\let\pgf@arrow@handle\pgf@anim@marker@id@test%
\let\pgf@arrow@handle@dot\relax%?
\global\let\pgf@anim@marker@id@list\pgfutil@empty%
#1%
}%
\expandafter\let\expandafter#2\csname pgfanim@marker@cache@\pgf@anim@marker@id@list\endcsname%
\expandafter\let\expandafter#3\csname pgfanim@marker@cachel@\pgf@anim@marker@id@list\endcsname%
\ifx#2\relax% ok, have to create it!
\pgf@relevantforpicturesizefalse%
\pgfinterruptpath%
\pgf@arrow@compute@shortening{#1}%
\xdef#3{\the\pgf@xa}%
{%
\let\pgf@arrow@handle\pgf@anim@drawer@marker
\let\pgf@arrow@handle@dot\relax%
\pgfsys@marker@declare#2{%
\pgftransformxshift{-\pgf@xb}%
\pgftransformxshift{\pgf@xa}%
#1%
}%
}%
\endpgfinterruptpath%
\expandafter\global\expandafter\let\csname pgfanim@marker@cache@\pgf@anim@marker@id@list\endcsname#2%
\expandafter\global\expandafter\let\csname pgfanim@marker@cachel@\pgf@anim@marker@id@list\endcsname#3%
\fi%
}%
\def\pgf@anim@marker@id@test#1#2{%
\pgfarrows@getid{#1}{#2}%
\expandafter\expandafter\expandafter\pgf@arrow@drawer@shift\csname pgf@ar@ends@\pgf@arrow@id\endcsname%
\xdef\pgf@anim@marker@id@list{\pgf@anim@marker@id@list:\pgf@arrow@id\ifpgfarrowswap s\else n\fi\pgfarrows@slant w\the\pgf@xc}%
}%
\def\pgf@anim@drawer@marker#1#2{%
% Prepare:
{%
\pgfarrows@getid{#1}{#2}%
% Do shift:
\expandafter\expandafter\expandafter\pgf@arrow@drawer@shift\csname pgf@ar@ends@\pgf@arrow@id\endcsname%
% Do slant:
\ifdim\pgfarrows@slant pt=0pt%
\else%
\pgftransformxslant{\pgfarrows@slant}%
\fi%
% do swap:
\ifpgfarrowswap%
\pgftransformyscale{-1}%
\fi%
{%
\csname pgf@ar@saves@\pgf@arrow@id\endcsname%
\pgfsys@beginscope%
\pgf@arrows@color@setup%
\pgflowlevelsynccm\csname pgf@ar@cache@\pgf@arrow@id\endcsname%
\pgfsys@endscope%
}%
\expandafter}%
% Transform to next tip:
\expandafter\pgftransformxshift\expandafter{\the\pgf@xc}%
}%
% The parsers
% Parse no value
%
% #1 is ignored
%
% Example:
%
% entry = {0s}{5+6}
\def\pgfanim@parse@type@none#1{%
\pgfsysanimvalnone%
}%
% Parse a scalar
%
% #1 is a number parsed using \pgfmathparse
%
% Example:
%
% entry = {0s}{5+6}
\def\pgfanim@parse@type@scalar#1{%
\pgfmathparse{#1}%
\expandafter\pgfsysanimvalscalar\expandafter{\pgfmathresult}%
}%
% Parse a dimension
%
% #1 is a number parsed using \pgfmathparse
%
% Example:
%
% entry = {0s}{5cm + 2pt}
\def\pgfanim@parse@type@dimension#1{%
\pgfmathparse{#1}%
\expandafter\pgfsysanimvaldimension\expandafter{\pgfmathresult pt}%
}%
% Parse a mapped text
%
% #1 is a text. It is looked up in \pgf@anim@map@#1 and gets replaced
% by what this macro expands to.
%
% Example:
%
% entry = {0s}{true}
\def\pgfanim@parse@type@mapped#1{%
{%
\expandafter\let\expandafter\pgf@temp\csname pgf@anim@map@#1\endcsname\relax%
\ifx\pgf@temp\relax%
\pgferror{Value '#1' not allowed for an animation for this attribute}%
\let\pgf@temp\pgfutil@empty%
\fi%
\expandafter}%
\expandafter\pgfsysanimvaltext\expandafter{\pgf@temp}%
}%
% Parse a color
%
% #1 is a color
%
% entry = {0s}{blue!20}
\def\pgfanim@parse@type@color#1{%
\pgfsysanimvalcolor{#1}%
}%
% Parse a path
%
% #1 is a sequence of pgf path construction commands
%
% entry = {0s}{\pgfpathmoveto{\pgfpointorigin} \pgfpathlineto{\pgfpoint{1cm}{1cm}}}
\def\pgfanim@parse@type@path#1{%
{%
\pgfsyssoftpath@getcurrentpath\pgfanim@save@path%
\pgfsyssoftpath@setcurrentpath\pgfutil@empty%
#1%
\pgfsyssoftpath@getcurrentpath\pgfanim@the@path%
\pgfprocessround{\pgfanim@the@path}{\pgfanim@the@path}%
\global\let\pgfanim@the@path\pgfanim@the@path%
\pgfsyssoftpath@setcurrentpath\pgfanim@save@path%
}%
\expandafter\pgfanim@parse@type@softpath\expandafter{\pgfanim@the@path}%
}%
% Parse a softpath
%
% #1 is a sequence of pgf softpath token commands
%
% entry = {0s}{\pgfsyssoftpath@movetotoken {0pt}{0pt}\pgfsyssoftpath@linetotoken {10pt}{10pt}}
\def\pgfanim@parse@type@softpath#1{%
{%
\def\pgf@anim@path{#1}%
% Shorten?
\pgf@worryfalse%
\pgf@xb=\pgf@anim@marker@extra@shorten@start%
\advance\pgf@xb by\pgf@anim@marker@shorten@start%
\pgf@xc=\pgf@anim@marker@extra@shorten@end%
\advance\pgf@xc by\pgf@anim@marker@shorten@end%
\ifdim\pgf@xb=0pt\else\pgf@worrytrue\fi%
\ifdim\pgf@xc=0pt\else\pgf@worrytrue\fi%
\ifpgf@worry%
\edef\pgf@path@shortening@distance@end{\the\pgf@xc}%
\edef\pgf@path@shortening@distance@start{\the\pgf@xb}%
% Yes! Need to shorten.
\pgf@anim@shorten@path%
\fi%
\expandafter}%
\expandafter\pgfsysanimvalpath\expandafter{\pgf@anim@path}%
}%
\def\pgf@anim@shorten@path{%
\pgf@precise@shorteningfalse%
\let\pgf@path@shortening@distance\pgf@path@shortening@distance@end%
%
% Step 1: Split
%
\pgfprocesssplitpath{\pgf@anim@path}%
\pgfprocesssplitsubpath{\pgfprocessresultpathsuffix}%
%
% Step 2: extract
%
\expandafter\pgf@parse@end\pgfprocessresultsubpathsuffix\pgf@stop\pgf@stop\pgf@stop%
%
% Step 3: prep end
%
\pgf@prep@end%
%
% Step 4: shorten end
%
\ifdim\pgf@path@shortening@distance=0pt\else\pgf@do@shorten@end\fi%
%
\let\pgf@path@shortening@distance\pgf@path@shortening@distance@start%
%
% Step 5: extract
%
\expandafter\pgf@parse@start\pgfprocessresultpathsuffix\pgf@stop\pgf@stop\pgf@stop%
%
% Step 6: prep start
%
\pgf@prep@start%
%
% Step 7: shorten start
%
\ifdim\pgf@path@shortening@distance=0pt\else\pgf@do@shorten@start\fi%
\expandafter\expandafter\expandafter\def%
\expandafter\expandafter\expandafter\pgf@anim@path%
\expandafter\expandafter\expandafter{\expandafter\pgfprocessresultpathprefix\pgfprocessresultpathsuffix}%
}%
% Parse a point
%
% #1 is a point
%
% entry = {0s}{\pgfpoint{1cm}{2cm}}
\def\pgfanim@parse@type@point#1{%
\pgf@process{#1}%
\pgf@protocolanimsizes\pgf@x\pgf@y%
\expandafter\expandafter\expandafter\pgfsysanimvaltranslate\expandafter\expandafter\expandafter{\expandafter\the\expandafter\pgf@x\expandafter}\expandafter{\the\pgf@y}%
}%
% Parse a scaling
%
% #1 = if #1 contains a comma, the two parts are passed to
% pgfmathparse, otherwise the whole thing is passed to pgfmathparse.
%
% entry = {0s}{2}
% entry = {0s}{2,1}
\def\pgfanim@parse@type@scaling#1{%
\pgfutil@in@{,}{#1}%
\ifpgfutil@in@%
\pgfanim@unpack@comma#1\pgf@stop%
\else%
\pgfmathparse{#1}%
\expandafter\pgfsysanimvalscale\expandafter{\pgfmathresult}{\pgfmathresult}%
\fi%
}%
\def\pgfanim@unpack@comma#1,#2\pgf@stop{%
\pgfmathsetmacro{\pgf@anim@temp@x}{#1}%
\pgfmathsetmacro{\pgf@anim@temp@y}{#2}%
\expandafter\expandafter\expandafter\pgfsysanimvalscale\expandafter\expandafter\expandafter{\expandafter\pgf@anim@temp@x\expandafter}\expandafter{\pgf@anim@temp@y}%
}%
% Parse a viewbox
%
% #1 consists of two points, each in parentheses
%
% entry = {0s}{{\pgfpoint{1cm}{2cm}}{\pgfpoint{3cm}{4cm}}}
\def\pgfanim@parse@type@viewbox#1{%
{%
\pgfanim@unpack@viewbox#1%
\xdef\pgf@anim@caller{\noexpand\pgfsysanimvalviewbox{\the\pgf@x}{\the\pgf@y}{\the\pgf@xa}{\the\pgf@ya}}%
}%
\pgf@anim@caller%
}%
\def\pgfanim@unpack@viewbox#1#2{%
\pgfpointtransformed{#2}%
\pgf@xa\pgf@x%
\pgf@ya\pgf@y%
\pgfpointtransformed{#1}%
\ifdim\pgf@xa<\pgf@x% swap needed
\pgf@xb=\pgf@x%
\pgf@x=\pgf@xa%
\pgf@xa=\pgf@xb%
\fi%
\ifdim\pgf@ya<\pgf@y% swap needed
\pgf@yb=\pgf@y%
\pgf@y=\pgf@ya%
\pgf@ya=\pgf@yb%
\fi%
}%
% Parse a dash pattern
%
% #1,#2 is a dash pattern as in \pgfsetdash
%
% entry = {0s}{{{1pt}{2pt}{3pt}{1pt}}{1pt}}
\def\pgfanim@parse@type@dash#1{\pgfanim@parse@type@dash@#1}%
\def\pgfanim@parse@type@dash@#1#2{%
\def\pgf@temp{}%
\def\pgf@next{\pgf@strip}%
\pgf@strip#1{pgf@stop}%
\expandafter\pgfsysanimvaldash\expandafter{\pgf@temp}{#2}%
}%
%
%
% Bounding box adjustments in animations.
%
%
\def\pgf@protocolanimsizes#1#2{%
\edef\pgf@temp{\noexpand\pgf@anim@handle@point{\the#1}{\the#2}}%
\expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@protocolanim@list\expandafter\expandafter\expandafter{\expandafter\pgf@protocolanim@list\pgf@temp}%
}%
\def\pgf@protocolanimsizes@direct#1#2{%
\expandafter\def\expandafter\pgf@protocolanim@list\expandafter{\pgf@protocolanim@list\pgf@anim@handle@point{#1}{#2}}%
}%
\let\pgf@protocolanim@list\pgfutil@empty
\def\pgf@animation@check@translate{%
\ifx\pgf@protocolanim@list\pgfutil@empty%
\else%
\expandafter\expandafter\expandafter\pgf@animation@check@translate@\expandafter\expandafter\expandafter{\expandafter\pgf@protocolanim@list\expandafter}\expandafter{\pgf@anim@saved@transform}%
\fi%
}%
\let\pgf@animation@check@motion\pgf@animation@check@translate
\def\pgf@animation@check@translate@#1#2{%
\pgfsys@attach@to@id\pgf@anim@whom@id\pgf@anim@whom@type{%
\pgf@size@hookedtrue%
{%
% Compute bounding box in local coordinate system
#2%
\pgf@pt@x0pt%
\pgf@pt@y0pt%
\pgf@picmaxx=-16000pt\relax%
\pgf@picminx=16000pt\relax%
\pgf@picmaxy=-16000pt\relax%
\pgf@picminy=16000pt\relax%
#1%
\edef\pgf@temp{{\the\pgf@picminx}{\the\pgf@picminy}{\the\pgf@picmaxx}{\the\pgf@picmaxy}}%
\expandafter%
}\expandafter%
\def\expandafter\pgf@temp\expandafter{\pgf@temp}%
\expandafter\expandafter\expandafter\def\expandafter\expandafter\expandafter\pgf@path@size@hook\expandafter\expandafter\expandafter{%
\expandafter\pgf@path@size@hook\expandafter\pgf@anim@bb\pgf@temp}%
}{}%
}%
\def\pgf@anim@handle@point#1#2{%
\pgf@x#1\pgf@y#2%
\pgf@pos@transform\pgf@x\pgf@y%
\ifdim\pgf@x<\pgf@picminx\pgf@picminx\pgf@x\fi%
\ifdim\pgf@x>\pgf@picmaxx\pgf@picmaxx\pgf@x\fi%
\ifdim\pgf@y<\pgf@picminy\pgf@picminy\pgf@y\fi%
\ifdim\pgf@y>\pgf@picmaxy\pgf@picmaxy\pgf@y\fi%
}%
\newdimen\pgf@anim@dim
\def\pgf@anim@bb#1#2#3#4{% (#1,#2) lower left, (#3, #4) upper right
\pgf@anim@dim\pgf@size@hook@x%
\advance\pgf@anim@dim by#1\relax%
\ifdim\pgf@anim@dim<\pgf@picminx\global\pgf@picminx\pgf@anim@dim\fi%
\pgf@anim@dim\pgf@size@hook@x%
\advance\pgf@anim@dim by#3\relax%
\ifdim\pgf@anim@dim>\pgf@picmaxx\global\pgf@picmaxx\pgf@anim@dim\fi%
\pgf@anim@dim\pgf@size@hook@y%
\advance\pgf@anim@dim by#2\relax%
\ifdim\pgf@anim@dim<\pgf@picminy\global\pgf@picminy\pgf@anim@dim\fi%
\pgf@anim@dim\pgf@size@hook@y%
\advance\pgf@anim@dim by#4\relax%
\ifdim\pgf@anim@dim>\pgf@picmaxy\global\pgf@picmaxy\pgf@anim@dim\fi%
}%
\def\pgf@anim@save@transform#1{%
\def\pgf@anim@saved@transform{#1}%
}%
\let\pgf@anim@saved@transform\pgfutil@empty%
\endinput
|