summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2014-11-25 23:59:32 +0000
committerKarl Berry <karl@freefriends.org>2014-11-25 23:59:32 +0000
commit718ff5f822b1b65939aa42f0ebcb4e5ace3fdc11 (patch)
treea9eabb628e07ce00511b4f961584d83b32280a11 /Master/texmf-dist/tex
parentcdad9a2fcebdd52be366ba6ac0ae65557b1b3c70 (diff)
animate (25nov14)
git-svn-id: svn://tug.org/texlive/trunk@35664 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r--Master/texmf-dist/tex/latex/animate/animate.sty315
1 files changed, 184 insertions, 131 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index 6d67ab9816b..f53bf7a190b 100644
--- a/Master/texmf-dist/tex/latex/animate/animate.sty
+++ b/Master/texmf-dist/tex/latex/animate/animate.sty
@@ -13,7 +13,7 @@
\NeedsTeXFormat{LaTeX2e}
-\def\@anim@version{2014/11/11}
+\def\@anim@version{2014/11/25}
\ProvidesPackage{animate}
[\@anim@version\space PDF animations from files and inline graphics]
@@ -830,10 +830,6 @@
\fi%
}
-\def\@anim@posterlast{last}% helper macros
-\def\@anim@posterfirst{first}%
-\def\@anim@posternone{none}%
-
%creates OCG
\def\@anim@newocg#1#2{%#1:@anim@num, #2:@anim@curframe@zb
\@anim@dictobj{/Type/OCG /Name (#1.#2)}%
@@ -858,15 +854,14 @@
\ifcase\@anim@method% icon based
\@anim@xform{0}{1}{\@anim@box}%
%initial visibility
- \ifx\@anim@poster\@anim@posternone\else%
- \ifnum#2=\z@%
- \ifx\@anim@poster\@anim@posterfirst%
+ \ifnum\@anim@poster>\@anim@mtwo% insert poster frame
+ \ifnum#2=\@anim@poster%
+ \edef\@anim@posterap{\@anim@lastxform}%
+ \else%
+ \ifnum\@anim@poster=\@anim@mone% use last frame as poster
\edef\@anim@posterap{\@anim@lastxform}%
\fi%
\fi%
- \ifx\@anim@poster\@anim@posterlast%
- \edef\@anim@posterap{\@anim@lastxform}%
- \fi%
\fi%
%build appearance name tree
\xdef\@anim@appearances{%
@@ -876,19 +871,18 @@
}%
\or% widget based
%initial visibility
- \def\@anim@annotflag{/F 6}% default: hidden (2) + print (4)
- \ifx\@anim@poster\@anim@posternone\else%
- \ifnum#2=\z@%
- \ifx\@anim@poster\@anim@posterfirst%
- \def\@anim@annotflag{/F 4}%
+ \def\@anim@annotflag{/F 2}% default: hidden
+ \ifnum\@anim@poster>\@anim@mtwo% insert poster frame
+ \ifnum#2=\@anim@poster%
+ \def\@anim@annotflag{/F 4}% not hidden + print (4)
+ \else%
+ \ifnum\@anim@poster=\@anim@mone% use last frame as poster
+ \@anim@keytoaux{a#1.poster}{#2}%
+ \ifthenelse{\equal{\@anim@getkeyval{a#1.poster}}{#2}}{%
+ \def\@anim@annotflag{/F 4}%
+ }{}%
\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%
%frame insertion
\@anim@xform{0}{1}{\@anim@box}%
@@ -904,17 +898,13 @@
\or% ocg based
\@anim@newocg{#1}{#2}%
%initial visibility
- \ifx\@anim@poster\@anim@posterlast%
+ \ifnum\@anim@poster=\@anim@mone% use last frame as poster
\@anim@keytoaux{a#1.poster}{#2}%
\ifthenelse{\equal{\@anim@getkeyval{a#1.poster}}{#2}}{}{%
\xdef\@anim@offocgs{\@anim@offocgs\space\@anim@curocg}%
}%
\else%
- \ifnum#2=\z@%
- \ifx\@anim@poster\@anim@posternone%
- \xdef\@anim@offocgs{\@anim@offocgs\space\@anim@curocg}%
- \fi%
- \else%
+ \ifnum#2=\@anim@poster\else%
\xdef\@anim@offocgs{\@anim@offocgs\space\@anim@curocg}%
\fi%
\fi%
@@ -1628,19 +1618,32 @@
\xdef\@anim@animtotalheight{\strip@pt\dimexpr\ht#1+\dp#1\relax}%
}
-%interactive Widget annotation that is overlayed on the
-%non-interactive frame Widgets / page content with frame OCGs
+%interactive Widget annotation serving as animation frame container / that is
+%overlayed on the non-interactive frame Widgets or on the page content with
+%frame OCGs
\def\@anim@animwidget#1{%
\@anim@pojscript{#1}%
\@anim@otherjscript{#1}%
\def\@anim@annotflag{}%
+ \ifnum\@anim@poster>\@anim@maxframe%
+ \PackageError{animate}{%
+ Poster frame `\@anim@poster' is out-of-bounds\MessageBreak%
+ on input line \the\inputlineno.\MessageBreak%
+ Try option `poster=last'%
+ }{}%
+ \fi%
\ifnum\@anim@method=\z@%
\def\@anim@annotflag{/F 4}% 4=allow printing
- \ifx\@anim@poster\@anim@posternone%
+ \ifnum\@anim@poster=\@anim@mtwo%
\ifdefined\@anim@apdummy\else% empty appearance dummy
\setbox\@anim@box=\hbox{\phantom{x}}%
\@anim@xform{0}{0}{\@anim@box}%
\xdef\@anim@apdummy{\@anim@lastxform}%
+ \xdef\@anim@appearances{%
+ (0000)
+ \@anim@refobj{\@anim@lastxform}
+ \@anim@appearances%
+ }%
\fi%
\def\@anim@apmk{\@anim@refobj{\@anim@apdummy}}%
\else%
@@ -2096,11 +2099,11 @@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%
}
\xdef\@anim@icondvipswarning{%
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak%
- @_Icon-based_animation_method_(``useicon'')_breaks_@\MessageBreak%
- @_all_hyperref-inserted_links_in_the_final_PDF_____@\MessageBreak%
- @_produced_via_the_Dvips_route!____________________@\MessageBreak%
- @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\MessageBreak%
+ @_Icon-based_animation_method_(`method=icon')_____@\MessageBreak%
+ @_breaks_all_hyperref-inserted_links_in_the_final_@\MessageBreak%
+ @_PDF_produced_via_the_Dvips_route!_______________@\MessageBreak%
+ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
}
\endgroup
@@ -2551,13 +2554,33 @@
\define@key{anim@user}{palindrome}[true]{%
\setboolean{@anim@palindrome}{#1}%
}
-\define@key{anim@user}{poster}[first]{% | none | last
- \ifthenelse{% correct wrong input to `none'
- \equal{#1}{first}\OR\equal{#1}{last}%
+\def\@anim@mone{-1}\def\@anim@mtwo{-2}
+\define@key{anim@user}{poster}[first]{% <num> | first | last | none
+ \ifthenelse{%
+ \equal{#1}{first}%
}{%
- \gdef\@anim@poster{#1}%
+ \gdef\@anim@poster{0}%
}{%
- \gdef\@anim@poster{none}%
+ \ifthenelse{%
+ \equal{#1}{last}%
+ }{%
+ \gdef\@anim@poster{-1}%
+ }{%
+ \ifthenelse{%
+ \equal{#1}{none}%
+ }{%
+ \gdef\@anim@poster{-2}%
+ }{%
+ \ifnum#1<\z@%
+ \PackageError{animate}{%
+ Poster frame `#1' is out-of-bounds on\MessageBreak%
+ input line \the\inputlineno.\MessageBreak%
+ Try one of `poster=first' or `poster=none'%
+ }{}%
+ \fi%
+ \gdef\@anim@poster{#1}%
+ }%
+ }%
}%
}
\newboolean{@anim@step}
@@ -2641,15 +2664,6 @@
Use `method=ocg' instead%
}{}%
}
-%\define@key{anim@user}{firstframejs}{%
-% \@anim@firstjs{#1}%
-%}
-%\define@key{anim@user}{lastframejs}{%
-% \@anim@lastjs{#1}%
-%}
-%\define@key{anim@user}{otherframejs}{%
-% \@anim@otherjs{#1}%
-%}
%macro to reset macros and booleans
\def\@anim@reset{%
@@ -2688,9 +2702,6 @@
\gdef\@anim@nfpsat{}%
\gdef\@anim@pfpsat{}%
\gdef\@anim@usrjsat{}%
-% \gdef\@anim@firstjs{}%
-% \gdef\@anim@lastjs{}%
-% \gdef\@anim@otherjs{}%
\gdef\@anim@tmlnfile{}%
\setboolean{@anim@timeline}{false}%
\global\@anim@begin={}%
@@ -2835,14 +2846,33 @@
\define@key{anim@pkg}{palindrome}[true]{%
\setboolean{@anim@@palindrome}{#1}%
}
-\gdef\@anim@@poster{first}%
+\gdef\@anim@@poster{0}%
\define@key{anim@pkg}{poster}[first]{%
\ifthenelse{%
- \equal{#1}{first}\OR\equal{#1}{last}%
+ \equal{#1}{first}%
}{%
- \gdef\@anim@@poster{#1}%
+ \gdef\@anim@@poster{0}%
}{%
- \gdef\@anim@@poster{none}%
+ \ifthenelse{%
+ \equal{#1}{last}%
+ }{%
+ \gdef\@anim@@poster{-1}%
+ }{%
+ \ifthenelse{%
+ \equal{#1}{none}%
+ }{%
+ \gdef\@anim@@poster{-2}%
+ }{%
+ \ifnum#1<\z@%
+ \PackageError{animate}{%
+ Poster frame `#1' is out-of-bounds on\MessageBreak%
+ input line \the\inputlineno.\MessageBreak%
+ Try one of `poster=first' or `poster=none'%
+ }{}%
+ \fi%
+ \gdef\@anim@@poster{#1}%
+ }%
+ }%
}%
}
\newboolean{@anim@@step}
@@ -2916,7 +2946,7 @@
% console.clear();%
var curdoc=this;%
var a#1,a#1_int;%
- if(typeof(a#1)==='undefined'){% initialize animation
+ if(typeof a#1==='undefined'){% initialize animation
a#1=new Object();% animation object
%takes references to frame ocgs/Field objects belonging to the current
%animation
@@ -2924,7 +2954,7 @@
%initialize fr properties
\ifcase\@anim@method %icon based
var spc=String.fromCharCode(32);%
- if(typeof(this.getIcon)==='undefined'){%
+ if(typeof this.getIcon==='undefined'){%
app.alert('Icon-based'+spc+'animation'+spc+'is'+spc+'not'+spc+%
'supported'+spc+'by'+spc+'this'+spc+'Reader.'+spc+'Try'+spc+%
'one'+spc+'of'+spc+'"method=widget"'+spc+'or'+spc+%
@@ -2934,6 +2964,11 @@
for(i=0;i<=\@anim@maxframe;i++){%
a#1.fr[i]=this.getIcon(util.printf('\@anim@pad{1234}{#1}.\%04d',i));%
}%
+ \ifnum\@anim@poster=\@anim@mtwo
+ if(typeof blnk==='undefined'){% blank poster
+ blnk=this.getIcon('0000');%
+ }%
+ \fi%
\or %widget based
%get array of animation frames
for(i=0;i<=\@anim@maxframe;i++){%
@@ -2958,17 +2993,11 @@
a#1.btnPauseRight=this.getField('#1.PauseRight');%
a#1.btnPlayRight=this.getField('#1.PlayRight');%
\fi\fi%
- \ifx\@anim@poster\@anim@posterlast % set default frame
- %holds index of the frame to be displayed
- a#1.on=a#1.idx=\@anim@maxframe;%
- \else % first & none
- a#1.on=a#1.idx=0;%
- \fi%
%playing state and direction
\if@anim@morejs a#1.playsRight=true;\fi%
+ a#1.isPaused=false;%
\if@anim@step\else
a#1.playing=false;%
- a#1.isPaused=false;%
\if@anim@pauseframes
%this array takes the frame numbers at which to pause playback
a#1.pauseAt=new Array();%
@@ -2997,8 +3026,24 @@
\fi%
%actions
a#1.seekFrame=function(f){%
+ \ifnum\@anim@poster=\@anim@mtwo
+ if(f<-1){%
+ \ifcase\@anim@method %icon based
+ a#1.wid.buttonSetIcon(blnk);%
+ curdoc.dirty=false;%
+ \or %widget based
+ a#1.on=0;%
+ a#1.fr[0].display=display.hidden;%
+ curdoc.dirty=false;%
+ \or %ocg based
+ a#1.on=0;%
+ a#1.fr[0].state=false;%
+ \fi
+ a#1.idx=-1;%
+ }%
+ \fi
if(f>\@anim@maxframe||f<0){return -1;}%
- var old=a#1.idx;a#1.idx=f;%
+ a#1.idx=f;%
\if@anim@usrjs
if(a#1.usrJSat[f]){%
var cmd='try{a#1.usrJSat['+f+']();}catch(e){console.println(e);}';%
@@ -3007,15 +3052,17 @@
\fi%
\ifcase\@anim@method %icon based
a#1.wid.buttonSetIcon(a#1.fr[f]);%
+ curdoc.dirty=false;%
\or %widget based
a#1.fr[a#1.on].display=display.hidden;%
a#1.fr[f].display=display.visible;%
+ a#1.on=f;%
curdoc.dirty=false;%
\or %ocg based
a#1.fr[a#1.on].state=false;%
a#1.fr[f].state=true;%
+ a#1.on=f;%
\fi
- a#1.on=f;%
\if@anim@step\else%
\if@anim@chfps
if(a#1.nFpsAt[f]!=a#1.fps){%
@@ -3023,20 +3070,22 @@
}%
\fi%
\fi%
- \if@anim@step\else\if@anim@meas a#1.frcnt++;\fi\fi
- return old;%
+ \if@anim@step\else\if@anim@meas a#1.frcnt++;\fi\fi%
+ return 0;%
};%
a#1.stopFirst=function(){%
- \if@anim@step\else
- a#1.pause();%
- a#1.isPaused=false;% because it has been explicitly stopped
+ \if@anim@step
+ a#1.isPaused=false;% stop
+ \else
+ a#1.pause(true);% stop
\fi
a#1.seekFrame(0);%
};%
a#1.stopLast=function(){%
- \if@anim@step\else
- a#1.pause();%
- a#1.isPaused=false;%
+ \if@anim@step
+ a#1.isPaused=false;% stop
+ \else
+ a#1.pause(true);% stop
\fi
a#1.seekFrame(\@anim@maxframe);%
};%
@@ -3110,10 +3159,10 @@
};%
\fi%
\if@anim@step\else
- a#1.pause=function(){%
+ a#1.pause=function(stop){%
try{app.clearInterval(a#1_int);}catch(e){}%
a#1.playing=false;%
- a#1.isPaused=true;%
+ a#1.isPaused=!stop;%
\if@anim@controls
a#1.btnPauseLeft.display=display.hidden;%
a#1.btnPlayLeft.display=display.visible;%
@@ -3190,11 +3239,23 @@
\fi%
\if@anim@morejs%
\if@anim@step
- a#1.stepBwd=function(){a#1.seekFrame(a#1.idx-1);};%
- a#1.stepFwd=function(){a#1.seekFrame(a#1.idx+1);};%
+ a#1.stepBwd=function(){%
+ a#1.seekFrame(a#1.idx-1);%
+ a#1.isPaused=true;%
+ };%
+ a#1.stepFwd=function(){%
+ a#1.seekFrame(a#1.idx+1);%
+ a#1.isPaused=true;%
+ };%
\else
- a#1.stepBwd=function(){if(!a#1.playing){a#1.seekFrame(a#1.idx-1);}};%
- a#1.stepFwd=function(){if(!a#1.playing){a#1.seekFrame(a#1.idx+1);}};%
+ a#1.stepBwd=function(){if(!a#1.playing){%
+ a#1.seekFrame(a#1.idx-1);%
+ a#1.isPaused=true;%
+ }};%
+ a#1.stepFwd=function(){if(!a#1.playing){%
+ a#1.seekFrame(a#1.idx+1);%
+ a#1.isPaused=true;%
+ }};%
a#1.playBwd=function(){%
if(a#1.idx==0){a#1.stopLast();}%
a#1.playLeft();%
@@ -3206,8 +3267,8 @@
\fi%
\fi%
\ifx\empty\@anim@label\empty\else
- if(typeof(anim)==='undefined'){anim=new Array();}%
- if(typeof(anim['\@anim@label'])==='undefined'){%
+ if(typeof anim==='undefined'){anim=new Array();}%
+ if(typeof anim['\@anim@label']==='undefined'){%
anim['\@anim@label']={%
\if@anim@step\else
playBwd:a#1.playBwd,%
@@ -3231,12 +3292,12 @@
throw new RangeError('Frame_number_not_in_allowed_range');%
}%
\if@anim@step
- a#1.seekFrame(f);%
+ if(a#1.seekFrame(f)>-1)a#1.isPaused=true;%
\else
if(a#1.playing){%
a#1.pause();a#1.seekFrame(f);%
if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}%
- }else{a#1.seekFrame(f);}%
+ }else{if(a#1.seekFrame(f)>-1)a#1.isPaused=true;}%
\fi%
},%
stopFirst:a#1.stopFirst,%
@@ -3244,11 +3305,17 @@
};%
}%
\fi%
- \ifnum\@anim@method>\z@%
- \ifx\@anim@poster\@anim@posternone\else a#1.seekFrame(a#1.on);\fi%
+ \ifnum\@anim@poster=\@anim@mtwo %poster=none
+ a#1.idx=-1;\ifnum\@anim@method>\z@ a#1.on=0;\fi%
+ \fi%
+ \ifnum\@anim@poster>\@anim@mone %poster=<num>|first
+ a#1.idx=\ifnum\@anim@method>\z@ a#1.on=\fi\@anim@poster;%
+ \fi%
+ \ifnum\@anim@poster=\@anim@mone %poster=last
+ a#1.idx=\ifnum\@anim@method>\z@ a#1.on=\fi\@anim@maxframe;%
\fi%
}%
- curdoc.dirty=false;%
+ %curdoc.dirty=false;%
\if@anim@step\else%
\if@anim@autoplayorresume%
\if@anim@autoresume
@@ -3271,49 +3338,43 @@
\xdef\@anim@otherjscriptkey{%
/PC <</S/JavaScript/JS (% PageClose
\if@anim@step\else
- if(%
+ if(a#1.playing){
\if@anim@autopause
- a#1.playing||%
+ a#1.pause();%
+ \else
+ a#1.pause(true);% stop
\fi
- a#1.isPaused%
- ){a#1.pause();}%
- else{%
- \if@anim@controls
- a#1.playsRight=true;%
- \else%
- \if@anim@palindrome
- a#1.playsRight=true;%
- \fi%
- \fi%
- \fi%
- \ifx\@anim@poster\@anim@posterlast
- %using app.setTimeOut as a workaround for NotAllowedError in AR-9
- var ret=app.setTimeOut('a#1.stopLast()',1);%
- \else
- var ret=app.setTimeOut('a#1.stopFirst()',1);%
- \fi%
- \if@anim@step\else%
}%
- \fi%
+ \fi
+ %re-display poster frame
+ if(!a#1.isPaused){% i.e. if stopped
+ \ifnum\@anim@poster=\@anim@mtwo %poster=none
+ var ret=app.setTimeOut('a#1.seekFrame(-2)',1);%
+ \fi%
+ \ifnum\@anim@poster>\@anim@mone%poster=<num>|first
+ var ret=app.setTimeOut('a#1.seekFrame(\@anim@poster)',1);%
+ \fi%
+ \ifnum\@anim@poster=\@anim@mone %poster=last
+ var ret=app.setTimeOut('a#1.seekFrame(\@anim@maxframe)',1);%
+ \fi%
+ }%
)>>%
- \if@anim@step\else%
- /D <</S/JavaScript/JS (% pause on MouseDown
- %disable focus rectangle
- app.focusRect=false;%
+ /D <</S/JavaScript/JS (%
+ app.focusRect=false;% disable focus rectangle
+ \if@anim@step\else % pause on MouseDown
try{if(a#1.playing){a#1.pause();}}catch(e){}%
- )>>%
- \fi%
+ \fi%
+ )>>%
/U <</S/JavaScript/JS (% play/resume on MouseUp
try{%
\if@anim@step%
\if@anim@palindrome
if(a#1.idx==\@anim@maxframe){%
a#1.playsRight=false;%
- a#1.gotoPrev();%
}else if(a#1.idx==0){%
a#1.playsRight=true;%
- a#1.gotoNext();%
- }else if(a#1.playsRight){%
+ }%
+ if(a#1.playsRight){%
a#1.gotoNext();%
}else{%
a#1.gotoPrev();%
@@ -3324,20 +3385,12 @@
}else{%
a#1.gotoNext();%
}%
- \fi%
+ \fi
+ a#1.isPaused=true;%
\else%
- \if@anim@palindrome
- if(a#1.idx==\@anim@maxframe){%
- a#1.playLeft();%
- }else if(a#1.idx==0){%
- a#1.playRight();%
- }else if(a#1.playsRight){%
- a#1.playRight();%
- }else{%
- a#1.playLeft();%
- }%
+ \if@anim@morejs
+ if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}%
\else
- if(a#1.idx==\@anim@maxframe){a#1.stopFirst();}%
a#1.playRight();%
\fi%
\fi%