summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/animate
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2007-05-12 22:29:50 +0000
committerKarl Berry <karl@freefriends.org>2007-05-12 22:29:50 +0000
commit09865bce52a41c68164dca7a5a02c82cc555cc0a (patch)
treeb71e26663e600bd893520a9dd327acd87c59b3db /Master/texmf-dist/tex/latex/animate
parentced53342f3cb2c76e09f7c7c352f47406c5676a1 (diff)
animate update (10may07)
git-svn-id: svn://tug.org/texlive/trunk@4278 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate')
-rw-r--r--Master/texmf-dist/tex/latex/animate/animate.sty288
1 files changed, 171 insertions, 117 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index ea14a81561b..b534464495b 100644
--- a/Master/texmf-dist/tex/latex/animate/animate.sty
+++ b/Master/texmf-dist/tex/latex/animate/animate.sty
@@ -13,7 +13,7 @@
% Supports LaTeX->dvips->ps2pdf or pdfLaTeX workflows.
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{animate}[2007/05/04]
+\ProvidesPackage{animate}[2007/05/10]
\RequirePackage{keyval}
\RequirePackage{ifthen}
\RequirePackage{ifpdf}
@@ -38,7 +38,7 @@
%define `?pdfmark' operator; taken from the PDFmark Reference
\AtBeginDocument{%
\ifx\pdfmark\@undefined% (hyperref provides its own
- \special{ps: % definition)
+ \special{ps: % definition)
/pdfmark where
{ pop globaldict /?pdfmark /exec load put }
{
@@ -123,13 +123,11 @@
\global\@anim@resnum=0
\fi
-\newbox\@anim@box %stores all graphics of a sequence
\newbox\@anim@@box %stores single frame
\newdimen\@anim@tmpdima %length register for occasional use
%creates Form XObject from graphics file, creates an ocg and associates it with
-%the XObject; also determines natural size of the first graphics file of the
-%sequence
+%the XObject;
\def\@anim@pt{pt}
\ifpdf
\def\@anim@ximage#1#2#3{%#1:@anim@num, #2:@anim@curframe@zb, #3:filename
@@ -162,6 +160,7 @@
%creates Form XObject from box contents
\ifpdf
+ \newbox\@anim@box %stores all graphics of a sequence
\def\@anim@xinline#1#2#3{%#1:@anim@num, #2:@anim@curframe@zb, #3:box number
%new ocg
\immediate\pdfobj{<</Type/OCG /Name (#1.#2)>>}%
@@ -829,14 +828,16 @@
\@anim@makeppcontainer{\the\@anim@num}{Right}%
\@anim@makeppcontainer{\the\@anim@num}{Left}%
\fi%
- \xdef\@anim@fps{#2}%
- \xdef\@anim@pauseat{}% not used, actually, with `animategraphics'
+ \xdef\@anim@fps{#2}% current frame rate
+ \xdef\@anim@nfps{#2}% not used, actually, with `animategraphics'
+ \xdef\@anim@pauseat{}%
+ \xdef\@anim@nfpsat{}%
+ \xdef\@anim@pfpsat{}%
%
%read all frames of the sequence
\@anim@curframe=\@anim@first%
\@anim@curframe@zb=0%
- \loop%
- \ifnum\@anim@curframe>\@anim@last\else%
+ \loop\ifnum\@anim@curframe>\@anim@last\else%
%get file name extension of current file
\@anim@getext{%
\@anim@base\@anim@pad{\@anim@last}{\the\@anim@curframe}%
@@ -1116,7 +1117,9 @@
\newboolean{@anim@inside} % for checking whether we are inside the
\setboolean{@anim@inside}{false} % `animateinline' environment
-\newboolean{@anim@pauseframes} % true when \newframe* is being used
+\newboolean{@anim@pauseframes} % true if \newframe* is being used
+\newboolean{@anim@chfps} % true if \newframe or \newframe* is being used
+ % with optional `new frame rate' argument
%user environment for animating inline graphics
% #1: options
@@ -1137,7 +1140,7 @@
\@anim@makeppcontainer{\the\@anim@num}{Left}%
\fi%
\xdef\@anim@fps{#2}%
- \xdef\@anim@pauseat{}%
+ \xdef\@anim@nfps{#2}% current frame rate (for use in \newframe)
\global\@anim@curframe@zb=0%
\@anim@beginframe%
\ignorespaces%
@@ -1190,27 +1193,63 @@
\if@anim@inside\else%
\PackageError{animate}{%
\protect\newframe\space cannot be used outside `animateinline'%
- \MessageBreak environment%
+ \MessageBreak environment%
}{}%
\fi%
\@anim@endframe{\the\@anim@num}{\the\@anim@curframe@zb}%
- \@ifstar{%
- \if@anim@step\else%
- %build JavaScript commands to fill the `pauseAt' array
- \xdef\@anim@pauseat{%
- \@anim@pauseat
- a\the\@anim@num.pauseAt[\the\@anim@curframe@zb]=1;%
+ \@ifstar\@anim@newframestar\@anim@newframe%
+}
+\newcommand{\@anim@newframestar}[1][]{% starred variant to pause animation
+ \if@anim@step\else% % #1: new frame rate
+ %build JavaScript commands to fill the `pauseAt' array
+ \xdef\@anim@pauseat{%
+ \@anim@pauseat%
+ a\the\@anim@num.pauseAt[\the\@anim@curframe@zb]=1;%
+ }%
+ \setboolean{@anim@pauseframes}{true}%
+ \xdef\@anim@pfps{\@anim@nfps}%
+ \xdef\@anim@nfps{#1}%
+ \ifx\@anim@nfps\@empty%
+ \xdef\@anim@nfps{\@anim@pfps}%
+ \else%
+ %build JavaScript commands to fill the `nFpsAt' & `pFpsAt' arrays
+ \xdef\@anim@nfpsat{%
+ \@anim@nfpsat%
+ a\the\@anim@num.nFpsAt[\the\@anim@curframe@zb]=Math.abs(#1);%
}%
- \setboolean{@anim@pauseframes}{true}%
+ \xdef\@anim@pfpsat{%
+ \@anim@pfpsat%
+ a\the\@anim@num.pFpsAt[\the\@anim@curframe@zb]=Math.abs(\@anim@pfps);%
+ }%
+ \setboolean{@anim@chfps}{true}% change fps
\fi%
- \global\advance\@anim@curframe@zb by 1%
- \@anim@beginframe%
- \ignorespaces%
- }{%
- \global\advance\@anim@curframe@zb by 1%
- \@anim@beginframe%
- \ignorespaces%
- }%
+ \fi%
+ \global\advance\@anim@curframe@zb by 1%
+ \@anim@beginframe%
+ \ignorespaces%
+}
+\newcommand{\@anim@newframe}[1][]{% #1: new frame rate
+ \if@anim@step\else%
+ \edef\@anim@pfps{\@anim@nfps}%
+ \edef\@anim@nfps{#1}%
+ \ifx\@anim@nfps\@empty%
+ \edef\@anim@nfps{\@anim@pfps}%
+ \else%
+ %build JavaScript commands to fill the `nFpsAt' & `pFpsAt' arrays
+ \xdef\@anim@nfpsat{%
+ \@anim@nfpsat%
+ a\the\@anim@num.nFpsAt[\the\@anim@curframe@zb]=Math.abs(#1);%
+ }%
+ \xdef\@anim@pfpsat{%
+ \@anim@pfpsat%
+ a\the\@anim@num.pFpsAt[\the\@anim@curframe@zb]=Math.abs(\@anim@pfps);%
+ }%
+ \setboolean{@anim@chfps}{true}% change fps
+ \fi%
+ \fi%
+ \global\advance\@anim@curframe@zb by 1%
+ \@anim@beginframe%
+ \ignorespaces%
}
%starts a new frame
@@ -1366,8 +1405,12 @@
\let\if@anim@autopause=\if@anim@@autopause%
\let\if@anim@palindrome=\if@anim@@palindrome%
\let\if@anim@step=\if@anim@@step%
- \setboolean{@anim@pauseframes}{false}%
\gdef\@anim@posterocg{}%
+ \setboolean{@anim@pauseframes}{false}%
+ \gdef\@anim@pauseat{}%
+ \setboolean{@anim@chfps}{false}%
+ \gdef\@anim@nfpsat{}%
+ \gdef\@anim@pfpsat{}%
}
%package options
@@ -1504,53 +1547,52 @@
%this array takes the frame numbers at which to pause playback
a#1.pauseAt=new Array();%
\@anim@pauseat%
+ \fi%
+ \if@anim@chfps
+ %arrays that take frame numbers (array index) and fps values
+ a#1.nFpsAt=new Array();%
+ \@anim@nfpsat%
+ a#1.pFpsAt=new Array();%
+ \@anim@pfpsat%
+ a#1.fpsDeflt=Math.abs(\@anim@fps);%
\fi
- a#1.dtDefault=1000/(1e-6+Math.abs(\@anim@fps));%
- a#1.dt=a#1.dtDefault;%
+ a#1.dtDeflt=1000/(1e-6+Math.abs(\@anim@fps));%
+ a#1.dt=a#1.dtDeflt;%
\fi%
%actions
a#1.actnEndLeft=function(){%
var curIdx=a#1.idx;%
\if@anim@step\else
- try{app.clearInterval(a#1_int);}catch(e){}%
- a#1.isPlaying=false;%
- a#1.isPaused=false;% because it has been explicitely stopped
- \if@anim@controls %set Play/Pause button icons
- a#1.btn['PauseLeft'].state=false;%
- a#1.btn['PlayLeft'].state=true;%
- a#1.btn['PauseRight'].state=false;%
- a#1.btn['PlayRight'].state=true;%
- \fi%
+ a#1.actnPause();%
+ a#1.isPaused=false;% because it has been explicitly stopped
\fi
a#1.idx=0;%
a#1.fr[curIdx].state=false;%
a#1.fr[0].state=true;%
+ \if@anim@chfps
+ a#1.fpsDeflt=Math.abs(\@anim@fps);%
+ a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);%
+ a#1.dt=a#1.dtDeflt;%
+ \fi%
};%
a#1.actnEndRight=function(){%
var curIdx=a#1.idx;%
\if@anim@step\else
- try{app.clearInterval(a#1_int);}catch(e){}%
- a#1.isPlaying=false;%
+ a#1.actnPause();%
a#1.isPaused=false;%
- \if@anim@controls
- a#1.btn['PauseLeft'].state=false;%
- a#1.btn['PlayLeft'].state=true;%
- a#1.btn['PauseRight'].state=false;%
- a#1.btn['PlayRight'].state=true;%
- \fi%
\fi
a#1.idx=\@anim@frames-1;%
a#1.fr[curIdx].state=false;%
a#1.fr[a#1.idx].state=true;%
+ \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);%
+ a#1.dt=a#1.dtDeflt;%
+ \fi%
};%
- \if@anim@palindrome
- a#1.actnNext=function(){%
- var curIdx=a#1.idx;%
- \if@anim@step\else%
- \if@anim@pauseframes
- if(a#1.isPlaying&&a#1.pauseAt[a#1.idx+1]){a#1.actnPause();}%
- \fi%
- \fi
+ a#1.actnNext=function(){%
+ var curIdx=a#1.idx;%
+ \if@anim@palindrome
if(a#1.idx==\@anim@frames-1){%
\if@anim@step
a#1.playsRight=false;%
@@ -1559,17 +1601,49 @@
\fi%
}else{%
a#1.idx++;%
- a#1.fr[curIdx].state=false;%
- a#1.fr[a#1.idx].state=true;%
}%
- };%
- a#1.actnPrev=function(){%
- var curIdx=a#1.idx;%
- \if@anim@step\else%
- \if@anim@pauseframes
- if(a#1.isPlaying&&a#1.pauseAt[a#1.idx-1]){a#1.actnPause();}%
+ \else
+ if(a#1.idx==\@anim@frames-1){%
+ \if@anim@step\else%
+ \if@anim@loop
+ if(a#1.isPlaying){%
+ \if@anim@chfps
+ a#1.fpsDeflt=Math.abs(\@anim@fps);%
+ a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);%
+ a#1.dt=a#1.dtDeflt;%
+ \fi
+ a#1.actnPlayRight();%
+ }%
+ \else
+ a#1.actnEndRight();%
+ \fi%
\fi%
- \fi
+ }else{%
+ a#1.idx++;%
+ }%
+ \fi
+ a#1.fr[curIdx].state=false;%
+ a#1.fr[a#1.idx].state=true;%
+ \if@anim@step\else%
+ \if@anim@chfps
+ if(%
+ a#1.nFpsAt[a#1.idx]>=0&&%
+ a#1.nFpsAt[a#1.idx]!=a#1.fpsDeflt%
+ ){%
+ a#1.fpsDeflt=a#1.nFpsAt[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.actnPlayRight();}%
+ }%
+ \fi%
+ \if@anim@pauseframes
+ if(a#1.isPlaying&&a#1.pauseAt[a#1.idx]){a#1.actnPause();}%
+ \fi%
+ \fi%
+ };%
+ a#1.actnPrev=function(){%
+ var curIdx=a#1.idx;%
+ \if@anim@palindrome
if(a#1.idx==0){%
\if@anim@step
a#1.playsRight=true;%
@@ -1578,66 +1652,46 @@
\fi%
}else{%
a#1.idx--;%
- a#1.fr[curIdx].state=false;%
- a#1.fr[a#1.idx].state=true;%
}%
- };%
- \else
- a#1.actnNext=function(){%
- var curIdx=a#1.idx;%
- \if@anim@step\else%
- \if@anim@pauseframes
- if(a#1.isPlaying&&a#1.pauseAt[a#1.idx+1]){a#1.actnPause();}%
- \fi%
- \fi
- if(a#1.idx==\@anim@frames-1){%
+ \else
+ if(a#1.idx==0){%
\if@anim@step\else%
\if@anim@loop
if(a#1.isPlaying){%
- a#1.idx=0;%
+ \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
- try{app.clearInterval(a#1_int);}catch(e){}%
- a#1.isPlaying=false;%
- \if@anim@controls
- a#1.btn['PauseLeft'].state=false;%
- a#1.btn['PlayLeft'].state=true;%
- a#1.btn['PauseRight'].state=false;%
- a#1.btn['PlayRight'].state=true;%
- \fi%
+ a#1.actnEndLeft();%
\fi%
\fi%
- }else{a#1.idx++;}%
- a#1.fr[curIdx].state=false;%
- a#1.fr[a#1.idx].state=true;%
- };%
- a#1.actnPrev=function(){%
- var curIdx=a#1.idx;%
- \if@anim@step\else%
- \if@anim@pauseframes
- if(a#1.isPlaying&&a#1.pauseAt[a#1.idx-1]){a#1.actnPause();}%
- \fi%
- \fi
- if(a#1.idx==0){%
- \if@anim@step\else%
- \if@anim@loop
- if(a#1.isPlaying){a#1.idx=\@anim@frames-1;}%
- \else
- try{app.clearInterval(a#1_int);}catch(e){}%
- a#1.isPlaying=false;%
- \if@anim@controls
- a#1.btn['PauseLeft'].state=false;%
- a#1.btn['PlayLeft'].state=true;%
- a#1.btn['PauseRight'].state=false;%
- a#1.btn['PlayRight'].state=true;%
- \fi%
- \fi%
- \fi%
- }else{a#1.idx--;}%
- a#1.fr[curIdx].state=false;%
- a#1.fr[a#1.idx].state=true;%
- };%
- \fi%
+ }else{%
+ a#1.idx--;%
+ }%
+ \fi
+ a#1.fr[curIdx].state=false;%
+ a#1.fr[a#1.idx].state=true;%
+ \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
a#1.actnPause=function(){%
try{app.clearInterval(a#1_int);}catch(e){}%
@@ -1702,7 +1756,7 @@
}%
};%
a#1.actnReset=function(){% reset to default speed
- a#1.dt=a#1.dtDefault;%
+ a#1.dt=a#1.dtDeflt;%
try{app.clearInterval(a#1_int);}catch(e){}%
if(a#1.isPlaying){%
if(a#1.playsRight){%