texlive[45028] Master/texmf-dist: animate (12aug17)

commits+karl at tug.org commits+karl at tug.org
Sun Aug 13 00:00:06 CEST 2017


Revision: 45028
          http://tug.org/svn/texlive?view=revision&revision=45028
Author:   karl
Date:     2017-08-13 00:00:05 +0200 (Sun, 13 Aug 2017)
Log Message:
-----------
animate (12aug17)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/animate/ChangeLog
    trunk/Master/texmf-dist/doc/latex/animate/animate.pdf
    trunk/Master/texmf-dist/source/latex/animate/animate.tex
    trunk/Master/texmf-dist/tex/latex/animate/animate.sty

Modified: trunk/Master/texmf-dist/doc/latex/animate/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/doc/latex/animate/ChangeLog	2017-08-12 00:21:20 UTC (rev 45027)
+++ trunk/Master/texmf-dist/doc/latex/animate/ChangeLog	2017-08-12 22:00:05 UTC (rev 45028)
@@ -1,3 +1,8 @@
+2017-08-11
+	* new: `speed' property added to the JS animation object for scaling
+	overall animation speed
+	* fix: code of L-Attractor example improved
+
 2017-05-18
 	* new: configurable animation controls
 

Modified: trunk/Master/texmf-dist/doc/latex/animate/animate.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/source/latex/animate/animate.tex
===================================================================
--- trunk/Master/texmf-dist/source/latex/animate/animate.tex	2017-08-12 00:21:20 UTC (rev 45027)
+++ trunk/Master/texmf-dist/source/latex/animate/animate.tex	2017-08-12 22:00:05 UTC (rev 45028)
@@ -25,7 +25,7 @@
 \usepackage[utf8]{inputenc}
 %\usepackage{lmodern}
   \usepackage[tt=false]{libertine} %override beramono (doesn't look like tt font)
-  \usepackage[libertine]{newtxmath}
+  \usepackage{libertinust1math}
 \usepackage[protrusion]{microtype}
 %\usepackage{ifpdf}
 \usepackage{parskip}
@@ -38,6 +38,9 @@
 \usepackage{fancyvrb}
 \usepackage{tabularx}
 \usepackage[all]{hypcap}
+\usepackage{listings}
+\lstset{basicstyle=\ttfamily,columns=fullflexible,language={[LaTeX]TeX},commentstyle=\color{gray}}
+
 \clubpenalty=10000
 \widowpenalty=10000
 \displaywidowpenalty=10000
@@ -68,8 +71,6 @@
   allcolors=blue
 }
 
-%\usepackage[scaled=0.85]{luximono}
-
 \def\XeLaTeX{X\kern-.1667em\lower.5ex\hbox{\reflectbox{E}}\kern-.125em\LaTeX}
 \def\XeTeX{X\kern-.1667em\lower.5ex\hbox{\reflectbox{E}}\kern-.125em\TeX}
 \def\pXepLaTeX{(X\kern-.1667em\lower.5ex\hbox{\reflectbox{E}})\kern-.125em\LaTeX}
@@ -322,11 +323,10 @@
 measure
 \end{verbatim}
 Measures the frame rate during one cycle of the animation and prints the value to the JavaScript console of the Reader. (For testing purposes.)
-\hypertarget{beginend}{}%
 \begin{verbatim}
 begin={<begin text>}
 end={<end text>}
-\end{verbatim}
+\end{verbatim}\hypertarget{beginend}{}%
 (`\verb+animateinline+' only.) \verb+<begin text>+ and \verb+<end text>+ are inserted into the code at start and end of each frame. Mainly used for setting up some drawing environment, such as
 \begin{verbatim}
   begin={\begin{pspicture}(... , ...)(... , ...)},
@@ -450,8 +450,8 @@
 
 \myparagraph*{Other things to note}
 When designing the timeline, care should be taken not to include a transparency more than once into the \emph{same} animation frame. Besides the useless redundancy, this may slow down the animation speed in the Reader because the graphical objects of a multiply included transparency have to be rendered unnecessarily often at the same time. `animate' is smart enough to detect multiple inclusion and issues a warning message along with the transparency ID and the frame number if it occurs. Here is an example of a poorly designed timeline:
-\small
-\begin{verbatim}
+%\small
+\begin{lstlisting}
   ::0
   ::1x0
   ::2
@@ -459,10 +459,11 @@
   ::4,2
   ::5,1 % bad: transparency `1' included twice
   ::6
-\end{verbatim}
+\end{lstlisting}
 \normalsize
 Also, `animate' finds and warns about transparencies that have never been used in an animation timeline. This may help to avoid dead code in the final PDF.
 
+\clearpage
 \section{Programming interface}\label{sect:api}
 The package provides a simple JavaScript programming interface which gives access to the animation objects in a PDF file. A particular animation property or method can be accessed by
 \begin{verbatim}
@@ -477,7 +478,7 @@
 One potential use of the JavaScript interface could be within a timeline file associated with an animation. For example, loops over a sub-range of frames can be programmed by setting the `\verb+frameNum+' property. See Section~\ref{sect:timeline}, p.~\pageref{sect:jsfield} for details.
 
 Also, the programming interface can be used to create custom buttons for playback control. The command \verb+\mediabutton+ from the `media9' package provides a convenient way for achieving this:
-\begin{verbatim}
+\begin{lstlisting}
   \usepackage{media9}
   \usepackage{animate}
   ...
@@ -490,7 +491,7 @@
   \mediabutton[
     jsaction={anim['my_anim'].frameNum=5;}
   ]{\fbox{Goto 6th frame}}
-\end{verbatim}
+\end{lstlisting}
 
 \begin{table}[p]%[hbp]
 \centering
@@ -498,8 +499,9 @@
 \begin{tabularx}{\linewidth}[t]{lllX}\hline
 name & type & access & description\\\hline\hline
 {\tt numFrames} & Integer & read-only & Holds the total number of animation frames.\\
-{\tt frameNum}  & Integer & read+write & Gets or sets the current frame being/to\,be displayed. Note that frame numbers are zero-based. Assigning values less than zero or greater than {\tt numFrames-1} results in an error.\\
-{\tt fps} & Number & read+write & Gets or sets the animation frame rate (frames per second). Assigning values less than zero results in an error.\\
+{\tt frameNum}  & Integer & read+write & Gets or sets the current frame being/to\,be displayed. Note that frame numbers are zero-based. Assigning a value less than zero or greater than {\tt numFrames-1} results in an error.\\
+  {\tt fps} & Number & read+write & Gets or temporarily sets the animation frame rate (frames per second). Reset after reaching the end of a sequence, or if the frame rate is set in a timeline or by {\tt\string\newframe[<frame rate>]}. For scaling overall animation speed, consider using the \Verb+speed+ property. Assigning a value less than zero results in an error.\\
+  {\tt speed} & Number & read+write & Globally scales animation speed. The value must be greater than zero. A value of {\tt 1} means `normal speed' as specified by the frame rate in the document source. Larger values mean `faster', values between zero and one mean `slower'.\\
 {\tt dt} & Number & read-only & Holds the time span (milliseconds) for display of the current frame.\\
 {\tt isPlaying} & Boolean & read-only & Holds the value {\tt true} if the animation is currently playing, {\tt false} otherwise.\\
 {\tt playsFwd} & Boolean & read-only & Holds the value {\tt true} if the animation is played forward, independently of whether the animation is currently paused or not.\\
@@ -528,8 +530,8 @@
 
 The first example, Fig.~\ref{fig:taylor}, originally written by Jan Holeček~\cite{hol}, shows the exponential function $y=e^x$ and its approximation by Taylor polynomials of different degree. Below the animation, a custom button was inserted using the JavaScript programming interface and the \verb+\mediabutton+ command from the `media9' package.
 
-\small
-\begin{verbatim}
+%\small
+\begin{lstlisting}
 \documentclass{article}
 \usepackage{animate}
 \usepackage{media9}
@@ -567,8 +569,8 @@
 \end{center}
 
 \end{document}
-\end{verbatim}
-\normalsize
+\end{lstlisting}
+%\normalsize
 \begin{figure}\capstart
 \centering
 \begin{VerbatimOut}{timeline.txt}
@@ -633,8 +635,8 @@
 \caption{}\label{fig:scarab}
 \end{figure}
 
-\small
-\begin{verbatim}
+%\small
+\begin{lstlisting}
 \documentclass{article}
 \usepackage{intcalc} %defines \intcalcMod for Modulo computation
 \usepackage{animate}
@@ -676,12 +678,12 @@
 \end{center}
 
 \end{document}
-\end{verbatim}
-\normalsize
+\end{lstlisting}
+%\normalsize
 \subsection{Animating PSTricks graphics, using `{\tt animateinline}' environment}
 Fig.~\ref{fig:torus} is an inline graphics example adapted from \cite{gilg05}.
-\small
-\begin{verbatim}
+%\small
+\begin{lstlisting}
 \documentclass{article}
 \usepackage{pst-3dplot}
 \usepackage{animate}
@@ -722,8 +724,8 @@
 \end{center}
 
 \end{document}
-\end{verbatim}
-\normalsize
+\end{lstlisting}
+%\normalsize
 
 \begin{figure}
 \centering
@@ -791,7 +793,7 @@
 \immediate\closeout\OutFile%
 %
 \psset{unit=0.155,linewidth=0.5pt}%
-\begin{animateinline}[
+\noindent\begin{animateinline}[
   timeline=lorenz.tln,
   controls,poster=last,
   begin={\begin{pspicture}(-39,-13)(39,60)},
@@ -801,24 +803,24 @@
   \psset{Alpha=120,Beta=20}%
   \pstThreeDCoor[xMax=33,yMax=33,zMax=55,linecolor=black]%
 \newframe
-  \pstODEsetOrRestoreState{10 10 30} %initial condition
+  %attractor segments
+  \gdef\initCond{10 10 30}% initial condition
+  \pstVerb{/lorenzXYZall {} def} %takes the whole attractor
   \multiframe{100}{i=0+1,rtZero=0+0.25,rtOne=0.25+0.25}{%
-    \pstODEsaveState{savedState}%
-    %compute attractor segments, stored in `lorenzXYZseg'
-    \pstODEsolve[algebraic]{lorenzXYZseg}{0 1 2}{\rtZero}{\rtOne}{26}{savedState}%
-	                                                                      {\lorenz}%
-    %compute the whole attractor, stored in `lorenzXYZall', with the same stepping
-    \ifnum\i=0\relax%
-      \pstODEsolve[algebraic]{lorenzXYZall}{0 1 2}{\rtZero}{\rtOne}{26}{savedState}%
-	                                                                        {\lorenz}%
-    \else%
-      \pstODEsolve[algebraic,append]{lorenzXYZall}{0 1 2}{\rtZero}{\rtOne}{26}%
-	                                                       {savedState}{\lorenz}%
-    \fi%
+    %compute current attractor segment, store it in `lorenzXYZseg'
+    \pstODEsolve[algebraic]{%
+      lorenzXYZseg}{0 1 2}{\rtZero}{\rtOne}{26}{\initCond}{\lorenz}%
+    %empty initial condition --> next \pstODEsolve continues
+    \gdef\initCond{}%            from last state vector
+    %append segment to the whole attractor stored in `lorenzXYZall'
+    \pstVerb{%
+      /lorenzXYZall [lorenzXYZall lorenzXYZseg] aload astore cvx def}
+    %plot the current segment
     \listplotThreeD[plotstyle=line]{lorenzXYZseg}%
   }%
 \newframe% required between two \multiframe
-  \multiframe{90}{rAlpha=116+-4}{% fly-around
+  %fly-around (whole attractor)
+  \multiframe{90}{rAlpha=116+-4}{%
     \psset{Alpha=\rAlpha,Beta=20}%
     \pstThreeDCoor[xMax=33,yMax=33,zMax=55,linecolor=black]%
     \listplotThreeD[plotstyle=line]{lorenzXYZall}%
@@ -827,8 +829,8 @@
 \caption{}\label{fig:lorenz}
 \end{figure}
 
-\small
-\begin{verbatim}
+%\small
+\begin{lstlisting}
 \documentclass{article}
 \usepackage{multido}
 \usepackage{pst-3dplot}
@@ -857,7 +859,7 @@
 \immediate\closeout\OutFile%
 %
 \psset{unit=0.155,linewidth=0.5pt}%
-\begin{animateinline}[
+\noindent\begin{animateinline}[
   timeline=lorenz.tln,
   controls,poster=last,
   begin={\begin{pspicture}(-39,-13)(39,60)},
@@ -867,24 +869,24 @@
   \psset{Alpha=120,Beta=20}%
   \pstThreeDCoor[xMax=33,yMax=33,zMax=55,linecolor=black]%
 \newframe
-  \pstODEsetOrRestoreState{10 10 30} %initial condition
+  %attractor segments
+  \gdef\initCond{10 10 30}% initial condition
+  \pstVerb{/lorenzXYZall {} def} %takes the whole attractor
   \multiframe{100}{i=0+1,rtZero=0+0.25,rtOne=0.25+0.25}{%
-    \pstODEsaveState{savedState}%
-    %compute attractor segments, stored in `lorenzXYZseg'
-    \pstODEsolve[algebraic]{lorenzXYZseg}{0 1 2}{\rtZero}{\rtOne}{26}{savedState}%
-	                                                                      {\lorenz}%
-    %compute the whole attractor, stored in `lorenzXYZall', with the same stepping
-    \ifnum\i=0\relax%
-      \pstODEsolve[algebraic]{lorenzXYZall}{0 1 2}{\rtZero}{\rtOne}{26}{savedState}%
-	                                                                        {\lorenz}%
-    \else%
-      \pstODEsolve[algebraic,append]{lorenzXYZall}{0 1 2}{\rtZero}{\rtOne}{26}%
-	                                                       {savedState}{\lorenz}%
-    \fi%
+    %compute current attractor segment, store it in `lorenzXYZseg'
+    \pstODEsolve[algebraic]{%
+      lorenzXYZseg}{0 1 2}{\rtZero}{\rtOne}{26}{\initCond}{\lorenz}%
+    %empty initial condition --> next \pstODEsolve continues
+    \gdef\initCond{}%            from last state vector
+    %append segment to the whole attractor stored in `lorenzXYZall'
+    \pstVerb{%
+      /lorenzXYZall [lorenzXYZall lorenzXYZseg] aload astore cvx def}%
+    %plot the current segment
     \listplotThreeD[plotstyle=line]{lorenzXYZseg}%
   }%
 \newframe% required between two \multiframe
-  \multiframe{90}{rAlpha=116+-4}{% fly-around
+  %fly-around (whole attractor)
+  \multiframe{90}{rAlpha=116+-4}{%
     \psset{Alpha=\rAlpha,Beta=20}%
     \pstThreeDCoor[xMax=33,yMax=33,zMax=55,linecolor=black]%
     \listplotThreeD[plotstyle=line]{lorenzXYZall}%
@@ -892,7 +894,7 @@
 \end{animateinline}
 
 \end{document}
-\end{verbatim}
+\end{lstlisting}
 \normalsize
 
 The last inline example in Fig.~\ref{fig:metronome} is a ticking metronome written by Manuel Luque~\cite{luque12}. The short clicking sound was embedded by means of the `media9' package. Whenever the pendulum reaches one of its reversal points, playback of the sound file is started using JavaScript. The JavaScript code was inserted at the corresponding frame specifications in a timeline file. Since the PSTricks macros for drawing the metronome body and the pendulum are quite long they have been moved into an external file, \verb+files/pstmetronome.tex+. Note that the sound can be heard only on Win and Mac platforms. Even then, mileage may vary. A dual core CPU may be necessary for fluent playback.
@@ -1190,8 +1192,8 @@
 \end{animateinline}
 \caption{}\label{fig:metronome}
 \end{figure}
-\small
-\begin{verbatim}
+%\small
+\begin{lstlisting}
 \documentclass[12pt]{article}
 \usepackage{pstricks,pst-node,pst-plot,pst-tools,pst-text}
 \usepackage{animate}
@@ -1262,7 +1264,7 @@
 \end{center}
 
 \end{document}
-\end{verbatim}
+\end{lstlisting}
 
 \section{Bugs}\label{sect:bugs}
 \begin{itemize}
@@ -1308,7 +1310,7 @@
     \item Find the configuration file `texmf.cnf' by means of\\
     {\tt kpsewhich texmf.cnf}\\
     at the shell prompt in a terminal.
-    \item As Root, open the file in your favourite text editor, scroll to the `{\tt main\_memory}' entry and change it to the value given above; save and quit.
+    \item As Root, open the file in your favourite text editor, scroll to the\\`{\tt main\_memory}' entry and change it to the value given above; save and quit.
     \item Rebuild the formats by\\
     {\tt fmtutil-sys -{}-byfmt latex}\\
     {\tt fmtutil-sys -{}-byfmt pdflatex}\\
@@ -1317,7 +1319,7 @@
 
   \item If a PDF containing animations is postprocessed using tools like PDFtk to split the document into separate files, then animations in the output documents may not work.
 
-  \item PDFs with animations cannot be embedded (via {\tt \string\includegraphics, \string\includepdf}) into other documents as the animation capability gets lost.
+  \item PDFs with animations cannot be embedded (via {\tt\string\includegraphics},\\ {\tt\string\includepdf}) into other documents as the animation capability gets lost.
 
   \item Animations should not be placed on \emph{multilayered} slides, also known as overlays, created with presentation making classes such as Beamer or Powerdot. Although possible (on the last overlay of a slide, at best), the result might be disappointing. Put animations on flat slides only. (Of course, slides without animations may still have overlays.)
 \end{itemize}
@@ -1326,7 +1328,7 @@
 I would like to thank François Lafont who discovered quite a few bugs and made many suggestions that helped to improve the functionality of the package. Many thanks to Jin-Hwan Cho, the developer of `\verb+dvipdfmx+', for contributing the `\verb+dvipdfmx+' specific code, and to Walter Scott for proof-reading the documentation.
 
 \begin{thebibliography}{8}
-  \bibitem{chupin} Chupin, M.: \emph{Syracuse MetaPost/Animations.} URL: \href{http://melusine.eu.org/syracuse/metapost/animations/chupin/?idsec=scara}{\url{http://melusine.eu.org/syracuse/}} \href{http://melusine.eu.org/syracuse/metapost/animations/chupin/?idsec=scara}{\url{metapost/animations/chupin/?idsec=scara}}
+  \bibitem{chupin} Chupin, M.: \emph{Syracuse MetaPost/Animations.} URL: \href{http://melusine.eu.org/syracuse/metapost/animations/chupin/?idsec=scara}{\url{http://melusine.eu.org/}} \href{http://melusine.eu.org/syracuse/metapost/animations/chupin/?idsec=scara}{\url{syracuse/metapost/animations/chupin/?idsec=scara}}
 \bibitem{gilg05} Gilg, J.: PDF-Animationen. In: \emph{Die \TeX nische Kom\"odie}, Issue 4, 2005, pp.~30--37
 %\bibitem{hol} Holeček, J.: \emph{Animations in a pdf\TeX-generated PDF}. URL: \url{http://www.fi.muni.cz/~xholecek/tex/pdfanim.xhtml}
 \bibitem{hol} Holeček, J.; Sojka, P.: Animations in pdf\TeX-generated PDF. In: \emph{\TeX, XML, and Digital Typography}, Springer, 2004, pp.~179--191. doi:10.1007/978-3-540-27773-6\textunderscore14

Modified: trunk/Master/texmf-dist/tex/latex/animate/animate.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/animate/animate.sty	2017-08-12 00:21:20 UTC (rev 45027)
+++ trunk/Master/texmf-dist/tex/latex/animate/animate.sty	2017-08-12 22:00:05 UTC (rev 45028)
@@ -13,7 +13,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 
-\def\@anim at version{2017/05/18}
+\def\@anim at version{2017/08/11}
 \ProvidesPackage{animate}
 [\@anim at version\space PDF animations from files and inline graphics]
 
@@ -2050,13 +2050,6 @@
   @_for_additional_information!_____________________@\MessageBreak%
   @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@%
 }
-\xdef\@anim at icondvipswarning{%
-  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\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
 
 %macros for sanitizing characters
@@ -3103,7 +3096,7 @@
         var a#1_nFpsAt=new Array(\@anim at nfpsat);%
       \fi
       var a#1_fps=\@anim at fps==0?1e-6:\@anim at fps;%
-      var a#1_sm=1;%
+      var a#1_spd=1;%
       var a#1_setFps=function(f){%
         a#1_fps=f==0?1e-6:f;%
         if(a#1_playing){%
@@ -3266,7 +3259,7 @@
       var a#1_playRight=function(){%
         \if at anim@meas a#1_startMeas();\fi
         try{tmp_int=app.setInterval('a#1_gotoNext()',%
-          1000/a#1_fps/a#1_sm);}catch(e){}%
+          1000/a#1_fps/a#1_spd);}catch(e){}%
         try{app.clearInterval(a#1_int);}catch(e){}%
         a#1_int=tmp_int;%
         a#1_playsRight=true;%
@@ -3283,7 +3276,7 @@
       var a#1_playLeft=function(){%
         \if at anim@meas a#1_startMeas();\fi
         try{tmp_int=app.setInterval('a#1_gotoPrev()',%
-          1000/a#1_fps/a#1_sm);}catch(e){}%
+          1000/a#1_fps/a#1_spd);}catch(e){}%
         try{app.clearInterval(a#1_int);}catch(e){}%
         a#1_int=tmp_int;%
         a#1_playsRight=false;%
@@ -3298,16 +3291,16 @@
         \fi%
       };%
       \if at anim@controls at speed
-        var a#1_fpsIncr=function(){% speed up animation
-          a#1_sm*=1.1;%
+        var a#1_spdIncr=function(){% speed up animation
+          a#1_spd*=1.1;%
           a#1_setFps(a#1_fps);%
         };%
-        var a#1_fpsDecr=function(){% slow down animation
-          a#1_sm/=1.1;%
+        var a#1_spdDecr=function(){% slow down animation
+          a#1_spd/=1.1;%
           a#1_setFps(a#1_fps);%
         };%
-        var a#1_fpsReset=function(){% reset to default speed
-          a#1_sm=1;%
+        var a#1_spdReset=function(){% reset to default speed
+          a#1_spd=1;%
           a#1_setFps(a#1_fps);%
         };%
       \fi%
@@ -3372,7 +3365,16 @@
                 throw new RangeError('Frame_rate_not_in_allowed_range');%
               }else{a#1_setFps(f);}%
             },%
-            get dt(){return 1000/a#1_fps/a#1_sm;},%
+            get speed(){return a#1_spd;},%
+            set speed(s){%
+              if(s<=0||isNaN(s)){%
+                throw new RangeError('Speed_factor_not_in_allowed_range');%
+              }else{%
+                a#1_spd=s;%
+                a#1_setFps(a#1_fps);%
+              }%
+            },%
+            get dt(){return 1000/a#1_fps/a#1_spd;},%
             get playsFwd(){return a#1_playsRight;},%
           \fi
           get numFrames(){return \@anim at frames;},%
@@ -3539,13 +3541,13 @@
       a#1_stopLast();%
     \else%
     \ifx\@anim at action\@anim at Minus
-      a#1_fpsDecr();%
+      a#1_spdDecr();%
     \else%
     \ifx\@anim at action\@anim at Reset
-      a#1_fpsReset();%
+      a#1_spdReset();%
     \else%
     \ifx\@anim at action\@anim at Plus
-      a#1_fpsIncr();%
+      a#1_spdIncr();%
     \fi\fi\fi\fi\fi\fi\fi\fi\fi%
   }%
 }



More information about the tex-live-commits mailing list