summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/animate/animate.sty
diff options
context:
space:
mode:
authorManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-05-23 17:55:14 +0000
committerManuel Pégourié-Gonnard <mpg@elzevir.fr>2008-05-23 17:55:14 +0000
commitaf5e179beaeef6d3a42a66af8e470bee733e104d (patch)
tree99927264bfba3017fcc966d5c6000ae5cb667655 /Master/texmf-dist/tex/latex/animate/animate.sty
parent9c6b29ab3dc212c3906c98b1ed8dfd6e56a7b1e1 (diff)
animate update 2008/05/21
git-svn-id: svn://tug.org/texlive/trunk@8310 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate/animate.sty')
-rw-r--r--Master/texmf-dist/tex/latex/animate/animate.sty579
1 files changed, 411 insertions, 168 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index d2884911ab7..4cbcadfa1f0 100644
--- a/Master/texmf-dist/tex/latex/animate/animate.sty
+++ b/Master/texmf-dist/tex/latex/animate/animate.sty
@@ -8,12 +8,10 @@
% graphics files or inline graphics (e. g. LaTeX-picture, PSTricks,
% pgf/TikZ, ...)
-% makes use of OCGs (Optional Content Groups, aka PDF Layers)
-
% Supports LaTeX->dvips->ps2pdf or pdfLaTeX workflows.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{animate}[2008/05/09]
+\ProvidesPackage{animate}[2008/05/21]
%test for e-TeX
\ifx\eTeXversion\@undefined%
@@ -85,6 +83,24 @@
\def\@anim@newkey#1#2{{\expandafter\xdef\csname#1\endcsname{#2}}}
\def\@anim@getkeyval#1{\ifcsname#1\endcsname\csname#1\endcsname\fi}
+%macro for writing global defs to external *.aux file
+\def\@anim@keytoaux#1#2{%
+ \@bsphack\protected@write\@auxout{}{%
+ \string\@anim@newkey{#1}{#2}%
+ }\@esphack%
+ \ifcsname#1\endcsname\else%
+ \ifx\@anim@rerunwarned\@undefined%
+ \gdef\@anim@rerunwarned{}%
+ \AtEndDocument{%
+ \PackageWarningNoLine{animate}{%
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak
+ @@ Rerun to get object references right! @@\MessageBreak
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@}%
+ }%
+ \fi%
+ \fi%
+}
+
%missing package error message
\def\@anim@missing#1{%
\PackageError{animate}{%
@@ -104,6 +120,13 @@
}{}%
}
+%alternative animation method using OCGs (option `useocg')
+\newboolean{@anim@useocg}
+% true if any of `autoplay' or `autoresume' options is set
+\newboolean{@anim@autoplayorresume}
+% true if any of `controls' or `palindrome' options is set
+\newboolean{@anim@ctrlorplndrm}
+
%add AcroForm and OCProperties entries to Catalog
\ifpdf
\newcount\@anim@@fields
@@ -123,7 +146,6 @@
/OCGs \the\@anim@@ocgs\space 0 R
/D <<
/BaseState/OFF /ON \the\@anim@@posterocgs\space 0 R
-% /Order \the\@anim@@ocgs\space 0 R
>>
>>
}
@@ -159,7 +181,6 @@
/OCGs {@anim@ocgs}
/D <<
/BaseState/OFF /ON {@anim@posterocgs}
-% /Order {@anim@ocgs}
>>
>>
>> /PUT pdfmark
@@ -253,7 +274,7 @@
}
}
-\newboolean{@anim@timeline} %true if `timeline' option was set
+\newboolean{@anim@timeline} %true if `timeline' option is set
%creates Form XObject from box contents
\ifpdf%
@@ -345,6 +366,10 @@
}
\fi
+\def\@anim@posterlast{last}% helper macros
+\def\@anim@posterfirst{first}%
+\def\@anim@posternone{none}%
+
%creates OCG
\ifpdf
\def\@anim@newocg#1#2{%#1:@anim@num, #2:@anim@curframe@zb
@@ -353,13 +378,15 @@
%append to ocg array
\xdef\@anim@ocgs{\@anim@ocgs\space\@anim@curocg}%
%store ref to ocg if it's a poster
- \ifnum#2=0
- \def\@anim@posterframe{first}%
- \else%
- \def\@anim@posterframe{last}%
- \fi%
- \ifx\@anim@poster\@anim@posterframe%
- \xdef\@anim@posterocg{\@anim@curocg}%
+ \ifx\@anim@poster\@anim@posternone\else%
+ \ifnum#2=0
+ \ifx\@anim@poster\@anim@posterfirst%
+ \xdef\@anim@posterocg{\@anim@curocg}%
+ \fi%
+ \fi%
+ \ifx\@anim@poster\@anim@posterlast%
+ \xdef\@anim@posterocg{\@anim@curocg}%
+ \fi%
\fi%
}
\else
@@ -371,13 +398,15 @@
>> /PUT pdfmark
mark {@anim@ocgs} {@anim@ocg@#1@#2} /APPEND pdfmark
}%
- \ifnum#2=0
- \def\@anim@posterframe{first}%
- \else%
- \def\@anim@posterframe{last}%
- \fi%
- \ifx\@anim@poster\@anim@posterframe%
- \xdef\@anim@posterocg{@anim@ocg@#1@#2}%
+ \ifx\@anim@poster\@anim@posternone\else%
+ \ifnum#2=0
+ \ifx\@anim@poster\@anim@posterfirst%
+ \xdef\@anim@posterocg{@anim@ocg@#1@#2}%
+ \fi%
+ \fi%
+ \ifx\@anim@poster\@anim@posterlast%
+ \xdef\@anim@posterocg{@anim@ocg@#1@#2}%
+ \fi%
\fi%
}
\fi
@@ -395,22 +424,42 @@
}%
\immediate\pdfxform resources {%
/XObject <<\@anim@getkeyval{frmxobject@#2}>>}\@anim@box%
- %
- %frame widget, using the container XObject as its Appearance,
- %associated with the just created OCG
- \@anim@newocg{#1}{#2}% create new opt. content group (OCG)
+ \if@anim@useocg%
+ \@anim@newocg{#1}{#2}%
+ \def\@anim@annotflag{/F 4}%, print, visibility set by OCG
+ \else%
+ %widget visibility state
+ \def\@anim@annotflag{/F 2}%default: hidden (no view, no print)
+ \ifx\@anim@poster\@anim@posternone\else%
+ \ifnum#2=0
+ \ifx\@anim@poster\@anim@posterfirst%
+ \def\@anim@annotflag{/F 4}% visible, print, Locked
+ \fi%
+ \fi%
+ \ifx\@anim@poster\@anim@posterlast%
+ \@anim@keytoaux{a#1.poster}{#2}%
+ \ifthenelse{\equal{\@anim@getkeyval{a#1.poster}}{#2}}{%
+ \def\@anim@annotflag{/F 4}%
+ }{}%
+ \fi%
+ \fi%
+ \fi%
+ %frame widget, using the container XObject as its Appearance
\pdfannot
width \@anim@animwidth\p@ height \@anim@animheight\p@
depth \@anim@animdepth\p@
{%
/Subtype/Widget%
- /OC \@anim@curocg
- /F 4 % allow printing
+ \@anim@annotflag
+ \if@anim@useocg%
+ /OC \@anim@curocg %associate widget with the just created OCG
+ \fi%
/FT/Btn/Ff 65537% non-interactive push button
/BS <</W 0>>%
/AP <</N \the\pdflastxform\space 0 R>>%
- /T (anm#1fr#2)%
+ /T (#1.#2)%
}%
+ \xdef\@anim@fields{\@anim@fields\space\the\pdflastannot\space 0 R}%
}
\else
\def\@anim@makeframe#1#2{%
@@ -425,7 +474,25 @@
/Resources <</XObject <<\@anim@getkeyval{frmxobject@#2}>>>>
>> /PUT pdfmark
}%
- %
+ \if@anim@useocg%
+ \@anim@newocg{#1}{#2}%
+ \def\@anim@annotflag{/F 4}%, print, visibility set by OCG, Locked
+ \else%
+ \def\@anim@annotflag{/F 2}%
+ \ifx\@anim@poster\@anim@posternone\else%
+ \ifnum#2=0
+ \ifx\@anim@poster\@anim@posterfirst%
+ \def\@anim@annotflag{/F 4}% visible, print, Locked
+ \fi%
+ \fi%
+ \ifx\@anim@poster\@anim@posterlast%
+ \@anim@keytoaux{a#1.poster}{#2}%
+ \ifthenelse{\equal{\@anim@getkeyval{a#1.poster}}{#2}}{%
+ \def\@anim@annotflag{/F 4}% visible, print, Locked
+ }{}%
+ \fi%
+ \fi%
+ \fi%
%frame widget
\setlength{\unitlength}{1pt}%
\begin{picture}(0,0)% mark annotation rectangle
@@ -440,19 +507,21 @@
}%
}%
\end{picture}%
- \@anim@newocg{#1}{#2}%
\special{ps:
mark
/_objdef {annot@\the\@anim@fieldnum}%
/Rect [wid@llx wid@lly wid@urx wid@ury]%
/Subtype/Widget%
- /OC {@anim@ocg@#1@#2}
- /F 4
+ \@anim@annotflag
+ \if@anim@useocg%
+ /OC {@anim@ocg@#1@#2}
+ \fi%
/FT/Btn/Ff 65537
/BS <</W 0>>%
/AP <</N {@anim@anmfrm@#1@#2}>>%
- /T (anm#1fr#2)%
+ /T (#1.#2)%
/ANN pdfmark
+ mark {@anim@fields} {annot@\the\@anim@fieldnum} /APPEND pdfmark
}%
\global\advance\@anim@fieldnum by \@ne%
}
@@ -972,11 +1041,10 @@
%current frame
\newcount\@anim@curframe
-\newcount\@anim@curframe@zb% zero based
+\newcount\@anim@curframe@zb %zero based
%draftbox from savebox
\def\@anim@draftbox#1{% #1: box number
- %get size
\setlength{\unitlength}{1pt}%
\vtop{% draw boxes
\offinterlineskip%
@@ -1093,6 +1161,12 @@
\fi%
\@anim@reset% to default settings
\setkeys{anim@user}{#1}%
+ \ifthenelse{\boolean{@anim@autoplay}\OR\boolean{@anim@autoresume}}{%
+ \setboolean{@anim@autoplayorresume}{true}%
+ }{}%
+ \ifthenelse{\boolean{@anim@controls}\OR\boolean{@anim@palindrome}}{%
+ \setboolean{@anim@ctrlorplndrm}{true}%
+ }{}%
\def\@anim@base{#3}%
\def\@anim@first{#4}%
\def\@anim@last{#5}%
@@ -1110,6 +1184,8 @@
\@anim@getext{\@anim@base\@anim@first}%
\@anim@filebox{\@anim@base\@anim@first\@anim@ext}{1}%
\fi%
+ \@anim@getsize{\@anim@box}%
+ \@anim@scale%
%draw draftbox according to dimensions of the first frame
\@anim@draftbox{\@anim@box}%
\else%
@@ -1299,10 +1375,11 @@
%create JavaScript objects
\@anim@pojscript{#1}% to be executed on PO event
\@anim@otherjscript{#1}% on other events in the AA dict
- %add poster to posterocg array
- \def\@anim@posterframe{none}%
- \ifx\@anim@poster\@anim@posterframe\else%
- \xdef\@anim@posterocgs{\@anim@posterocgs\space\@anim@posterocg}%
+ \if@anim@useocg%
+ %add poster to posterocg array
+ \ifx\@anim@poster\@anim@posternone\else%
+ \xdef\@anim@posterocgs{\@anim@posterocgs\space\@anim@posterocg}%
+ \fi%
\fi%
\pdfannot
width \@anim@animwidth\p@ height \@anim@animheight\p@
@@ -1313,8 +1390,10 @@
/BS <</W 0>>%
/H/N%
/T (anm#1)%
- /AA <<% bind JavaScripts to trigger events
- /PO <</S/JavaScript/JS \@anim@pojscriptobj>>%
+ /AA <<% bind actions to trigger events
+ /PO <<%
+ /S/JavaScript/JS \@anim@pojscriptobj%
+ >>%
\@anim@otherjscriptkey%
>>%
}%
@@ -1343,12 +1422,13 @@
\end{picture}%
\@anim@pojscript{#1}%
\@anim@otherjscript{#1}%
- \def\@anim@posterframe{none}%
- \ifx\@anim@poster\@anim@posterframe\else%
- \special{ps:
- mark {@anim@posterocgs} {\@anim@posterocg} /APPEND pdfmark
- }%
- \fi
+ \if@anim@useocg%
+ \ifx\@anim@poster\@anim@posternone\else%
+ \special{ps:
+ mark {@anim@posterocgs} {\@anim@posterocg} /APPEND pdfmark
+ }%
+ \fi%
+ \fi%
\special{ps:
mark
/_objdef {annot@\the\@anim@fieldnum}%
@@ -1358,8 +1438,10 @@
/BS <</W 0>>%
/H/N%
/T (anm#1)%
- /AA <<%
- /PO <</S/JavaScript/JS {a#1@pojscript}>>%
+ /AA <<% bind actions to trigger events
+ /PO <<%
+ /S/JavaScript/JS {a#1@pojscript}%
+ >>%
\@anim@otherjscriptkey%
>>%
/ANN pdfmark
@@ -1417,6 +1499,7 @@
\end{picture}%
\special{ps:
mark
+ /_objdef {annot@\the\@anim@fieldnum}
/Rect [wid@llx wid@lly wid@urx wid@ury]
/Subtype/Widget
/FT/Btn/Ff 65536
@@ -1453,6 +1536,12 @@
\setboolean{@anim@inside}{true}%
\@anim@reset% to default settings
\setkeys{anim@user}{#1}%
+ \ifthenelse{\boolean{@anim@autoplay}\OR\boolean{@anim@autoresume}}{%
+ \setboolean{@anim@autoplayorresume}{true}%
+ }{}%
+ \ifthenelse{\boolean{@anim@controls}\OR\boolean{@anim@palindrome}}{%
+ \setboolean{@anim@ctrlorplndrm}{true}%
+ }{}%
\if@anim@draft\else%
%create button faces if necessary
\if@anim@controls%
@@ -2045,13 +2134,17 @@
\setboolean{@anim@autoplay}{false}
\define@key{anim@user}{autoplay}[true]{%
\setboolean{@anim@autoplay}{#1}%
- \if@anim@autoplay\setboolean{@anim@autoresume}{false}\fi%
+ \if@anim@autoplay%
+ \setboolean{@anim@autoresume}{false}%
+ \fi%
}
\newboolean{@anim@autoresume}
\setboolean{@anim@autoresume}{false}
\define@key{anim@user}{autoresume}[true]{%
\setboolean{@anim@autoresume}{#1}%
- \if@anim@autoresume\setboolean{@anim@autoplay}{false}\fi%
+ \if@anim@autoresume%
+ \setboolean{@anim@autoplay}{false}%
+ \fi%
}
\newboolean{@anim@autopause}
\setboolean{@anim@autopause}{false}
@@ -2063,7 +2156,6 @@
\define@key{anim@user}{palindrome}[true]{%
\setboolean{@anim@palindrome}{#1}%
}
-%default frame to be shown if animation is not activated
\define@key{anim@user}{poster}[first]{% | none | last
\ifthenelse{% correct wrong input to `none'
\equal{#1}{first}\OR%
@@ -2129,6 +2221,9 @@
\define@key{anim@user}{measure}[true]{%
\setboolean{@anim@meas}{#1}%
}
+\define@key{anim@user}{useocg}[true]{%
+ \setboolean{@anim@useocg}{#1}%
+}
%macro to reset macros and booleans
\def\@anim@reset{%
@@ -2151,6 +2246,7 @@
\global\let\if@anim@palindrome=\if@anim@@palindrome%
\global\let\if@anim@step=\if@anim@@step%
\global\let\if@anim@draft=\if@anim@@draft%
+ \global\let\if@anim@useocg=\if@anim@@useocg%
\gdef\@anim@posterocg{}%
\gdef\@anim@properties{}%
\setboolean{@anim@pauseframes}{false}%
@@ -2166,6 +2262,8 @@
\gdef\@anim@gropts{}%
\setboolean{@anim@multipdf}{false}%
\setboolean{@anim@meas}{false}%
+ \setboolean{@anim@autoplayorresume}{false}%
+ \setboolean{@anim@ctrlorplndrm}{false}%
}
%package options
@@ -2306,6 +2404,11 @@
\setboolean{@anim@@draft}{true}%
}%
}
+\newboolean{@anim@@useocg}
+\setboolean{@anim@@useocg}{false}
+\define@key{anim@pkg}{useocg}[true]{%
+ \setboolean{@anim@@useocg}{#1}%
+}
%process package options
\def\@anim@setpkgkeys#1{\setkeys{anim@pkg}{#1}}
@@ -2327,36 +2430,62 @@
}%
}
\fi
-\def\@anim@posterlast{last}% helper macro
\def\@anim@@pojscript#1{% #1: @anim@num
% console.show();%
% console.clear();%
+ \if@anim@useocg\else
+ if(typeof(curdoc)=='undefined'){var curdoc=this;}% ref to the Doc object
+ \fi
if(typeof(a#1)=='undefined'){% initialize animation
a#1=new Object();%
- %takes references to frame ocgs belonging to the current animation
+ %takes references to frame ocgs/Field objects belonging to the current
+ %animation
a#1.fr=new Array();%
%takes references to control button face ocgs
\if@anim@controls a#1.btn=new Array();\fi
- %get array of ocgs of current page
- var ocg=this.getOCGs(this.pageNum);%
- for(var i=0;i<ocg.length;i++){%
- var ocgName=ocg[i].name.split('.');%
- if(ocgName[0]==#1){%
- \if@anim@controls
- if(ocgName[1].charAt(0)=='P'){% PlayLeft, PauseLeft, ...
+ %initialize fr & btn properties
+ \if@anim@useocg
+ %get array of ocgs of current page
+ var ocg=this.getOCGs(this.pageNum);%
+ for(var i=0;i<ocg.length;i++){%
+ var ocgName=ocg[i].name.split('.');%
+ if(ocgName[0]==#1){%
+ \if@anim@controls
+ if(ocgName[1].charAt(0)=='P'){% PlayLeft, PauseLeft, ...
+ a#1.btn[ocgName[1]]=ocg[i];%
+ %set basic button state
+ a#1.btn[ocgName[1]].state=ocg[i].initState;%
+ }else{% frame ocg
+ \fi
+ a#1.fr[ocgName[1]]=ocg[i];%
+ %set basic frame state
+ a#1.fr[ocgName[1]].state=ocg[i].initState;%
+ \if@anim@controls%
+ }%
+ \fi%
+ }%
+ }%
+ \else
+ %get array of Field objects (frame widgets) of current page
+ for(i=0;i<this.numFields;i++){%
+ var fldName=this.getNthFieldName(i).split('.');%
+ if(fldName[0]==#1){%
+ a#1.fr[fldName[1]]=this.getField(this.getNthFieldName(i));%
+ }%
+ }%
+ \if@anim@controls
+ %get array of ocgs of current page
+ var ocg=this.getOCGs(this.pageNum);%
+ for(var i=0;i<ocg.length;i++){%
+ var ocgName=ocg[i].name.split('.');%
+ if(ocgName[0]==#1){%
a#1.btn[ocgName[1]]=ocg[i];%
%set basic button state
a#1.btn[ocgName[1]].state=ocg[i].initState;%
- }else{% frame ocg
- \fi
- a#1.fr[ocgName[1]]=ocg[i];%
- %set basic frame state
- a#1.fr[ocgName[1]].state=ocg[i].initState;%
- \if@anim@controls%
}%
- \fi%
- }%
- }%
+ }%
+ \fi%
+ \fi%
\ifx\@anim@poster\@anim@posterlast % set default frame
%holds index of the frame to be displayed
a#1.idx=\@anim@frames-1;%
@@ -2393,10 +2522,17 @@
\if@anim@step\else
a#1.actnPause();%
a#1.isPaused=false;% because it has been explicitly stopped
- \fi
- a#1.fr[a#1.idx].state=false;%
- a#1.idx=0;%
- a#1.fr[0].state=true;%
+ \fi%
+ \if@anim@useocg
+ a#1.fr[a#1.idx].state=false;%
+ a#1.idx=0;%
+ a#1.fr[0].state=true;%
+ \else
+ a#1.fr[a#1.idx].display=display.hidden;%
+ a#1.idx=0;%
+ a#1.fr[0].display=display.visible;%
+ curdoc.dirty=false;%
+ \fi%
\if@anim@chfps
a#1.fpsDeflt=Math.abs(\@anim@fps);%
a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);%
@@ -2407,10 +2543,17 @@
\if@anim@step\else
a#1.actnPause();%
a#1.isPaused=false;%
- \fi
- a#1.fr[a#1.idx].state=false;%
- a#1.idx=\@anim@frames-1;%
- a#1.fr[a#1.idx].state=true;%
+ \fi%
+ \if@anim@useocg
+ a#1.fr[a#1.idx].state=false;%
+ a#1.idx=\@anim@frames-1;%
+ a#1.fr[a#1.idx].state=true;%
+ \else
+ a#1.fr[a#1.idx].display=display.hidden;%
+ a#1.idx=\@anim@frames-1;%
+ a#1.fr[a#1.idx].display=display.visible;%
+ curdoc.dirty=false;%
+ \fi%
\if@anim@chfps %frame rate from the last fps change (\@anim@nfps)
a#1.fpsDeflt=Math.abs(\@anim@nfps);%
a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);%
@@ -2418,9 +2561,18 @@
\fi%
};%
a#1.actnNext=function(){%
- a#1.fr[a#1.idx].state=false;%
+ \if@anim@useocg
+ a#1.fr[a#1.idx].state=false;%
+ \else
+ a#1.fr[a#1.idx].display=display.hidden;%
+ \fi
try{%
- a#1.fr[++a#1.idx].state=true;%
+ \if@anim@useocg
+ a#1.fr[++a#1.idx].state=true;%
+ \else
+ a#1.fr[++a#1.idx].display=display.visible;%
+ curdoc.dirty=false;%
+ \fi%
\if@anim@step\else\if@anim@meas a#1.frcnt++;\fi\fi%
}catch(e){%
--a#1.idx;%
@@ -2428,8 +2580,13 @@
\if@anim@step
a#1.actnEndRight();%
a#1.playsRight=false;%
- \else
- a#1.fr[a#1.idx].state=true;%
+ \else%
+ \if@anim@useocg
+ a#1.fr[a#1.idx].state=true;%
+ \else
+ a#1.fr[a#1.idx].display=display.visible;%
+ curdoc.dirty=false;%
+ \fi%
\if@anim@meas if(a#1.isPlaying){a#1.stopMeas();}\fi
if(a#1.isPlaying){a#1.isPaused=true;a#1.actnPlayLeft();}%
\fi%
@@ -2469,58 +2626,74 @@
\fi%
\fi%
};%
- a#1.actnPrev=function(){%
- a#1.fr[a#1.idx].state=false;%
- try{%
- a#1.fr[--a#1.idx].state=true;%
- \if@anim@step\else\if@anim@meas a#1.frcnt++;\fi\fi%
- }catch(e){%
- ++a#1.idx;%
- \if@anim@palindrome%
- \if@anim@step
- a#1.actnEndLeft();%
- a#1.playsRight=true;%
+ \if@anim@ctrlorplndrm
+ a#1.actnPrev=function(){%
+ \if@anim@useocg
+ a#1.fr[a#1.idx].state=false;%
+ \else
+ a#1.fr[a#1.idx].display=display.hidden;%
+ \fi
+ try{%
+ \if@anim@useocg
+ a#1.fr[--a#1.idx].state=true;%
\else
- a#1.fr[a#1.idx].state=true;%
- \if@anim@meas if(a#1.isPlaying){a#1.stopMeas();}\fi
- if(a#1.isPlaying){a#1.isPaused=true;a#1.actnPlayRight();}%
+ a#1.fr[--a#1.idx].display=display.visible;%
+ curdoc.dirty=false;%
\fi%
- \else%
- \if@anim@step
- a#1.actnEndLeft();%
+ \if@anim@step\else\if@anim@meas a#1.frcnt++;\fi\fi%
+ }catch(e){%
+ ++a#1.idx;%
+ \if@anim@palindrome%
+ \if@anim@step
+ a#1.actnEndLeft();%
+ a#1.playsRight=true;%
+ \else%
+ \if@anim@useocg
+ a#1.fr[a#1.idx].state=true;%
+ \else
+ a#1.fr[a#1.idx].display=display.visible;%
+ curdoc.dirty=false;%
+ \fi%
+ \if@anim@meas if(a#1.isPlaying){a#1.stopMeas();}\fi
+ if(a#1.isPlaying){a#1.isPaused=true;a#1.actnPlayRight();}%
+ \fi%
\else%
- \if@anim@loop
- if(a#1.isPlaying){%
- \if@anim@chfps
- a#1.fpsDeflt=Math.abs(\@anim@nfps);%
- a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);%
- a#1.dt=a#1.dtDeflt;%
- \fi
- a#1.actnPlayLeft();%
- }else{a#1.actnEndLeft();}%
- \else
+ \if@anim@step
a#1.actnEndLeft();%
+ \else%
+ \if@anim@loop
+ if(a#1.isPlaying){%
+ \if@anim@chfps
+ a#1.fpsDeflt=Math.abs(\@anim@nfps);%
+ a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);%
+ a#1.dt=a#1.dtDeflt;%
+ \fi
+ a#1.actnPlayLeft();%
+ }else{a#1.actnEndLeft();}%
+ \else
+ a#1.actnEndLeft();%
+ \fi%
\fi%
\fi%
+ }%
+ \if@anim@step\else%
+ \if@anim@chfps
+ if(%
+ a#1.pFpsAt[a#1.idx]>=0&&%
+ a#1.pFpsAt[a#1.idx]!=a#1.fpsDeflt%
+ ){%
+ a#1.fpsDeflt=a#1.pFpsAt[a#1.idx];%
+ a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);%
+ a#1.dt=a#1.dtDeflt;%
+ if(a#1.isPlaying){a#1.isPaused=true;a#1.actnPlayLeft();}%
+ }%
+ \fi%
+ \if@anim@pauseframes
+ if(a#1.isPlaying&&a#1.pauseAt[a#1.idx]){a#1.actnPause();}%
+ \fi%
\fi%
- }%
- \if@anim@step\else%
- \if@anim@chfps
- if(%
- a#1.pFpsAt[a#1.idx]>=0&&%
- a#1.pFpsAt[a#1.idx]!=a#1.fpsDeflt%
- ){%
- a#1.fpsDeflt=a#1.pFpsAt[a#1.idx];%
- a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);%
- a#1.dt=a#1.dtDeflt;%
- if(a#1.isPlaying){a#1.isPaused=true;a#1.actnPlayLeft();}%
- }%
- \fi%
- \if@anim@pauseframes
- if(a#1.isPlaying&&a#1.pauseAt[a#1.idx]){a#1.actnPause();}%
- \fi%
- \fi%
- };%
+ };%
+ \fi%
\if@anim@step\else
a#1.actnPause=function(){%
\if@anim@meas if(a#1.isPlaying){a#1.stopMeas();}\fi
@@ -2549,21 +2722,23 @@
\if@anim@meas a#1.startMeas();\fi
a#1_int=app.setInterval('a#1.actnNext()',a#1.dt);%
};%
- a#1.actnPlayLeft=function(){%
- try{app.clearInterval(a#1_int);}catch(e){}%
- if(!a#1.isPaused){a#1.actnEndRight();}%
- a#1.playsRight=false;%
- a#1.isPlaying=true;%
- a#1.isPaused=false;%
- \if@anim@controls
- a#1.btn['PauseLeft'].state=true;%
- a#1.btn['PlayLeft'].state=false;%
- a#1.btn['PauseRight'].state=true;%
- a#1.btn['PlayRight'].state=false;%
- \fi%
- \if@anim@meas a#1.startMeas();\fi
- a#1_int=app.setInterval('a#1.actnPrev()',a#1.dt);%
- };%
+ \if@anim@ctrlorplndrm
+ a#1.actnPlayLeft=function(){%
+ try{app.clearInterval(a#1_int);}catch(e){}%
+ if(!a#1.isPaused){a#1.actnEndRight();}%
+ a#1.playsRight=false;%
+ a#1.isPlaying=true;%
+ a#1.isPaused=false;%
+ \if@anim@controls
+ a#1.btn['PauseLeft'].state=true;%
+ a#1.btn['PlayLeft'].state=false;%
+ a#1.btn['PauseRight'].state=true;%
+ a#1.btn['PlayRight'].state=false;%
+ \fi%
+ \if@anim@meas a#1.startMeas();\fi
+ a#1_int=app.setInterval('a#1.actnPrev()',a#1.dt);%
+ };%
+ \fi%
\if@anim@controls
a#1.actnIncr=function(){% speed up animation
try{app.clearInterval(a#1_int);}catch(e){}%
@@ -2620,51 +2795,115 @@
};%
\fi%
\fi%
+ \if@anim@useocg\else%
+ %actnEndLeft()/actnEndRight() & actnEndLeft()/actnEndRight() versions
+ %that also work in recent Readers,
+ %to be invoked by a#1_intd=app.setInterval(...)
+ a#1.actnSecEndLeft=function(){%
+ try{app.clearInterval(a#1_intd);}catch(e){}%
+ a#1.actnEndLeft();%
+ };%
+ a#1.actnSecEndRight=function(){%
+ try{app.clearInterval(a#1_intd);}catch(e){}%
+ a#1.actnEndRight();%
+ };%
+ \if@anim@step\else%
+ \if@anim@autoplayorresume%
+ \if@anim@ctrlorplndrm
+ a#1.actnSecPlayLeft=function(){%
+ try{app.clearInterval(a#1_intd);}catch(e){}%
+ a#1.actnPlayLeft();%
+ };%
+ \fi
+ a#1.actnSecPlayRight=function(){%
+ try{app.clearInterval(a#1_intd);}catch(e){}%
+ a#1.actnPlayRight();%
+ };%
+ \fi%
+ \fi%
+ \fi%
}%
\if@anim@step\else%
- \if@anim@autoplay
- if(a#1.playsRight){%
- a#1.actnPlayRight();%
- }else{%
- a#1.actnPlayLeft();%
- }%
+ \if@anim@autoplay%
+ \if@anim@useocg%
+ \if@anim@ctrlorplndrm
+ if(a#1.playsRight){a#1.actnPlayRight();}else{a#1.actnPlayLeft();}%
+ \else%
+ a#1.actnPlayRight();%
+ \fi%
+ \else
+ \if@anim@ctrlorplndrm
+ if(a#1.playsRight){%
+ a#1_intd=app.setInterval('a#1.actnSecPlayRight()',1);%
+ }else{%
+ a#1_intd=app.setInterval('a#1.actnSecPlayLeft()',1);%
+ }%
+ \else%
+ a#1_intd=app.setInterval('a#1.actnSecPlayRight()',1);%
+ \fi%
+ \fi%
\fi%
\if@anim@autoresume
if(a#1.isPaused){%
- if(a#1.playsRight){a#1.actnPlayRight();}else{a#1.actnPlayLeft();}%
+ \if@anim@useocg%
+ \if@anim@ctrlorplndrm
+ if(a#1.playsRight){a#1.actnPlayRight();}else{a#1.actnPlayLeft();}%
+ \else
+ a#1.actnPlayRight();%
+ \fi%
+ \else%
+ \if@anim@ctrlorplndrm
+ if(a#1.playsRight){%
+ a#1_intd=app.setInterval('a#1.actnSecPlayRight()',1);%
+ }else{%
+ a#1_intd=app.setInterval('a#1.actnSecPlayLeft()',1);%
+ }%
+ \else
+ a#1_intd=app.setInterval('a#1.actnSecPlayRight()',1);%
+ \fi%
+ \fi%
}%
\fi%
\fi%
}
+
%other trigger events in the anim widget's AA dictionary
\def\@anim@otherjscript#1{%
- \def\@anim@posterframe{last}%
\xdef\@anim@otherjscriptkey{%
/PC <</S/JavaScript/JS (% PageClose
- \if@anim@autopause%
- \if@anim@step\else
- if(a#1.isPlaying||a#1.isPaused){a#1.actnPause();}%
- else{%
- \fi%
+ \if@anim@step\else
+ if(%
+ \if@anim@autopause
+ a#1.isPlaying||%
+ \fi
+ a#1.isPaused%
+ ){a#1.actnPause();}%
+ else{%
\fi%
\if@anim@step\else%
\if@anim@controls
- a#1.playsRight=true;%
+ a#1.playsRight=true;%
\else%
\if@anim@palindrome
a#1.playsRight=true;%
\fi%
\fi%
\fi%
- \ifx\@anim@poster\@anim@posterframe
- a#1.actnEndRight();%
- \else
- a#1.actnEndLeft();%
- \fi%
- \if@anim@autopause%
- \if@anim@step\else
- }
+ \ifx\@anim@poster\@anim@posterlast%
+ \if@anim@useocg
+ a#1.actnEndRight();%
+ \else
+ a#1_intd=app.setInterval('a#1.actnSecEndRight()',1);%
\fi%
+ \else%
+ \if@anim@useocg
+ a#1.actnEndLeft();%
+ \else
+ a#1_intd=app.setInterval('a#1.actnSecEndLeft()',1);%
+ \fi%
+ \fi%
+ \if@anim@step\else%
+ }%
\fi%
)>>%
\if@anim@step\else%
@@ -2689,12 +2928,16 @@
a#1.actnNext();%
}%
\fi%
- \else
- if(a#1.playsRight){%
+ \else%
+ \if@anim@ctrlorplndrm
+ if(a#1.playsRight){%
+ a#1.actnPlayRight();%
+ }else{%
+ a#1.actnPlayLeft();%
+ }%
+ \else%
a#1.actnPlayRight();%
- }else{%
- a#1.actnPlayLeft();%
- }%
+ \fi%
\fi%
)>>%
}%