diff options
author | Karl Berry <karl@freefriends.org> | 2008-05-25 01:04:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-05-25 01:04:37 +0000 |
commit | 14ef1a1bfbf2eb04c32ab038c4916e18d485156e (patch) | |
tree | a4fc3e61c8d73ec57d6e58ff8c3782d4827b415c /Master/texmf-dist/tex/latex/animate | |
parent | 1db2b9c118d22144a0de32e5ba651696ded6c4b8 (diff) |
animate update
git-svn-id: svn://tug.org/texlive/trunk@8336 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate')
-rw-r--r-- | Master/texmf-dist/tex/latex/animate/animate.sty | 240 |
1 files changed, 128 insertions, 112 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty index 4cbcadfa1f0..88e5dfe4cb6 100644 --- a/Master/texmf-dist/tex/latex/animate/animate.sty +++ b/Master/texmf-dist/tex/latex/animate/animate.sty @@ -11,7 +11,7 @@ % Supports LaTeX->dvips->ps2pdf or pdfLaTeX workflows. \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{animate}[2008/05/21] +\ProvidesPackage{animate}[2008/05/23] %test for e-TeX \ifx\eTeXversion\@undefined% @@ -433,7 +433,7 @@ \ifx\@anim@poster\@anim@posternone\else% \ifnum#2=0 \ifx\@anim@poster\@anim@posterfirst% - \def\@anim@annotflag{/F 4}% visible, print, Locked + \def\@anim@annotflag{/F 4}% visible, print \fi% \fi% \ifx\@anim@poster\@anim@posterlast% @@ -476,19 +476,19 @@ }% \if@anim@useocg% \@anim@newocg{#1}{#2}% - \def\@anim@annotflag{/F 4}%, print, visibility set by OCG, Locked + \def\@anim@annotflag{/F 4}%, print, visibility set by OCG \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 + \def\@anim@annotflag{/F 4}% visible, print \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 + \def\@anim@annotflag{/F 4}% visible, print }{}% \fi% \fi% @@ -1114,24 +1114,24 @@ \gdef\@anim@ext{.pdf}% \@anim@filebox{#1.pdf}{1}% \ifx\@anim@first\@empty% - \@anim@curframe=\@ne% + \global\@anim@curframe=\@ne% \else% \ifnum\@anim@first<0 \gdef\@anim@first{0}\fi% - \@anim@curframe=\@anim@first% - \advance\@anim@curframe by \@ne% because pdfximage pages are 1-based + \global\@anim@curframe=\@anim@first% + \global\advance\@anim@curframe by \@ne%since pdfximage pages are 1-based \ifnum\@anim@curframe>\pdflastximagepages - \@anim@curframe=\pdflastximagepages% correct wrong user input + \global\@anim@curframe=\pdflastximagepages% correct wrong user input \fi% \fi% \xdef\@anim@first{\the\@anim@curframe}% \ifx\@anim@last\@empty% - \@anim@curframe=\pdflastximagepages% + \global\@anim@curframe=\pdflastximagepages% \else% \ifnum\@anim@last<0 \gdef\@anim@last{0}\fi% - \@anim@curframe=\@anim@last% - \advance\@anim@curframe by \@ne% + \global\@anim@curframe=\@anim@last% + \global\advance\@anim@curframe by \@ne% \ifnum\@anim@curframe>\pdflastximagepages - \@anim@curframe=\pdflastximagepages% + \global\@anim@curframe=\pdflastximagepages% \fi% \fi% \ifnum\@anim@first>\@anim@curframe @@ -1172,7 +1172,7 @@ \def\@anim@last{#5}% % \@anim@checkmultipdf{\@anim@base}%test for multipage pdf - \@anim@curframe=\@anim@first% + \global\@anim@curframe=\@anim@first% \global\@anim@curframe@zb=0% % \if@anim@draft% @@ -1223,10 +1223,13 @@ \@anim@base\@anim@pad{\@anim@first}{\the\@anim@curframe}\@anim@ext% }{1}% \fi% - \advance\@anim@curframe by \@anim@every% + \global\advance\@anim@curframe by \@anim@every% \global\advance\@anim@curframe@zb by \@ne% \repeat% \xdef\@anim@frames{\the\@anim@curframe@zb}% total number + \global\@anim@tmpcnt=\@anim@frames% + \global\advance\@anim@tmpcnt by -\@ne% + \xdef\@anim@maxframe{\the\@anim@tmpcnt}% highest frame index %build timeline from optional timeline file \if@anim@timeline\@anim@buildtmln{\the\@anim@num}\fi% %insert animation widget & controls @@ -1570,6 +1573,9 @@ \global\advance\@anim@curframe@zb by \@ne% \if@anim@draft\else% \xdef\@anim@frames{\the\@anim@curframe@zb}% total number + \global\@anim@tmpcnt=\@anim@frames% + \global\advance\@anim@tmpcnt by -\@ne% + \xdef\@anim@maxframe{\the\@anim@tmpcnt}% highest frame index %build timeline from optional timeline file \if@anim@timeline\@anim@buildtmln{\the\@anim@num}\fi% %insert animation widget & controls @@ -1604,20 +1610,22 @@ \ifx\@anim@nfps\@empty% \edef\@anim@nfps{\@anim@pfps}% \else% - \ifnum\@anim@curframe@zb=0 - \xdef\@anim@fps{#1}% + \ifnum\@anim@nfps=\@anim@pfps\else% + \ifnum\@anim@curframe@zb=0 + \xdef\@anim@fps{#1}% + \fi% + %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% - %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% \fi% @@ -1643,20 +1651,22 @@ \ifx\@anim@nfps\@empty% \xdef\@anim@nfps{\@anim@pfps}% \else% - \ifnum\@anim@curframe@zb=0 - \xdef\@anim@fps{#1}% + \ifnum\@anim@nfps=\@anim@pfps\else% + \ifnum\@anim@curframe@zb=0 + \xdef\@anim@fps{#1}% + \fi% + %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% - %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% \fi% @@ -1771,6 +1781,9 @@ \closein\@anim@@tmlnfile% \xdef\@anim@transp{\@anim@frames}% total number of transparencies \xdef\@anim@frames{\the\@anim@curframe@zb}%total number of actual frames + \global\@anim@tmpcnt=\@anim@frames% + \global\advance\@anim@tmpcnt by -\@ne% + \xdef\@anim@maxframe{\the\@anim@tmpcnt}% highest frame index \global\@anim@curframe@zb=0% \gdef\@anim@maxlayer{0}% highest layer index %reopen timeline file and build timeline @@ -1819,7 +1832,7 @@ }% \closein\@anim@@tmlnfile% %check for unused transparencies - \@anim@tmpcnt=0% + \global\@anim@tmpcnt=0% \loop\ifnum\@anim@transp>\@anim@tmpcnt \ifcsname u@tr\the\@anim@tmpcnt\endcsname% {\expandafter\global\expandafter\let\csname @@ -1850,7 +1863,7 @@ \gdef\@anim@nusewarned{}% \fi% \fi% - \advance\@anim@tmpcnt by \@ne% + \global\advance\@anim@tmpcnt by \@ne% \repeat% \message{>}% } @@ -1871,19 +1884,21 @@ \ifx\@anim@nfps\@empty% no change of frame rate \xdef\@anim@nfps{\@anim@pfps}% \else% - \ifnum\@anim@curframe@zb=0 - \xdef\@anim@fps{#2}% + \ifnum\@anim@nfps=\@anim@pfps\else% + \ifnum\@anim@curframe@zb=0 + \xdef\@anim@fps{#2}% + \fi% + %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(#2);% + }% + \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% - %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(#2);% - }% - \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% %parse the third field (list of layer specifications) @@ -1922,8 +1937,8 @@ \ifnum\@anim@repeats=0 %0= means: repeat until end of timeline \edef\@anim@repeatuntil{\@anim@frames}% \else% - \@anim@tmpcnt=\@anim@curframe@zb% - \advance\@anim@tmpcnt by \@anim@repeats% + \global\@anim@tmpcnt=\@anim@curframe@zb% + \global\advance\@anim@tmpcnt by \@anim@repeats% \ifnum\@anim@frames<\@anim@tmpcnt \edef\@anim@repeatuntil{\@anim@frames}% \else% @@ -1935,7 +1950,7 @@ \ifnum\@anim@transp<#1\else% ignore non-existing \ifnum\@anim@transp=#1\else% transparencies \@anim@newkey{u@tr#1}{}% mark current transp. as used within the animation - \@anim@tmpcnt=\@anim@curframe@zb% + \global\@anim@tmpcnt=\@anim@curframe@zb% \loop\ifnum\@anim@repeatuntil>\@anim@tmpcnt %ressource list \@anim@newkey{frmxobject@\the\@anim@tmpcnt}{% @@ -1951,7 +1966,7 @@ %append transparency to list of transparencies used in the current frame \@anim@newkey{trlst@\the\@anim@tmpcnt}{% \@anim@getkeyval{trlst@\the\@anim@tmpcnt}#1,}% - \advance\@anim@tmpcnt by \@ne% + \global\advance\@anim@tmpcnt by \@ne% \repeat% \fi% \fi% @@ -2441,8 +2456,10 @@ %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 + \if@anim@controls + a#1.btn=new Array();%takes references to control button face ocgs + a#1.sm=1;% speed multiplyer + \fi% %initialize fr & btn properties \if@anim@useocg %get array of ocgs of current page @@ -2473,22 +2490,24 @@ 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;% + \if@anim@controls% + \if@anim@step\else + %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;% + }% }% - }% + \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;% + a#1.idx=\@anim@maxframe;% \else % first & none a#1.idx=0;% \fi% @@ -2512,10 +2531,9 @@ \@anim@nfpsat% a#1.pFpsAt=new Array();% \@anim@pfpsat% - a#1.fpsDeflt=Math.abs(\@anim@fps);% + a#1.fps=Math.abs(\@anim@fps);% \fi - a#1.dtDeflt=1000/(1e-6+Math.abs(\@anim@fps));% - a#1.dt=a#1.dtDeflt;% + a#1.dt=1000/(1e-6+Math.abs(\@anim@fps));% \fi% %actions a#1.actnEndLeft=function(){% @@ -2534,9 +2552,8 @@ curdoc.dirty=false;% \fi% \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;% + a#1.fps=Math.abs(\@anim@fps);% + a#1.dt=1000/(1e-6+a#1.fps);% \fi% };% a#1.actnEndRight=function(){% @@ -2546,18 +2563,17 @@ \fi% \if@anim@useocg a#1.fr[a#1.idx].state=false;% - a#1.idx=\@anim@frames-1;% + a#1.idx=\@anim@maxframe;% 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.idx=\@anim@maxframe;% 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);% - a#1.dt=a#1.dtDeflt;% + a#1.fps=Math.abs(\@anim@nfps);% + a#1.dt=1000/(1e-6+a#1.fps);% \fi% };% a#1.actnNext=function(){% @@ -2597,9 +2613,8 @@ \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;% + a#1.fps=Math.abs(\@anim@fps);% + a#1.dt=1000/(1e-6+a#1.fps);% \fi a#1.actnPlayRight();% }else{a#1.actnEndRight();}% @@ -2613,11 +2628,10 @@ \if@anim@chfps if(% a#1.nFpsAt[a#1.idx]>=0&&% - a#1.nFpsAt[a#1.idx]!=a#1.fpsDeflt% + a#1.nFpsAt[a#1.idx]!=a#1.fps% ){% - a#1.fpsDeflt=a#1.nFpsAt[a#1.idx];% - a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);% - a#1.dt=a#1.dtDeflt;% + a#1.fps=a#1.nFpsAt[a#1.idx];% + a#1.dt=1000/(1e-6+a#1.fps);% if(a#1.isPlaying){a#1.isPaused=true;a#1.actnPlayRight();}% }% \fi% @@ -2664,9 +2678,8 @@ \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;% + a#1.fps=Math.abs(\@anim@nfps);% + a#1.dt=1000/(1e-6+a#1.fps);% \fi a#1.actnPlayLeft();% }else{a#1.actnEndLeft();}% @@ -2680,11 +2693,10 @@ \if@anim@chfps if(% a#1.pFpsAt[a#1.idx]>=0&&% - a#1.pFpsAt[a#1.idx]!=a#1.fpsDeflt% + a#1.pFpsAt[a#1.idx]!=a#1.fps% ){% - a#1.fpsDeflt=a#1.pFpsAt[a#1.idx];% - a#1.dtDeflt=1000/(1e-6+a#1.fpsDeflt);% - a#1.dt=a#1.dtDeflt;% + a#1.fps=a#1.pFpsAt[a#1.idx];% + a#1.dt=1000/(1e-6+a#1.fps);% if(a#1.isPlaying){a#1.isPaused=true;a#1.actnPlayLeft();}% }% \fi% @@ -2720,7 +2732,9 @@ a#1.btn['PlayRight'].state=false;% \fi% \if@anim@meas a#1.startMeas();\fi - a#1_int=app.setInterval('a#1.actnNext()',a#1.dt);% + a#1_int=app.setInterval(% + 'a#1.actnNext()',a#1.dt\if@anim@controls/a#1.sm\fi% + );% };% \if@anim@ctrlorplndrm a#1.actnPlayLeft=function(){% @@ -2736,40 +2750,42 @@ 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);% + a#1_int=app.setInterval(% + 'a#1.actnPrev()',a#1.dt\if@anim@controls/a#1.sm\fi% + );% };% \fi% \if@anim@controls a#1.actnIncr=function(){% speed up animation try{app.clearInterval(a#1_int);}catch(e){}% - a#1.dt/=1.2;% + a#1.sm*=1.2;% if(a#1.isPlaying){% if(a#1.playsRight){% - a#1_int=app.setInterval('a#1.actnNext()',a#1.dt);% + a#1_int=app.setInterval('a#1.actnNext()',a#1.dt/a#1.sm);% }else{% - a#1_int=app.setInterval('a#1.actnPrev()',a#1.dt);% + a#1_int=app.setInterval('a#1.actnPrev()',a#1.dt/a#1.sm);% }% }% };% a#1.actnDecr=function(){% slow down animation try{app.clearInterval(a#1_int);}catch(e){}% - a#1.dt*=1.2;% + a#1.sm/=1.2;% if(a#1.isPlaying){% if(a#1.playsRight){% - a#1_int=app.setInterval('a#1.actnNext()',a#1.dt);% + a#1_int=app.setInterval('a#1.actnNext()',a#1.dt/a#1.sm);% }else{% - a#1_int=app.setInterval('a#1.actnPrev()',a#1.dt);% + a#1_int=app.setInterval('a#1.actnPrev()',a#1.dt/a#1.sm);% }% }% };% a#1.actnReset=function(){% reset to default speed - a#1.dt=a#1.dtDeflt;% + a#1.sm=1;% try{app.clearInterval(a#1_int);}catch(e){}% if(a#1.isPlaying){% if(a#1.playsRight){% - a#1_int=app.setInterval('a#1.actnNext()',a#1.dt);% + a#1_int=app.setInterval('a#1.actnNext()',a#1.dt/a#1.sm);% }else{% - a#1_int=app.setInterval('a#1.actnPrev()',a#1.dt);% + a#1_int=app.setInterval('a#1.actnPrev()',a#1.dt/a#1.sm);% }% }% };% @@ -2796,9 +2812,9 @@ \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(...) + %actnEndLeft()/actnEndRight() & actnPlayLeft()/actnPlayRight() 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();% @@ -2922,7 +2938,7 @@ a#1.actnPrev();% }% \else - if(a#1.idx==\@anim@frames-1){% + if(a#1.idx==\@anim@maxframe){% a#1.actnEndLeft();% }else{% a#1.actnNext();% |