forked from agrahn/animate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
animate.sty
3588 lines (3503 loc) · 108 KB
/
animate.sty
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
% Copyright 2007--today Alexander Grahn
% This material is subject to the LaTeX Project Public License. See
% http://mirrors.ctan.org/macros/latex/base/lppl.txt
% for the details of that license.
% Package for creating portable, JavaScript driven animations from sets of
% graphics files or inline graphics (e. g. LaTeX-picture, PSTricks,
% pgf/TikZ, ...)
% Supports LaTeX->dvips->ps2pdf, (Xe)LaTeX->(x)dvipdfmx, LuaLaTeX and
% pdfLaTeX workflows.
\NeedsTeXFormat{LaTeX2e}
\def\@anim@version{2018/01/04}
\ProvidesPackage{animate}
[\@anim@version\space PDF animations from files and inline graphics]
%test for e-TeX
\expandafter\ifx\csname eTeXversion\endcsname\relax
\PackageError{animate}{%
Missing support for e-TeX; aborting...%
}{%
Use a TeX compiler that supports e-TeX and enable e-TeX %
in the format.%
}
\fi
\RequirePackage{xkeyval}
\RequirePackage{ifthen}
\RequirePackage{ifpdf}
\RequirePackage{ifluatex}
\RequirePackage{ifdraft}
\RequirePackage{calc}
\RequirePackage{graphics}%\scalebox, \resizebox, \rotatebox
%driver options (the only package options we process immediately)
\newboolean{@anim@dvips}
\setboolean{@anim@dvips}{false}
\newboolean{@anim@dvipdfmx}
\setboolean{@anim@dvipdfmx}{false}
\ifpdf\else
\setboolean{@anim@dvips}{true}% default dvi mode
\setboolean{@anim@dvipdfmx}{false}
\DeclareOptionX{dvips}{%
\setboolean{@anim@dvips}{true}
\setboolean{@anim@dvipdfmx}{false}
}
\DeclareOptionX{dvipdfmx}{%
\setboolean{@anim@dvipdfmx}{true}
\setboolean{@anim@dvips}{false}
\PassOptionsToPackage{dvipdfmx}{pdfbase}
}
\DeclareOptionX{xetex}{%
\setboolean{@anim@dvipdfmx}{true}
\setboolean{@anim@dvips}{false}
\PassOptionsToPackage{xetex}{pdfbase}
}
\fi
\newboolean{@anim@xetex}
\setboolean{@anim@xetex}{false}
\expandafter\ifx\csname XeTeXrevision\endcsname\relax\else
\setboolean{@anim@xetex}{true}
\setboolean{@anim@dvipdfmx}{true}
\setboolean{@anim@dvips}{false}
\fi
\DeclareOptionX*{}\ProcessOptionsX*\relax %allow anything as an option
%(remaining package options will be processed near end of this file)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{pdfbase}%low level PDF operations
\@ifpackagelater{pdfbase}{2017/09/29}{}{
\PackageError{animate}{%
Support package `pdfbase.sty' too old.%
}{%
Please install an up to date version of `pdfbase.sty'.\MessageBreak%
Aborting.%
}%
}
\ExplSyntaxOn
\let\@anim@literal\pbs_literal:nn
\def\@anim@dictobj#1{
\pbs_pdfobj:nnn{}{dict}{#1}
\xdef\@anim@lastobj{\pbs_pdflastobj:}
}
\def\@anim@arrayobj#1{
\pbs_pdfobj:nnn{}{array}{#1}
\xdef\@anim@lastobj{\pbs_pdflastobj:}
}
\def\@anim@streamobj#1#2{
\pbs_pdfobj:nnn{}{stream}{{#1}{#2}}
\xdef\@anim@lastobj{\pbs_pdflastobj:}
}
\def\@anim@xform#1#2#3#4#5{
\pbs_pdfxform:nnnnn{#1}{#2}{#3}{#4}{#5}
\xdef\@anim@lastxform{\pbs_pdflastxform:}
}
\let\@anim@refxform\pbs_pdfrefxform:n
\def\@anim@pdfannot#1#2#3#4{
\pbs_pdfannot:nnnn{#1}{#2}{#3}{#4}
}
\def\@anim@pdfwid#1#2#3#4{
\pbs_pdfannot:nnnn{#1}{#2}{#3}{#4}
\pbs_appendtofields:n{\pbs_pdflastann:}
}
\let\@anim@pdfcatalog\pbs_pdfcatalog:n
\let\@anim@fpeval\fp_eval:n
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\RequirePackage{ocgbase} %OCG generating and configuration macros
\def\@anim@newocg#1#2{%#1:@anim@num, #2:@anim@curframe@zb
\ocgbase@new@ocg{#1.#2}{}{1}%
\xdef\@anim@curocg{\ocgbase@last@ocg}%
}
\ifpdf\else
\if@anim@dvipdfmx\else % dvips
%if geometry package is loaded, execute `\geometry{dvips}' right before
% `\begin{document}'; not sure whether needed at all any more
\let\@anim@document\document
\def\document{%
\endgroup%
\@ifpackageloaded{geometry}{\geometry{dvips}}{}%
\begingroup%
\@anim@document%
}
%define `?pdfmark' operator as in file hdvips.def from package `hyperref'
\AtBeginDvi{%
\expandafter\ifx\csname pdfmark\endcsname\relax%
\special{!
systemdict /pdfmark known%
{%
userdict /?pdfmark systemdict /exec get put%
}{%
userdict /?pdfmark systemdict /pop get put
userdict /pdfmark systemdict /cleartomark get put%
}%
ifelse%
}%
\fi%
}
\fi
\fi
%\pdfmdfivesum is used for hashing object references of embedded files based
%on their MD5 digest (in order to avoid multiple inclusion); if it is not
%available, hashing will be based on the file name
\ifluatex
\RequirePackage{pdftexcmds}
\let\@anim@pdfmdfivesum\pdf@filemdfivesum
\else
\ifcsname pdfmdfivesum\endcsname
\def\@anim@pdfmdfivesum#1{\pdfmdfivesum file {#1}}
\else
\ifcsname mdfivesum\endcsname
\def\@anim@pdfmdfivesum#1{\mdfivesum file {#1}}
\else
\def\@anim@pdfmdfivesum#1{#1}
\fi
\fi
\fi
%creating and using global definitions
\def\@anim@newkey#1#2{{\expandafter\xdef\csname#1\endcsname{#2}}}
\def\@anim@getkeyval#1{\ifcsname#1\endcsname\csname#1\endcsname\fi}
\def\@animate@rerunwarn{%
\ifcsname @anim@rerunwarned\endcsname\else%
\gdef\@anim@rerunwarned{}%
\PackageWarningNoLine{animate}{%
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak
@ Rerun to get internal references right! @\MessageBreak
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}%
\fi%
}
%macro for writing global defs to external *.aux file
\def\@anim@keytoaux#1#2{%
\immediate\write\@mainaux{\string\@anim@newkey{#1}{#2}}%
\ifthenelse{\equal{\@anim@getkeyval{#1}}{#2}}{}{%
\AtEndDocument{\@animate@rerunwarn}}%
}
\AtBeginDocument{%
\immediate\write\@mainaux{\string\providecommand\string\@anim@newkey[2]{}}%
}
%missing package error message
\newcommand{\@anim@missing}[2][]{%
\ifthenelse{\equal{#1}{}}{%
\def\@anim@pkgopt{}%
}{%
\def\@anim@pkgopt{[#1]}%
}%
\PackageError{animate}{%
Package `#2' required.
Put the line\MessageBreak%
`\protect\usepackage\@anim@pkgopt{#2}'\MessageBreak%
to the preamble of your document%
}{}%
}
\newboolean{@anim@grxloaded}
\setboolean{@anim@grxloaded}{false}
\AtBeginDocument{%
\@ifpackageloaded{graphicx}{\setboolean{@anim@grxloaded}{true}}{}%
\gdef\@anim@lscape{}%
\gdef\@anim@@lscape{:ls}%
\ifdefined\landscape%
\g@addto@macro{\landscape}{\gdef\@anim@lscape{:ls}}%
\g@addto@macro{\endlandscape}{\gdef\@anim@lscape{}}%
\fi%
}
% true if any of `autoplay' or `autoresume' options is set
\newboolean{@anim@autoplayorresume}
% true if any of `controls' or `palindrome' or `label' options is set
\newboolean{@anim@timeline} %true if `timeline' option is set
\newboolean{@anim@multipage} % multipage document?
\newbox\@anim@box %stores animation frames
\newbox\@anim@measbox % for measuring purposes
\newdimen\@anim@tmpdima %length registers for occasional use
\newdimen\@anim@tmpdimb
\def\@anim@firstofthree#1#2#3{#1}
\def\@anim@secndofthree#1#2#3{#2}
\def\@anim@thirdofthree#1#2#3{#3}
%macros for recalling saved nat. dimensions
\def\@anim@xformnatwd#1{\expandafter\@anim@firstofthree#1}
\def\@anim@xformnatht#1{\expandafter\@anim@secndofthree#1}
\def\@anim@xformnatdp#1{\expandafter\@anim@thirdofthree#1}
%helper macro that typesets graphics file into savebox
\if@anim@dvips % dvips: no multi-page support
\def\@anim@filebox#1#2{% pdftex, xetex
\edef\@anim@curfile{[clip\@anim@gropts]{#1}}%
\global\setbox\@anim@box=\hbox{%
\expandafter\includegraphics\@anim@curfile}%
}
\else %pdfTeX, LuaTeX, dvipdfmx, xetex (multi-page)
\def\@anim@filebox#1#2{%
\edef\@anim@curfile{[clip\@anim@gropts,page=#2]{#1}}%
\global\setbox\@anim@box=\hbox{%
\expandafter\includegraphics\@anim@curfile}%
}
\fi
\def\@anim@checkboxsize#1#2{% #1: box number, #2: file
\ifdim\wd#1=\z@%
\PackageError{animate}{%
Graphics to be used for first frame%
\MessageBreak must not have zero width%
}{%
Check content of file #2%
}%
\fi%
\ifdim\ht#1=\z@\ifdim\dp#1=\z@%
\PackageError{animate}{%
Graphics to be used for first frame%
\MessageBreak must not have zero height%
}{%
Check content of file #2%
}%
\fi\fi%
}
%create Form XObject from graphics file
\def\@anim@ximage#1#2#3#4{%#1:@anim@num, #2:@anim@curframe@zb, #3:filename,
%#4: page number of multipage file
\edef\@anim@fingerprint{file:\@anim@pdfmdfivesum{#3}.#4.\@anim@gropts}%
\edef\@anim@curxform{\@anim@getkeyval{\@anim@fingerprint}}%
\ifthenelse{\equal{\@anim@curxform}{}}{%
% new file.page.graphicx_options
\@anim@filebox{#3}{#4}% store file in a box
\@anim@xinline{#1}{#2}{\@anim@box}{!}% delegate Form XObject creation
\@anim@newkey{\@anim@fingerprint}{\@anim@@lastxform}%
}{% file known, re-using existing form xobject
\edef\@anim@curndims{\@anim@getkeyval{natdims:\@anim@curxform}}% nat. dims
\setbox\@anim@box=\hbox to \@anim@xformnatwd{\@anim@curndims}{%
\vrule width \z@
height \@anim@xformnatht{\@anim@curndims}
depth \@anim@xformnatdp{\@anim@curndims}\hss%
}%
\@anim@xinline{#1}{#2}{\@anim@box}{\@anim@curxform}%
}%
}
%creates Form XObject from box contents
\def\@anim@xinline#1#2#3#4{%
\edef\@anim@curwd{\the\wd#3}%
\edef\@anim@curht{\the\ht#3}%
\edef\@anim@curdp{\the\dp#3}%
\ifnum#2=\z@\relax%
%nat. dims of zeroth frame
\xdef\@anim@zframewd{\@anim@curwd}%
\xdef\@anim@zframeht{\@anim@curht}%
\xdef\@anim@zframedp{\@anim@curdp}%
%determine size of animation widget
\setbox\@anim@measbox=\hbox to \wd#3{%
\vrule width \z@ height \ht#3 depth \dp#3\hss}%
\@anim@scale{\@anim@measbox}%
\else%
\def\@anim@needresize{0}%
%test if natural dimensions of the current frame differ from those
%of the 0th frame
\ifdim\wd#3=\@anim@zframewd\else\def\@anim@needresize{1}\fi%
\ifdim\ht#3=\@anim@zframeht\else\def\@anim@needresize{1}\fi%
\ifdim\dp#3=\@anim@zframedp\else\def\@anim@needresize{1}\fi%
\fi%
%create form xobject from box argument
\ifthenelse{\equal{#4}{!}}{% %%%% new graphics %%%%
%put graphics into XObject
\@anim@xform{1}{0}{}{}{#3}%
\xdef\@anim@@lastxform{\@anim@lastxform}%
\@anim@newkey{natdims:\@anim@lastxform}{%
{\@anim@curwd}{\@anim@curht}{\@anim@curdp}%
}%
}{%
\xdef\@anim@lastxform{#4}%
}%
\ifnum#2>\z@\relax%
%adjust size of current frame to zeroth frame's dims, if necessary
\ifnum\@anim@needresize>\z@\relax%
\global\setbox#3=\hbox to \@anim@curwd{%
\vrule width \z@ height \@anim@curht depth \@anim@curdp%
\noexpand\@anim@refxform{\@anim@lastxform}%
\hss%
}%
\global\setbox#3=\hbox{%
\raisebox{-\@anim@zframedp}{%
\resizebox*{\@anim@zframewd}{%
\dimexpr\@anim@zframeht+\@anim@zframedp\relax%
}{\raisebox{\depth}{\box#3}}%
}%
}%
\@anim@xform{0}{0}{}{}{#3}%
\fi%
\fi%
%keep a record of XObject number
\@anim@newkey{img@#2}{\@anim@lastxform}%
\if@anim@timeline\else%
\@anim@newkey{frmcontent@#2}{\@anim@getkeyval{img@#2},}%
\@anim@makeframe{#1}{#2}%
\fi%
\message{<a#1,fr#2>}%
}
\def\@anim@insertfrmcontent#1,#2\@nil{%
\ifthenelse{\equal{#1}{}}{}{%
\if@anim@dvips%
\@anim@refxform{{#1}}%
\else%
\@anim@refxform{#1}%
\fi%
}%
\ifthenelse{\equal{#2}{}}{}{\@anim@insertfrmcontent#2\@nil}%
}
%inserts one animation frame into the output acc. to
% \ifcase\@anim@method as
% 0 & 1: non-interactive Widget annotation
% 2: Form XObject referenced in the page content, tagged as OC
% animation
\def\@anim@makeframe#1#2{%
%container box
\edef\@anim@tmpvar{\@anim@getkeyval{frmcontent@#2},}%
\global\setbox\@anim@box=\hbox to \@anim@zframewd{%
\vrule width \z@ height \@anim@zframeht depth \@anim@zframedp%
\expandafter\@anim@insertfrmcontent\@anim@tmpvar\@nil%
\hss%
}%
%inside a `landscape' environment together with the icon and widget methods,
%the frame content needs to be rotated counter-clockwise by 90 deg
\ifnum\@anim@method>\@ne\else%
\ifx\@anim@lscape\@anim@@lscape%
\global\setbox\@anim@box=\hbox{\rotatebox{90}{\box\@anim@box}}%
\fi%
\fi%
\ifcase\@anim@method% icon based
\@anim@xform{0}{1}{}{}{\@anim@box}%
%initial visibility
\ifnum\@anim@poster>\@anim@mtwo\relax% insert poster frame
\ifnum#2=\@anim@poster\relax%
\edef\@anim@posterap{\@anim@lastxform}%
\else%
\ifnum\@anim@poster=\@anim@mone\relax% use last frame as poster
\edef\@anim@posterap{\@anim@lastxform}%
\fi%
\fi%
\fi%
%insert (invisible) widget with current frame as appearance
\@anim@pdfwid{\@anim@animwidth}{\@anim@animheight}{\@anim@animdepth}{%
/Subtype/Widget%
/F 2%
/FT/Btn/Ff 65537%
/BS <</W 0>>%
/AP <</N \@anim@lastxform>>%
/MK <</TP 1/I \@anim@lastxform/IF<</S/A/FB true>>>>%
/T (#1.#2)%
}%
\or% widget based
%initial visibility
\def\@anim@annotflag{/F 2}% default: hidden
\ifnum\@anim@poster>\@anim@mtwo\relax% insert poster frame
\ifnum#2=\@anim@poster\relax%
\def\@anim@annotflag{/F 4}% not hidden + print (4)
\else%
\ifnum\@anim@poster=\@anim@mone\relax% use last frame as poster
\ifthenelse{%
\NOT\equal{\@anim@getkeyval{a#1.poster}}{}\AND%
#2=\@anim@getkeyval{a#1.poster}%
}{%
\def\@anim@annotflag{/F 4}%
}{}%
\fi%
\fi%
\fi%
%frame insertion
\@anim@xform{0}{1}{}{}{\@anim@box}%
\@anim@pdfwid{\@anim@animwidth}{\@anim@animheight}{\@anim@animdepth}{%
/Subtype/Widget%
\@anim@annotflag%
/FT/Btn/Ff 65537%
/BS <</W 0>>%
/AP <</N \@anim@lastxform>>%
/MK <</TP 1/I \@anim@lastxform/IF<</S/A/FB true>>>>%
/T (#1.#2)%
}%
\or% ocg based
\@anim@newocg{#1}{#2}%
%initial visibility
\ifnum\@anim@poster=\@anim@mone\relax% use last frame as poster
\ifthenelse{%
\NOT\equal{\@anim@getkeyval{a#1.poster}}{}\AND%
#2=\@anim@getkeyval{a#1.poster}%
}{}{%
\ocgbase@add@to@off@list{\@anim@curocg}%
}%
\else%
\ifnum#2=\@anim@poster\relax\else%
\ocgbase@add@to@off@list{\@anim@curocg}%
\fi%
\fi%
\def\@anim@needresize{0}%
\ifdim\@anim@animwidth=\@anim@zframewd\else%
\def\@anim@needresize{1}\fi%
\ifdim\@anim@animheight=\@anim@zframeht\else%
\def\@anim@needresize{1}\fi%
\ifdim\@anim@animdepth=\@anim@zframedp\else%
\def\@anim@needresize{1}\fi%
\ifnum\@anim@needresize>\z@\relax%
\global\setbox\@anim@box=\hbox{%
\raisebox{-\@anim@animdepth}{%
\resizebox*{\@anim@animwidth}{%
\dimexpr\@anim@animheight+\@anim@animdepth\relax%
}{\raisebox{\depth}{\box\@anim@box}}%
}%
}%
\fi%
%frame insertion
% % marked content method
% \@anim@xform{0}{0}{}{}{\@anim@box}%
% \ocgbase@oc@bdc{\@anim@curocg}%
% \@anim@refxform{\@anim@lastxform}%
% \ocgbase@oc@emc%
% /OC method
\@anim@xform{0}{0}{}{/OC \@anim@curocg}{\@anim@box}%
\@anim@refxform{\@anim@lastxform}%
\fi%
}
%create XObjects of all button faces
\if@anim@dvips
%stroking commands
\def\@anim@btnend{%
\@anim@fg\space
0.5 setlinewidth
1 setlinecap
1 setlinejoin
6.5 1 moveto
1 1 1 6.5 2 arct
1 6.5 lineto
1 14 6.5 14 2 arct
6.5 14 lineto
14 14 14 6.5 2 arct
14 6.5 lineto
14 1 6.5 1 2 arct
closepath
\ifx\empty\@anim@bg\empty\else
gsave \@anim@bg\space fill grestore
\fi
stroke
%
1 setlinewidth
4.5 4.7 moveto
8.6 7.5 lineto
4.5 10.3 lineto
stroke
0 setlinejoin
10.0 4.7 moveto
10.0 10.3 lineto
stroke
}
\def\@anim@btnstep{%
\@anim@fg\space
0.5 setlinewidth
1 setlinecap
1 setlinejoin
6.5 1 moveto
1 1 1 6.5 2 arct
1 6.5 lineto
1 14 6.5 14 2 arct
6.5 14 lineto
14 14 14 6.5 2 arct
14 6.5 lineto
14 1 6.5 1 2 arct
closepath
\ifx\empty\@anim@bg\empty\else
gsave \@anim@bg\space fill grestore
\fi
stroke
%
1 setlinewidth
5.5 4.7 moveto
9.6 7.5 lineto
5.5 10.3 lineto
stroke
}
\def\@anim@btnplay{%
\@anim@fg\space
0.5 setlinewidth
1 setlinecap
1 setlinejoin
0 1 moveto
14 1 14 6.5 2 arct
14 6.5 lineto
14 14 1 14 2 arct
0 14 lineto
\ifx\empty\@anim@bg\empty\else
gsave closepath \@anim@bg\space fill grestore
\fi
stroke
0.1 setlinewidth
0 14 moveto
0 1 lineto
stroke
%
1 setlinewidth
5 4 moveto
5 11 lineto
10 7.5 lineto
closepath
stroke
}
\def\@anim@btnpause{%
\@anim@fg\space
0.5 setlinewidth
1 setlinecap
1 setlinejoin
0 1 moveto
14 1 14 6.5 2 arct
14 6.5 lineto
14 14 1 14 2 arct
0 14 lineto
\ifx\empty\@anim@bg\empty\else
gsave closepath \@anim@bg\space fill grestore
\fi
stroke
%
0 setlinecap
2 setlinewidth
2.2 4 moveto
2.2 11 lineto
stroke
}
\def\@anim@btnminus{%
\@anim@fg\space
0.5 setlinewidth
1 setlinecap
1 setlinejoin
6.5 1 moveto
1 1 1 6.5 2 arct
1 6.5 lineto
1 14 6.5 14 2 arct
6.5 14 lineto
14 14 14 6.5 2 arct
14 6.5 lineto
14 1 6.5 1 2 arct
closepath
\ifx\empty\@anim@bg\empty\else
gsave \@anim@bg\space fill grestore
\fi
stroke
%
1.0 setlinewidth
0 setlinecap
4.7 7.5 moveto
10.3 7.5 lineto
stroke
}
\def\@anim@btnplus{%
\@anim@fg\space
0.5 setlinewidth
1 setlinecap
1 setlinejoin
6.5 1 moveto
1 1 1 6.5 2 arct
1 6.5 lineto
1 14 6.5 14 2 arct
6.5 14 lineto
14 14 14 6.5 2 arct
14 6.5 lineto
14 1 6.5 1 2 arct
closepath
\ifx\empty\@anim@bg\empty\else
gsave \@anim@bg\space fill grestore
\fi
stroke
%
1.0 setlinewidth
0 setlinecap
4.7 7.5 moveto
10.3 7.5 lineto
7.5 4.7 moveto
7.5 10.3 lineto
stroke
}
\def\@anim@btnreset{%
\@anim@fg\space
0.5 setlinewidth
1 setlinecap
1 setlinejoin
6.5 1 moveto
1 1 1 6.5 2 arct
1 6.5 lineto
1 14 6.5 14 2 arct
6.5 14 lineto
14 14 14 6.5 2 arct
14 6.5 lineto
14 1 6.5 1 2 arct
closepath
\ifx\empty\@anim@bg\empty\else
gsave \@anim@bg\space fill grestore
\fi
stroke
%
1 setlinewidth
7.5 4.7 moveto
7.5 10.3 lineto
stroke
0 setlinejoin
3.5 5 moveto
7 7.5 lineto
3.5 10 lineto
closepath
fill
11.5 5 moveto
8 7.5 lineto
11.5 10 lineto
closepath
fill
1 setlinewidth
2 setlinecap
3 7.5 moveto
3.5 7.5 lineto
12 7.5 moveto
11.5 7.5 lineto
stroke
}
\def\@anim@makebuttons#1{% #1: @anim@num
\@anim@xbutton{EndLeft}{%
[-1 0 0 1 15 0] concat
\ifx\@anim@lscape\@anim@@lscape [0 -1 -1 0 15 15] concat \fi%
\@anim@btnend}{#1}%
\@anim@xbutton{EndRight}{%
\ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi%
\@anim@btnend}{#1}%
\@anim@xbutton{Minus}{%
\ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi%
\@anim@btnminus}{#1}%
\@anim@xbutton{PauseLeft}{%
[-1 0 0 1 15 0] concat
\ifx\@anim@lscape\@anim@@lscape [0 -1 -1 0 15 15] concat \fi%
\@anim@btnpause}{#1}%
\@anim@xbutton{PauseRight}{%
\ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi%
\@anim@btnpause}{#1}%
\@anim@xbutton{PlayLeft}{%
[-1 0 0 1 15 0] concat
\ifx\@anim@lscape\@anim@@lscape [0 -1 -1 0 15 15] concat \fi%
\@anim@btnplay}{#1}%
\@anim@xbutton{PlayRight}{%
\ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi%
\@anim@btnplay}{#1}%
\@anim@xbutton{Plus}{\@anim@btnplus}{#1}%
\@anim@xbutton{Reset}{%
\ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi%
\@anim@btnreset}{#1}%
\@anim@xbutton{StepLeft}{%
[-1 0 0 1 15 0] concat
\ifx\@anim@lscape\@anim@@lscape [0 -1 -1 0 15 15] concat \fi%
\@anim@btnstep}{#1}%
\@anim@xbutton{StepRight}{%
\ifx\@anim@lscape\@anim@@lscape [0 1 -1 0 15 0] concat \fi%
\@anim@btnstep}{#1}%
}
\def\@anim@xbutton#1#2#3{% #1: name; #2: stroking commands, #3 @anim@num
\global\setbox\@anim@box=\hbox to 15bp {\vbox to 15bp {\vss%
\@anim@literal{}{#2}%
}\hss}%
%distill box into XObject
\@anim@xform{0}{1}{}{%
\ifx\empty\@anim@alpha\empty\else/Group <</S/Transparency>>\fi%
}{\@anim@box}%
%nested XObject if transparency is to be added
\ifx\empty\@anim@alpha\empty\else%
\global\setbox\@anim@box=\hbox to 15bp {\vbox to 15bp {\vss%
\@anim@literal{direct}{%
/.setopacityalpha where {%
%Ghostscript
pop \@anim@alpha\space .setopacityalpha%
}{%
%Distiller
mark /CA \@anim@alpha /ca \@anim@alpha /SetTransparency pdfmark%
} ifelse%
}%
\@anim@refxform{\@anim@lastxform}%
}\hss}%
\@anim@xform{0}{0}{}{}{\@anim@box}%
\fi%
\@anim@newkey{btn#1:#3}{\@anim@lastxform}%
}
\else %pdftex/dvipdfmx/xetex
%stroking commands
\def\@anim@btnend{%
5 w
1 J
1 j
\@anim@fg\space
65 10 m
30 10 l
18.957 10 10 18.957 10 30 c
10 120 l
10 131.043 18.957 140 30 140 c
120 140 l
131.043 140 140 131.043 140 120 c
140 30 l
140 18.957 131.043 10 120 10 c
\ifx\empty\@anim@bg\empty s
\else\@anim@bg\space b \fi
%
10 w
45 47 m
86 75 l
45 103 l
S
0 j
100 47 m
100 103 l
S
}
\def\@anim@btnstep{%
5 w
1 J
1 j
\@anim@fg\space
65 10 m
30 10 l
18.957 10 10 18.957 10 30 c
10 120 l
10 131.043 18.957 140 30 140 c
120 140 l
131.043 140 140 131.043 140 120 c
140 30 l
140 18.957 131.043 10 120 10 c
\ifx\empty\@anim@bg\empty s
\else\@anim@bg\space b \fi
%
10 w
55 47 m
96 75 l
55 103 l
S
}
\def\@anim@btnplay{%
5 w
1 J
1 j
\@anim@fg\space
0 10 m
120 10 l
131.043 10 140 18.957 140 30 c
140 120 l
140 131.043 131.043 140 120 140 c
0 140 l
\ifx\empty\@anim@bg\empty S
\else\@anim@bg\space B \fi
1 w
0 140 m
0 10 l
S
%
10 w
50 40 m
50 110 l
100 75 l
s
}
\def\@anim@btnpause{%
5 w
1 J
1 j
\@anim@fg\space
0 10 m
120 10 l
131.043 10 140 18.957 140 30 c
140 120 l
140 131.043 131.043 140 120 140 c
0 140 l
\ifx\empty\@anim@bg\empty S
\else\@anim@bg\space B \fi
%
0 J
20 w
22 40 m
22 110 l
S
}
\def\@anim@btnminus{%
5 w
1 J
1 j
\@anim@fg\space
65 10 m
30 10 l
18.957 10 10 18.957 10 30 c
10 120 l
10 131.043 18.957 140 30 140 c
120 140 l
131.043 140 140 131.043 140 120 c
140 30 l
140 18.957 131.043 10 120 10 c
\ifx\empty\@anim@bg\empty s
\else\@anim@bg\space b \fi
%
10 w
0 J
47 75 m
103 75 l
S
}
\def\@anim@btnplus{%
5 w
1 J
1 j
\@anim@fg\space
65 10 m
30 10 l
18.957 10 10 18.957 10 30 c
10 120 l
10 131.043 18.957 140 30 140 c
120 140 l
131.043 140 140 131.043 140 120 c
140 30 l
140 18.957 131.043 10 120 10 c
\ifx\empty\@anim@bg\empty s
\else\@anim@bg\space b \fi
%
10 w
0 J
47 75 m
103 75 l
75 47 m
75 103 l
S
}
\def\@anim@btnreset{%
5 w
1 J
1 j
\@anim@fg\space
65 10 m
30 10 l
18.957 10 10 18.957 10 30 c
10 120 l
10 131.043 18.957 140 30 140 c
120 140 l
131.043 140 140 131.043 140 120 c
140 30 l
140 18.957 131.043 10 120 10 c
\ifx\empty\@anim@bg\empty s
\else\@anim@bg\space b \fi
%
10 w
75 47 m
75 103 l
S
\@anim@@@fg\space
35 50 m
70 75 l
35 100 l
f
115 50 m
80 75 l
115 100 l
f
2 J
0 j
30 75 m
35 75 l
120 75 m
115 75 l
S
}
\def\@anim@makebuttons#1{%
\@anim@xbutton{EndLeft}{%
q -0.1 0 0 0.1 15 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 -1 -1 0 150 150 cm \fi%
\@anim@btnend\space Q%
}{#1}%
\@anim@xbutton{EndRight}{%
q 0.1 0 0 0.1 0 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 1 -1 0 150 0 cm \fi%
\@anim@btnend\space Q%
}{#1}%
\@anim@xbutton{Minus}{%
q 0.1 0 0 0.1 0 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 1 -1 0 150 0 cm \fi%
\@anim@btnminus\space Q%
}{#1}%
\@anim@xbutton{PauseLeft}{%
q -0.1 0 0 0.1 15 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 -1 -1 0 150 150 cm \fi%
\@anim@btnpause\space Q%
}{#1}%
\@anim@xbutton{PauseRight}{%
q 0.1 0 0 0.1 0 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 1 -1 0 150 0 cm \fi%
\@anim@btnpause\space Q%
}{#1}%
\@anim@xbutton{PlayLeft}{%
q -0.1 0 0 0.1 15 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 -1 -1 0 150 150 cm \fi%
\@anim@btnplay\space Q%
}{#1}%
\@anim@xbutton{PlayRight}{%
q 0.1 0 0 0.1 0 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 1 -1 0 150 0 cm \fi%
\@anim@btnplay\space Q%
}{#1}%
\@anim@xbutton{Plus}{%
q 0.1 0 0 0.1 0 0 cm
\@anim@btnplus\space Q%
}{#1}%
\@anim@xbutton{Reset}{%
q 0.1 0 0 0.1 0 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 1 -1 0 150 0 cm \fi%
\@anim@btnreset\space Q%
}{#1}%
\@anim@xbutton{StepLeft}{%
q -0.1 0 0 0.1 15 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 -1 -1 0 150 150 cm \fi%
\@anim@btnstep\space Q%
}{#1}%
\@anim@xbutton{StepRight}{%
q 0.1 0 0 0.1 0 0 cm
\ifx\@anim@lscape\@anim@@lscape 0 1 -1 0 150 0 cm \fi%
\@anim@btnstep\space Q%
}{#1}%
}
%XObject creation
\def\@anim@xbutton#1#2#3{% #1 name, #2 stroking commands, #3 @anim@num
\@anim@streamobj{%
/Type/XObject/Subtype/Form/BBox [0 0 15 15]
\ifx\empty\@anim@alpha\empty\else%
/Group <</S/Transparency>>%
\fi%
}{#2}%
\ifx\empty\@anim@alpha\empty\else%
\@anim@streamobj{%
/Type/XObject/Subtype/Form/BBox [0 0 15 15]%
/Resources <<%
/ExtGState <<%
/R1 <<%
/Type/ExtGState/ca \@anim@alpha/CA \@anim@alpha/AIS false%
>>%
>>%