summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/animate/animate.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate/animate.sty')
-rw-r--r--Master/texmf-dist/tex/latex/animate/animate.sty315
1 files changed, 135 insertions, 180 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index 521523cd84c..86314c90c77 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{2016/04/15}
+\def\@anim@version{2016/06/08}
\ProvidesPackage{animate}
[\@anim@version\space PDF animations from files and inline graphics]
@@ -34,7 +34,6 @@
\RequirePackage{ifdraft}
\RequirePackage{calc}
\RequirePackage{atenddvi}%to really get certain \specials into the dvi
-\RequirePackage{animfp}
\RequirePackage{graphics}%\scalebox, \resizebox
%driver options (the only package options we process immediately)
@@ -109,6 +108,8 @@
}
\let\@anim@pdfcatalog\pbs_pdfcatalog:n
+
+ \let\@anim@fpeval\fp_eval:n
\ExplSyntaxOff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -171,7 +172,11 @@
\ifcsname pdfmdfivesum\endcsname
\def\@anim@pdfmdfivesum#1{\pdfmdfivesum file {#1}}
\else
- \def\@anim@pdfmdfivesum#1{#1}
+ \ifcsname mdfivesum\endcsname
+ \def\@anim@pdfmdfivesum#1{\mdfivesum file {#1}}
+ \else
+ \def\@anim@pdfmdfivesum#1{#1}
+ \fi
\fi
\fi
@@ -263,7 +268,6 @@
% 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@morejs}
\newboolean{@anim@timeline} %true if `timeline' option is set
\newboolean{@anim@multipage} % multipage document?
@@ -1146,59 +1150,29 @@
%draftbox
\def\@anim@draftbox{%
\begingroup%
- \setlength{\unitlength}{1pt}%
\vtop{% draw boxes
\offinterlineskip%
- \hbox{%
- \raisebox{-\@anim@animdepth}{%
- \begin{picture}(\@anim@animwidth,\@anim@animtotalheight)%
- \put(0,0){\framebox(\@anim@animwidth,\@anim@animtotalheight){}}%
- \end{picture}%
+ \hbox{\raisebox{-\@anim@animdepth}{%
+ \frame{%
+ \rule{0pt}{\@anim@animtotalheight}\hskip\@anim@animwidth%
}%
- }%
+ }}%
\if@anim@controls%
\setlength{\@anim@tmpdima}{\@anim@btnsize}%
\vskip 0.1\@anim@tmpdima%
\hbox to \@anim@animwidth {%
\hss%
- \setlength{\@anim@tmpdimb}{2\@anim@tmpdima}%
- \begin{picture}(\strip@pt\@anim@tmpdimb,\strip@pt\@anim@tmpdima)%
- \put(0,0){\line(1,0){\strip@pt\@anim@tmpdimb}}%
- \put(0,\strip@pt\@anim@tmpdima){%
- \line(1,0){\strip@pt\@anim@tmpdimb}%
- }%
- \put(0,0){\line(0,1){\strip@pt\@anim@tmpdima}}%
- \end{picture}%
- \if@anim@step\else%
- \begin{picture}(\strip@pt\@anim@tmpdimb,\strip@pt\@anim@tmpdima)%
- \put(0,0){\line(1,0){\strip@pt\@anim@tmpdimb}}%
- \put(0,\strip@pt\@anim@tmpdima){%
- \line(1,0){\strip@pt\@anim@tmpdimb}%
- }%
- \end{picture}%
- \fi%
- \begin{picture}(\strip@pt\@anim@tmpdimb,\strip@pt\@anim@tmpdima)%
- \put(0,0){\line(1,0){\strip@pt\@anim@tmpdimb}}%
- \put(0,\strip@pt\@anim@tmpdima){%
- \line(1,0){\strip@pt\@anim@tmpdimb}%
- }%
- \put(\strip@pt\@anim@tmpdimb,0){%
- \line(0,1){\strip@pt\@anim@tmpdima}%
- }%
- \end{picture}%
+ \frame{%
+ \setlength{\@anim@tmpdimb}{2\@anim@tmpdima}%
+ \rule{0pt}{\@anim@tmpdima}\hskip\@anim@tmpdimb\hskip\@anim@tmpdimb%
+ \if@anim@step\else\hskip\@anim@tmpdimb\fi%
+ }%
\if@anim@step\else%
\hskip 0.3\@anim@tmpdima%
- \setlength{\@anim@tmpdimb}{3\@anim@tmpdima}%
- \begin{picture}(\strip@pt\@anim@tmpdimb,\strip@pt\@anim@tmpdima)%
- \put(0,0){\line(0,1){\strip@pt\@anim@tmpdima}}%
- \put(0,0){\line(1,0){\strip@pt\@anim@tmpdimb}}%
- \put(0,\strip@pt\@anim@tmpdima){%
- \line(1,0){\strip@pt\@anim@tmpdimb}%
- }%
- \put(\strip@pt\@anim@tmpdimb,0){%
- \line(0,1){\strip@pt\@anim@tmpdima}%
- }%
- \end{picture}%
+ \frame{%
+ \setlength{\@anim@tmpdimb}{3\@anim@tmpdima}%
+ \rule{0pt}{\@anim@tmpdima}\hskip\@anim@tmpdimb%
+ }%
\fi%
\hss%
}%
@@ -1346,12 +1320,6 @@
\ifthenelse{\boolean{@anim@autoplay}\OR\boolean{@anim@autoresume}}{%
\setboolean{@anim@autoplayorresume}{true}%
}{}%
- \ifthenelse{\boolean{@anim@controls}\OR\boolean{@anim@palindrome}}{%
- \setboolean{@anim@morejs}{true}%
- }{}%
- \ifx\empty\@anim@label\empty\else%
- \setboolean{@anim@morejs}{true}%
- \fi%
\ifthenelse{\NOT\boolean{@anim@controls}\AND\boolean{@anim@step}}{%
\setboolean{@anim@loop}{true}%
}{}%
@@ -1725,12 +1693,6 @@
\ifthenelse{\boolean{@anim@autoplay}\OR\boolean{@anim@autoresume}}{%
\setboolean{@anim@autoplayorresume}{true}%
}{}%
- \ifthenelse{\boolean{@anim@controls}\OR\boolean{@anim@palindrome}}{%
- \setboolean{@anim@morejs}{true}%
- }{}%
- \ifx\empty\@anim@label\empty\else%
- \setboolean{@anim@morejs}{true}%
- \fi%
\ifthenelse{\NOT\boolean{@anim@controls}\AND\boolean{@anim@step}}{%
\setboolean{@anim@loop}{true}%
}{}%
@@ -1886,7 +1848,10 @@
}{}%
\fi\fi%
%draw draftbox according to dimensions of the first frame
- \if@anim@draft\@anim@scale{\@anim@box}\@anim@draftbox\fi%
+ \if@anim@draft%
+ \@anim@scale{\@anim@box}%
+ \@anim@draftbox%
+ \fi%
\else% remaining frames
%deal with zero width or totalheight boxes
\ifdim\wd\@anim@box=\z@\global\setbox\@anim@box=\hbox{\phantom{X}}\fi%
@@ -1985,13 +1950,15 @@
\OR\equal{\@anim@vartype}{r}\OR\equal{\@anim@vartype}{R}%
}{% real numbers, prefix n, N, r, R
%initialize variable
- \expandafter\@anim@add\csname#1\endcsname{#2}{0.0}%
+ \expandafter\edef\csname#1\endcsname{\@anim@fpeval{#2}}%
%global copy that saves current variable value between loops
- \expandafter\xdef\csname#1@old\endcsname{#2}%
+ \expandafter\xdef\csname#1@old\endcsname{\@anim@fpeval{#2}}%
%append script for updating variable to \@anim@updatevars macro
\g@addto@macro\@anim@updatevars{%
%new value
- \expandafter\@anim@add\csname#1\endcsname{\csname#1@old\endcsname}{#3}%
+ \expandafter\edef\csname#1\endcsname{%
+ \@anim@fpeval{#3+\csname#1@old\endcsname}%
+ }%
%global copy
\expandafter\xdef\csname#1@old\endcsname{\csname#1\endcsname}%
}%
@@ -2704,7 +2671,6 @@
\setboolean{@anim@multipage}{false}%
\setboolean{@anim@meas}{false}%
\setboolean{@anim@autoplayorresume}{false}%
- \setboolean{@anim@morejs}{false}%
\xdef\@anim@ftype{\@anim@@ftype}%
}
@@ -3026,8 +2992,8 @@
%playing state and direction
\if@anim@step
\if@anim@palindrome a#1.playsRight=true;\fi%
- \else%
- \if@anim@morejs a#1.playsRight=true;\fi%
+ \else
+ a#1.playsRight=true;%
\fi%
a#1.isPaused=false;%
\if@anim@step\else
@@ -3045,11 +3011,7 @@
a#1.setFps=function(f){%
a#1.fps=f;%
if(a#1.playing){%
- \if@anim@morejs
- if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}%
- \else
- a#1.playRight();%
- \fi%
+ if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}%
}%
};%
\fi%
@@ -3158,42 +3120,40 @@
\fi%
\fi%
};%
- \if@anim@morejs
- a#1.gotoPrev=function(){%
- if(a#1.seekFrame(a#1.idx-1)<0){%
- \if@anim@step\else\if@anim@meas a#1.stopMeas();\fi\fi%
- \if@anim@palindrome%
- \if@anim@step
- a#1.stopFirst();%
- a#1.playsRight=true;%
- \else
- if(a#1.playing){%
- a#1.seekFrame(a#1.idx+1);%
- a#1.playRight();%
- }%
- \fi%
+ a#1.gotoPrev=function(){%
+ if(a#1.seekFrame(a#1.idx-1)<0){%
+ \if@anim@step\else\if@anim@meas a#1.stopMeas();\fi\fi%
+ \if@anim@palindrome%
+ \if@anim@step
+ a#1.stopFirst();%
+ a#1.playsRight=true;%
+ \else
+ if(a#1.playing){%
+ a#1.seekFrame(a#1.idx+1);%
+ a#1.playRight();%
+ }%
+ \fi%
+ \else%
+ \if@anim@step
+ a#1.stopFirst();%
\else%
- \if@anim@step
+ \if@anim@loop
+ if(a#1.playing){%
+ a#1.seekFrame(\@anim@maxframe);%
+ }else{a#1.stopFirst();}%
+ \else
a#1.stopFirst();%
- \else%
- \if@anim@loop
- if(a#1.playing){%
- a#1.seekFrame(\@anim@maxframe);%
- }else{a#1.stopFirst();}%
- \else
- a#1.stopFirst();%
- \fi%
\fi%
- \fi
- return;%
- }%
- \if@anim@step\else%
- \if@anim@pauseframes
- if(a#1.playing&&a#1.pauseAt[a#1.idx]){a#1.pause();}%
\fi%
+ \fi
+ return;%
+ }%
+ \if@anim@step\else%
+ \if@anim@pauseframes
+ if(a#1.playing&&a#1.pauseAt[a#1.idx]){a#1.pause();}%
\fi%
- };%
- \fi%
+ \fi%
+ };%
\if@anim@step\else
a#1.pause=function(stop){%
try{app.clearInterval(a#1_int);}catch(e){}%
@@ -3209,7 +3169,7 @@
};%
a#1.playRight=function(){%
try{app.clearInterval(a#1_int);}catch(e){}%
- \if@anim@morejs a#1.playsRight=true;\fi
+ a#1.playsRight=true;%
a#1.playing=true;%
a#1.isPaused=false;%
\if@anim@controls
@@ -3223,24 +3183,22 @@
a#1_int=app.setInterval('a#1.gotoNext()',%
1000/(1e-6+a#1.fps)/a#1.sm);%
};%
- \if@anim@morejs
- a#1.playLeft=function(){%
- try{app.clearInterval(a#1_int);}catch(e){}%
- a#1.playsRight=false;%
- a#1.playing=true;%
- a#1.isPaused=false;%
- \if@anim@controls
- a#1.btnPauseLeft.display=display.visible;%
- a#1.btnPlayLeft.display=display.hidden;%
- a#1.btnPauseRight.display=display.visible;%
- a#1.btnPlayRight.display=display.hidden;%
- curdoc.dirty=false;%
- \fi%
- \if@anim@meas a#1.startMeas();\fi
- a#1_int=app.setInterval('a#1.gotoPrev()',%
- 1000/(1e-6+a#1.fps)/a#1.sm);%
- };%
- \fi%
+ a#1.playLeft=function(){%
+ try{app.clearInterval(a#1_int);}catch(e){}%
+ a#1.playsRight=false;%
+ a#1.playing=true;%
+ a#1.isPaused=false;%
+ \if@anim@controls
+ a#1.btnPauseLeft.display=display.visible;%
+ a#1.btnPlayLeft.display=display.hidden;%
+ a#1.btnPauseRight.display=display.visible;%
+ a#1.btnPlayRight.display=display.hidden;%
+ curdoc.dirty=false;%
+ \fi%
+ \if@anim@meas a#1.startMeas();\fi
+ a#1_int=app.setInterval('a#1.gotoPrev()',%
+ 1000/(1e-6+a#1.fps)/a#1.sm);%
+ };%
\if@anim@controls
a#1.fpsIncr=function(){% speed up animation
a#1.sm*=1.1;%
@@ -3273,34 +3231,32 @@
};%
\fi%
\fi%
- \if@anim@morejs%
- \if@anim@step
- 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.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.isPaused){a#1.stopLast();}%
- a#1.playLeft();%
- };%
- a#1.playFwd=function(){%
- if(a#1.idx==\@anim@maxframe||!a#1.isPaused){a#1.stopFirst();}%
- a#1.playRight();%
- };%
- \fi%
+ \if@anim@step
+ 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.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.isPaused){a#1.stopLast();}%
+ a#1.playLeft();%
+ };%
+ a#1.playFwd=function(){%
+ if(a#1.idx==\@anim@maxframe||!a#1.isPaused){a#1.stopFirst();}%
+ a#1.playRight();%
+ };%
\fi%
%animation API for labelled anims
\ifx\empty\@anim@label\empty\else
@@ -3356,12 +3312,8 @@
\if@anim@autoplayorresume%
\if@anim@autoresume
if(a#1.isPaused){%
- \fi%
- \if@anim@morejs
- if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}%
- \else
- a#1.playRight();%
- \fi%
+ \fi
+ if(a#1.playsRight){a#1.playRight();}else{a#1.playLeft();}%
\if@anim@autoresume%
}%
\fi%
@@ -3384,8 +3336,8 @@
\else
a#1.pause(true);% stop
\fi%
- }%
- \if@anim@morejs if(!a#1.isPaused)a#1.playsRight=true;\fi%
+ }
+ if(!a#1.isPaused)a#1.playsRight=true;%
\fi
%re-display poster frame
if(!a#1.isPaused){% i.e. if stopped
@@ -3414,6 +3366,7 @@
try{%
\if@anim@step%
\if@anim@palindrome
+ if(event.shift)a#1.playsRight=!a#1.playsRight;%
if(a#1.idx==\@anim@maxframe){%
a#1.playsRight=false;%
}else if(a#1.idx==0){%
@@ -3425,34 +3378,36 @@
a#1.gotoPrev();%
}%
\else
- if(a#1.idx==\@anim@maxframe){%
- a#1.stopFirst();%
- }else{%
- a#1.gotoNext();%
- }%
+ if(event.shift){%
+ if(a#1.idx==0){%
+ a#1.stopLast();%
+ }else{%
+ a#1.gotoPrev();%
+ }%
+ }else{%
+ if(a#1.idx==\@anim@maxframe){%
+ a#1.stopFirst();%
+ }else{%
+ a#1.gotoNext();%
+ }%
+ }%
\fi
a#1.isPaused=true;%
\else
if(!a#1.isPaused)a#1.stopFirst();%
- \if@anim@morejs%
- \if@anim@palindrome
- if(a#1.idx==0)a#1.playsRight=true;%
- if(a#1.idx==\@anim@maxframe)a#1.playsRight=false;%
- \else
- if(a#1.idx==\@anim@maxframe&&a#1.playsRight)a#1.stopFirst();%
- if(a#1.idx==0&&!a#1.playsRight)a#1.stopLast();%
- \fi
- if(a#1.playsRight){%
- a#1.playRight();%
- }else{%
- a#1.playLeft();%
- }%
- \else%
- \if@anim@loop\else
- if(a#1.idx==\@anim@maxframe){a#1.stopFirst();}%
- \fi
+ if(event.shift)a#1.playsRight=!a#1.playsRight;%
+ \if@anim@palindrome
+ if(a#1.idx==0)a#1.playsRight=true;%
+ if(a#1.idx==\@anim@maxframe)a#1.playsRight=false;%
+ \else
+ if(a#1.idx==\@anim@maxframe&&a#1.playsRight)a#1.stopFirst();%
+ if(a#1.idx==0&&!a#1.playsRight)a#1.stopLast();%
+ \fi
+ if(a#1.playsRight){%
a#1.playRight();%
- \fi%
+ }else{%
+ a#1.playLeft();%
+ }%
\fi%
}catch(e){}%
)>>%