texlive[49461] Master/texmf-dist: animate (20dec18)

commits+karl at tug.org commits+karl at tug.org
Fri Dec 21 00:33:07 CET 2018


Revision: 49461
          http://tug.org/svn/texlive?view=revision&revision=49461
Author:   karl
Date:     2018-12-21 00:33:07 +0100 (Fri, 21 Dec 2018)
Log Message:
-----------
animate (20dec18)

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

Added Paths:
-----------
    trunk/Master/texmf-dist/doc/latex/animate/README.txt

Removed Paths:
-------------
    trunk/Master/texmf-dist/doc/latex/animate/README

Modified: trunk/Master/texmf-dist/doc/latex/animate/ChangeLog
===================================================================
--- trunk/Master/texmf-dist/doc/latex/animate/ChangeLog	2018-12-20 01:23:10 UTC (rev 49460)
+++ trunk/Master/texmf-dist/doc/latex/animate/ChangeLog	2018-12-20 23:33:07 UTC (rev 49461)
@@ -1,7 +1,15 @@
+2018-12-19
+	* fix : wrong scaling of repeatedly embedded external graphics; JS-related
+	issue in case of side-by-side animations in one SVG
+
 2018-11-30
 	* fix : `setTimeout' JS method (used by timeline feature) differs bewteen
 	browsers and PDF viewers
 
+2018-11-30
+	* fix : `setTimeout' JS method (used by timeline feature) differs bewteen
+	browsers and PDF viewers
+
 2018-11-29
 	* fix : SVG usability issues on touch (mobile) devices; documentation
 	updated

Deleted: trunk/Master/texmf-dist/doc/latex/animate/README
===================================================================
--- trunk/Master/texmf-dist/doc/latex/animate/README	2018-12-20 01:23:10 UTC (rev 49460)
+++ trunk/Master/texmf-dist/doc/latex/animate/README	2018-12-20 23:33:07 UTC (rev 49461)
@@ -1,123 +0,0 @@
-===================================
- The animate Package
-
- https://gitlab.com/agrahn/animate
-
- (C) 2007--\today Alexander Grahn
-===================================
-
-
-1. Description
-==============
-
-This package provides an interface to create portable, JavaScript driven PDF
-and SVG animations from sets of (vector) graphics or rasterized image files
-or from inline (vector) graphics, such as LaTeX-picture, PSTricks or pgf/TikZ
-generated pictures, or just from typeset text.
-
-It supports the usual PDF making workflows, i. e.  pdfLaTeX, LaTeX -> dvips
--> ps2pdf (Ghostscript)/Distiller, (Xe)LaTeX -> (x)dvipdfmx, LuaLaTeX, and
-LaTeX -> dvisvgm for SVG.
-
-The resulting PDF with animations can be viewed in Acrobat Reader (except
-on mobile devices), in PDF-XChange and in Foxit Reader. Animated SVG are
-self-contained files that can be embedded into HTML using the `<object>` tag or
-opened directly in a Web browser, such as Firefox or Chromium.
-
-Note, this file only gives a summary of usage and available package and
-command options. Please refer to the documentation `animate.pdf' for details
-and examples.
-
- * Keywords: include portable PDF animation SVG animation animated PDF animated
-             SVG dvisvgm html TeX4ht web animating embed animated graphics
-             LaTeX pdfLaTeX LuaLaTeX PSTricks pgf TikZ LaTeX-picture MetaPost
-             inline graphics vector graphics animated GIF LaTeX dvips ps2pdf
-             dvipdfmx XeLaTeX JavaScript Acrobat Reader PDF-XChange Foxit Reader
-             Firefox Chrome Chromium
-
-
-2. Usage
-========
-
-\usepackage[<package options>]{animate}
-
- * Package options: width=<h-size>, height=<v-size>, totalheight=<v-size>,
-                    keepaspectratio, scale=<factor>, nomouse,
-                    autopause, autoplay, autoresume, controls[=all | none | ...],
-                    final, draft,
-                    buttonsize=<size>,
-                    buttonbg=<colour>, buttonfg=<colour>, buttonalpha=<opacity>,
-                    loop, palindrome, step,
-                    poster[=first | <num> | last | none],
-                    method=icon | widget | ocg,
-                    dvipdfmx, dvisvgm, xetex,
-                    type=[<file ext>],
-                    export
-
-
-\animategraphics[<options>]{<frame rate>}{<file basename>}{<first>}{<last>}
-
-\begin{animateinline}[<options>]{<frame rate>}
-    ... typeset material ...
-\newframe[<frame rate>]
-    ... typeset material ...
-\newframe*[<frame rate>]
-    ... typeset material ...
-\newframe
-\multiframe{<number of frames>}{[<variables>]}{
-    ... repeated (parameterized) material ...
-}
-\end{animateinline}
-
- * Command options: width=<h-size>, height=<v-size>, totalheight=<v-size>,
-                    keepaspectratio, scale=<factor>, nomouse,
-                    autopause, autoplay, autoresume, final, draft,
-                    controls[=all | none | ...],
-                    buttonsize=<size>,
-                    buttonbg=<colour>, buttonfg=<colour>, buttonalpha=<opacity>,
-                    loop, palindrome, step, measure,
-                    poster[=first | <num> | last | none],
-                    begin={<begin text>}, end={<end text>},
-                    timeline=<timeline file>,
-                    method=icon | widget | ocg,
-                    every=<number>, bb=<llx> <lly> <urx> <ury>,
-                    viewport=<llx> <lly> <urx> <ury>,
-                    trim=<left> <bottom> <right> <top>,
-                    label=<label text>, type=[<file ext>]
-
-
-3. Requirements
-===============
-
- * e-TeX
- * pdfTeX, version >= 1.20, or LuaLaTeX, version >= 0.95
- * Ghostscript, version >= 9.15 or Adobe Distiller
- * dvipdfmx, version >= 20080607
- * dvisvgm
- * Acrobat Reader (version >= 7), PDF-XChange, Foxit Reader
- * Firefox, Chrome, Chromium
-
-
-4. Installation
-===============
-
-Unzip the file `animate.tds.zip' into the local TDS root directory which can
-be found by running
-
-  kpsewhich -var-value TEXMFLOCAL
-
-on the command line.
-
-After installation, update the filename database by running `texhash' on the
-command line.
-
-TeXLive and MiKTeX users should run the package manager for installation.
-
-
-                         * * *
-
-This material is subject to the LaTeX Project Public License. See
-
-  http://mirrors.ctan.org/macros/latex/base/lppl.txt
-
-for the details of that license.

Added: trunk/Master/texmf-dist/doc/latex/animate/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/animate/README.txt	                        (rev 0)
+++ trunk/Master/texmf-dist/doc/latex/animate/README.txt	2018-12-20 23:33:07 UTC (rev 49461)
@@ -0,0 +1,123 @@
+===================================
+ The animate Package
+
+ https://gitlab.com/agrahn/animate
+
+ (C) 2007--\today Alexander Grahn
+===================================
+
+
+1. Description
+==============
+
+This package provides an interface to create portable, JavaScript driven PDF
+and SVG animations from sets of (vector) graphics or rasterized image files
+or from inline (vector) graphics, such as LaTeX-picture, PSTricks or pgf/TikZ
+generated pictures, or just from typeset text.
+
+It supports the usual PDF making workflows, i. e.  pdfLaTeX, LaTeX -> dvips
+-> ps2pdf (Ghostscript)/Distiller, (Xe)LaTeX -> (x)dvipdfmx, LuaLaTeX, and
+LaTeX -> dvisvgm for SVG.
+
+The resulting PDF with animations can be viewed in Acrobat Reader (except
+on mobile devices), in PDF-XChange and in Foxit Reader. Animated SVG are
+self-contained files that can be embedded into HTML using the `<object>` tag or
+opened directly in a Web browser, such as Firefox or Chromium.
+
+Note, this file only gives a summary of usage and available package and
+command options. Please refer to the documentation `animate.pdf' for details
+and examples.
+
+ * Keywords: include portable PDF animation SVG animation animated PDF animated
+             SVG dvisvgm html TeX4ht web animating embed animated graphics
+             LaTeX pdfLaTeX LuaLaTeX PSTricks pgf TikZ LaTeX-picture MetaPost
+             inline graphics vector graphics animated GIF LaTeX dvips ps2pdf
+             dvipdfmx XeLaTeX JavaScript Acrobat Reader PDF-XChange Foxit Reader
+             Firefox Chrome Chromium
+
+
+2. Usage
+========
+
+\usepackage[<package options>]{animate}
+
+ * Package options: width=<h-size>, height=<v-size>, totalheight=<v-size>,
+                    keepaspectratio, scale=<factor>, nomouse,
+                    autopause, autoplay, autoresume, controls[=all | none | ...],
+                    final, draft,
+                    buttonsize=<size>,
+                    buttonbg=<colour>, buttonfg=<colour>, buttonalpha=<opacity>,
+                    loop, palindrome, step,
+                    poster[=first | <num> | last | none],
+                    method=icon | widget | ocg,
+                    dvipdfmx, dvisvgm, xetex,
+                    type=[<file ext>],
+                    export
+
+
+\animategraphics[<options>]{<frame rate>}{<file basename>}{<first>}{<last>}
+
+\begin{animateinline}[<options>]{<frame rate>}
+    ... typeset material ...
+\newframe[<frame rate>]
+    ... typeset material ...
+\newframe*[<frame rate>]
+    ... typeset material ...
+\newframe
+\multiframe{<number of frames>}{[<variables>]}{
+    ... repeated (parameterized) material ...
+}
+\end{animateinline}
+
+ * Command options: width=<h-size>, height=<v-size>, totalheight=<v-size>,
+                    keepaspectratio, scale=<factor>, nomouse,
+                    autopause, autoplay, autoresume, final, draft,
+                    controls[=all | none | ...],
+                    buttonsize=<size>,
+                    buttonbg=<colour>, buttonfg=<colour>, buttonalpha=<opacity>,
+                    loop, palindrome, step, measure,
+                    poster[=first | <num> | last | none],
+                    begin={<begin text>}, end={<end text>},
+                    timeline=<timeline file>,
+                    method=icon | widget | ocg,
+                    every=<number>, bb=<llx> <lly> <urx> <ury>,
+                    viewport=<llx> <lly> <urx> <ury>,
+                    trim=<left> <bottom> <right> <top>,
+                    label=<label text>, type=[<file ext>]
+
+
+3. Requirements
+===============
+
+ * e-TeX
+ * pdfTeX, version >= 1.20, or LuaLaTeX, version >= 0.95
+ * Ghostscript, version >= 9.15 or Adobe Distiller
+ * dvipdfmx, version >= 20080607
+ * dvisvgm
+ * Acrobat Reader (version >= 7), PDF-XChange, Foxit Reader
+ * Firefox, Chrome, Chromium
+
+
+4. Installation
+===============
+
+Unzip the file `animate.tds.zip' into the local TDS root directory which can
+be found by running
+
+  kpsewhich -var-value TEXMFLOCAL
+
+on the command line.
+
+After installation, update the filename database by running `texhash' on the
+command line.
+
+TeXLive and MiKTeX users should run the package manager for installation.
+
+
+                         * * *
+
+This material is subject to the LaTeX Project Public License. See
+
+  http://mirrors.ctan.org/macros/latex/base/lppl.txt
+
+for the details of that license.


Property changes on: trunk/Master/texmf-dist/doc/latex/animate/README.txt
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
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	2018-12-20 01:23:10 UTC (rev 49460)
+++ trunk/Master/texmf-dist/source/latex/animate/animate.tex	2018-12-20 23:33:07 UTC (rev 49461)
@@ -109,7 +109,7 @@
 
 Package `animate' supports the usual workflows for making PDF, i.\,e. pdf\LaTeX{}, Lua\LaTeX{}, \LaTeX{} $\rightarrow$ \verb+dvips+ $\rightarrow$ \verb+ps2pdf+/Distiller and \pXepLaTeX{} $\rightarrow$ \verb+(x)dvipdfmx+. For animated SVG, it supports the \verb+dvisvgm+ driver. The DVI/XDV used as input for \verb+dvisvgm+ can be generated with \LaTeX{}, Lua\LaTeX{} (in DVI mode) and \XeLaTeX.
 
-PDF files with animations can be viewed in Acrobat Reader (except on mobile devices), PDF-XChange and Foxit Reader. Animated SVG produced by means of \LaTeX{} and \verb+dvisvgm+ are self-contained files that can be embedded into HTML using the \verb+<object>+ tag or opened directly in a Web browser, such as Firefox or Chromium. 
+PDF files with animations can be viewed in Acrobat Reader (except on mobile devices), PDF-XChange and Foxit Reader. Animated SVG produced by means of \LaTeX{} and \verb+dvisvgm+ are self-contained files that can be embedded into HTML using the \verb+<object>+ tag or opened directly in a Web browser, such as Chromium or Firefox. 
 
 The user interacts with the animation through optional animation controls or using the mouse like so: Pressing the mouse button over the animation widget immediately pauses a playing animation and releasing it resumes playback. Pressing the shift-key at the same time reverses the playback direction. Keeping the mouse button pressed while moving the mouse pointer off the animation widget permanently pauses playback.
 
@@ -1343,14 +1343,25 @@
 \end{verbatim}
 to produce DVI or XDV output from the \LaTeX{} source. After this, SVG is obtained by running
 \begin{verbatim}
-dvisvgm --no-fonts --exact
+dvisvgm --no-fonts --exact --zoom=-1
 \end{verbatim}
-on the intermediate DVI or XDV file. Option `\verb+--no-fonts+' prompts `\verb+dvisvgm+' to retrace font glyphs as graphical paths. It ensures that the text font looks as in normal PDF output. Option `\verb+--exact+' tells `\verb+dvisvgm+' to calculate exact bounding boxes around font glyphs. This avoids clipping of glyphs in the SVG output, as glyphs usually tend to be slightly bigger than their boxes defined in the font files. To convert multipage DVI/XDV with several animations, add option `\verb+-p1,-+'. By default, `\verb+dvisvgm+' processes only the very first page of the input file. As SVG derives from XML it is not known to be particularly economical in terms of file size. Compressed SVG, with file extension `\verb+svgz+', shortens download times and is supported by most Web browsers. It can be generated by adding option `\verb+-z+'.
+on the intermediate DVI or XDV file.
 
+Option `\verb+--no-fonts+' prompts `\verb+dvisvgm+' to retrace font glyphs as graphical paths. It ensures that the text font looks as in normal PDF output.
+
+Option `\verb+--exact+' tells `\verb+dvisvgm+' to calculate exact bounding boxes around font glyphs. This avoids clipping of glyphs in the SVG output, as glyphs usually tend to be slightly bigger than their boxes defined in the font files.
+
+The purpose of `\verb+--zoom=-1+' is to produce responsive SVG. If embedded in a Web page, this kind of SVG will automatically scale to fill up the available space of its surrounding container, usually an \verb+<object>+ tag (see below). If viewed standalone in a Web browser, a responsive SVG fills up the complete browser tab.
+
+By default, `\verb+dvisvgm+' processes only the very first page of the input file. To convert multipage DVI/XDV with several animations, add option `\verb+-p1,-+'.
+
+As SVG derives from XML it is not known to be particularly economical in terms of file size. Compressed SVG, with file extension `\verb+svgz+', shortens download times and is supported by most Web browsers. It can be generated by adding option `\verb+-z+'.
+
 The recommended way to include animated SVG into HTML is to use the \verb+<object>+ tag. The \verb+<img>+ tag does not work here, as it ignores the embedded JavaScript. However, it may still be used as fallback. Also, it allows for search engine indexing, if desired:
 \begin{lstlisting}
 <object type="image/svg+xml" data="animatedImage.svg">
-  <!-- fallback & search engine indexing -->
+  <!-- optional (increases loading time):
+       fallback & search engine indexing -->
   <img src="animatedImage.svg" />
 </object>
 \end{lstlisting}
@@ -1359,11 +1370,13 @@
 
 \section{Bugs}\label{sect:bugs}
 \begin{itemize}
-  \item The maximum frame rate that can actually be achieved largely depends on the complexity of the graphics and on the available hardware. Starting with version 8, Acrobat Reader appears to be somewhat slower. However, you might want to experiment with the graphical hardware acceleration feature that was introduced in Reader 8. Go to menu `Edit' $\rightarrow$ `Preferences' $\rightarrow$ `Page Display' $\rightarrow$ `Rendering' to see whether hardware acceleration is available. A 2D GPU acceleration check box will be visible if a supported video card has been detected.
+  \item The maximum frame rate that can actually be achieved largely depends on the complexity of the graphics and on the available hardware. In Acrobat Reader, you might want to experiment with the 2D graphical hardware acceleration feature. Go to menu `Edit' $\rightarrow$ `Preferences' $\rightarrow$ `Page Display' $\rightarrow$ `Rendering' to see whether hardware acceleration is available. A 2D GPU acceleration check box will be visible if a supported video card has been detected. Also, enabling or disabling the page cache (`Edit' $\rightarrow$ `Preferences' $\rightarrow$ `Page Display' $\rightarrow$ `Rendering' $\rightarrow$ `Use page cache') may affect the rendering performance.
 
+  \item Animated SVG is best viewed in Web browsers that are based on the Blink rendering engine. The most prominent representatives are Chrome, its open-source base Chromium and Opera. Unfortunately, Firefox is very slow.
+
 %  \item Animations may run very slowly if viewed in the Acrobat Reader web-browser plugin. Instead, open the PDF locally in the Reader application for best results.
 
-  \item The Acrobat Reader setting `Use page cache' (menu `Edit' $\rightarrow$ `Preferences' $\rightarrow$ `Startup') should be \emph{dis}abled for version 7, while remaining \emph{en}abled beginning with version 8 (menu `Edit' $\rightarrow$ `Preferences' $\rightarrow$ `Page Display' $\rightarrow$ `Rendering').
+%  \item The Acrobat Reader setting `Use page cache' (menu `Edit' $\rightarrow$ `Preferences' $\rightarrow$ `Startup') should be \emph{dis}abled for version 7, while remaining \emph{en}abled beginning with version 8 (menu `Edit' $\rightarrow$ `Preferences' $\rightarrow$ `Page Display' $\rightarrow$ `Rendering').
 
   \item The \verb+dvips+ option `\verb+-Ppdf+' should be avoided entirely or followed by something like `\verb+-D 1200+' on the command line in order to set a sensible DVI resolution. This does \emph{not} degrade the output quality! The configuration file `config.pdf' loaded by option `\verb+-Ppdf+' specifies an excessively high DVI resolution that will be passed on to the final PDF. Eventually, Acrobat Reader gets confused and will not display the frames within the animation widget.
 
@@ -1408,7 +1421,7 @@
     {\tt fmtutil-sys -{}-byfmt xelatex}
   \end{enumerate}
 
-  \item If a PDF containing animations is post-processed using tools like PDFtk to split the document into separate files, then animations in the output documents may not work.
+%  \item If a PDF containing animations is post-processed 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},\\ {\tt\string\includepdf}) into other documents as the animation capability gets lost.
 

Modified: trunk/Master/texmf-dist/tex/latex/animate/animate.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/animate/animate.sty	2018-12-20 01:23:10 UTC (rev 49460)
+++ trunk/Master/texmf-dist/tex/latex/animate/animate.sty	2018-12-20 23:33:07 UTC (rev 49461)
@@ -13,7 +13,7 @@
 
 \NeedsTeXFormat{LaTeX2e}
 
-\def\@anim at version{2018/11/30}
+\def\@anim at version{2018/12/19}
 \ProvidesPackage{animate}
 [\@anim at version\space PDF & SVG animations from files and inline graphics]
 
@@ -86,6 +86,7 @@
 %(remaining package options will be processed near end of this file)
 
 \RequirePackage{graphics}%\scalebox, \resizebox, \rotatebox
+\RequirePackage{zref-abspage}
 
 \if at anim@dvisvgm
   \setboolean{@anim at export}{false}
@@ -437,9 +438,12 @@
         ,height=\@anim at animheight,totalheight=\@anim at animtotalheight}%
     \fi%
   \fi%
-  % fingerprint "<file chksum>.<page>.<graphicx opts>" for external graphics
-  % for preventing re-embedding
-  \edef\@anim at fingerprint{\@anim at pdfmdfivesum{#3}.#4.\@anim at gropts}%
+  % fingerprint "<file chksum>.<page>.<graphicx opts>.<current document page>"
+  % of external graphics to prevent re-embedding
+  \edef\@anim at fingerprint{%
+    \@anim at pdfmdfivesum{#3}.#4.\@anim at gropts%
+    \if at anim@dvisvgm.\@anim at abspage\fi%
+  }%
   \edef\@anim at curxform{\@anim at getkeyval{xform:\@anim at fingerprint}}%
   \ifthenelse{\equal{\@anim at curxform}{}}{%
     % new "<file chksum>.<page>.<graphicx opts>"
@@ -455,8 +459,8 @@
       \vrule width \z@
         height \@anim at xformnatht{\@anim at curndims}
         depth \@anim at xformnatdp{\@anim at curndims}%
-        \@anim at refxform{\@anim at curxform}%
-        \hss%
+      \@anim at refxform{\@anim at curxform}%
+      \hss%
     }%
     \global\let\@anim@@lastxform\@anim at curxform%
     \@anim at xinline{#1}{#2}{\@anim at box}{knownfile}%
@@ -465,7 +469,7 @@
 
 %creates Form XObject from box contents
 \def\@anim at xinline#1#2#3#4{%
-  \edef\@anim at status{#4}% "newfile", "knownfile" or "inline" (inline graphics)
+  \def\@anim at status{#4}% "newfile", "knownfile" or "inline" (inline graphics)
   \edef\@anim at curwd{\the\wd#3}%
   \edef\@anim at curht{\the\ht#3}%
   \edef\@anim at curdp{\the\dp#3}%
@@ -487,12 +491,18 @@
     \@anim at xform{1}{0}{}{}{#3}% `{1}'-->with additional resources (opacity etc.)
     \global\let\@anim@@lastxform\@anim at lastxform%
     \def\@anim at status{knownfile}%
-    \global\setbox#3=\hbox to \@anim at curwd{%
-      \vrule width \z@ height \@anim at curht depth \@anim at curdp%
-      \@anim at refxform{\@anim at lastxform}%
-      \hss%
-    }%
-  }{}%
+    \ifnum\@anim at needresize>\z@\relax%
+      \global\setbox#3=\hbox to \@anim at curwd{%
+        \vrule width \z@ height \@anim at curht depth \@anim at curdp%
+        \@anim at refxform{\@anim at lastxform}%
+        \hss%
+      }%
+    \fi%
+  }{%
+    \ifthenelse{\equal{\@anim at status}{knownfile}}{%
+      \global\let\@anim at lastxform\@anim@@lastxform%
+    }{}%
+  }%
   %adjust size of current frame to final animation dims, if necessary
   \ifnum\@anim at needresize>\z@\relax%
     \global\setbox#3=\hbox{%
@@ -503,16 +513,14 @@
     }%
     \ifthenelse{\equal{\@anim at status}{knownfile}}{%
       \@anim at xform{0}{0}{}{}{#3}% without additional Resources
-      \global\let\@anim@@lastxform\@anim at lastxform%
     }{}%
   \fi%
   %distill box with inline graphics to xobject
   \ifthenelse{\equal{\@anim at status}{inline}}{%
     \@anim at xform{1}{0}{}{}{#3}% with additional Resources
-    \global\let\@anim@@lastxform\@anim at lastxform%
   }{}%
   %keep a record of XObject number
-  \@anim at newkey{img@#2}{\@anim@@lastxform}%
+  \@anim at newkey{img@#2}{\@anim at lastxform}%
   \if at anim@timeline\else%
     \@anim at newkey{frmcontent@#2}{\@anim at getkeyval{img@#2},}%
     \@anim at makeframe{#1}{#2}%
@@ -840,7 +848,7 @@
     11.5 7.5 lineto
     stroke
   }
-  \def\@anim at makebutton#1#2{% #1: name ; #2: current colour combination
+  \def\@anim at makebutton#1#2{% #1: name ; #2:current colour, alpha, ...
     \edef\@anim at arg{#1}%
     \ifx\@anim at EndLeft\@anim at arg%
       \@anim at xbutton{EndLeft}{%
@@ -900,8 +908,8 @@
         \@anim at btnstep}{#2}%
     \fi%
   }
-  \def\@anim at xbutton#1#2#3{% #1: name; #2: stroking commands, #3 current colour
-    \ifcsname btn#1:#3\endcsname\else%                            % combination
+  \def\@anim at xbutton#1#2#3{% #1: name; #2: stroking commands,
+    \ifcsname btn#1:#3\endcsname\else% #3: current colour+alpha+ ... combination
       % only create if button face doesn't exist yet
       \global\setbox\@anim at box=\hbox to 15bp {\vbox to 15bp {\vss%
         \@anim at literal{}{#2}%
@@ -1123,7 +1131,7 @@
     115 75 l
     S
   }
-  \def\@anim at makebutton#1#2{% #1: name ; #2: current colour combination
+  \def\@anim at makebutton#1#2{% #1: name ; #2: current colour, alpha, ...
     \edef\@anim at arg{#1}%
     \ifx\@anim at EndLeft\@anim at arg%
       \@anim at xbutton{EndLeft}{%
@@ -1592,7 +1600,18 @@
     \fi%
   \fi%
   \@anim at reset% to default settings
+  \if at anim@dvisvgm%
+    \special{dvisvgm:raw{?nl}%
+      <!-- animation by LaTeX-package `animate',
+        https://ctan.org/tex-archive/macros/latex/contrib/animate,
+        v. \@anim at version\space-->%
+    }%
+  \fi%
   \begingroup%
+  %store current abs. page num in macro \@anim at abspage
+  \zref at labelbyprops{anim at abspage\the\@anim at num}{abspage}%
+  \zref at def@extractdefault{\@anim at abspage}{%
+    anim at abspage\the\@anim at num}{abspage}{-1}%
   \@anim at beginLTR%
   \ifcsname Ginput at path\endcsname% make use of graphic[xs] search path
     \let\input at path\Ginput at path%
@@ -1717,8 +1736,11 @@
     \if at anim@export\else%
       % insert <script> part
       \if at anim@dvisvgm\@anim at script{\the\@anim at num}\fi%
-      \@anim at insertwidgets{\the\@anim at num}{\@anim at bgcolour:\@anim at fgcolour:%
-        \@anim at alpha\if at anim@dvisvgm:\@anim at btnsize\fi\@anim at lscape}%
+      \@anim at insertwidgets{\the\@anim at num}{%
+        \@anim at bgcolour:\@anim at fgcolour:\@anim at alpha%
+        \if at anim@dvisvgm:\@anim at btnsize:\@anim at abspage\fi%
+        \@anim at lscape%
+      }%
     \fi%
   \fi%
   \@anim at endLTR%
@@ -1731,7 +1753,7 @@
 
 %inserts animation and control button widgets
 \newboolean{@anim at controls@firstgrp}
-\def\@anim at insertwidgets#1#2{%#1:@anim at num, #2 btn colour combination
+\def\@anim at insertwidgets#1#2{%#1:@anim at num, #2 btn colour, alpha, ...
   \vtop{%
     \offinterlineskip%
     \hbox{\@anim at animwidget{#1}}%
@@ -2019,7 +2041,7 @@
   }
 \else
   \def\@anim at buttonwidget#1#2#3{%#1:@anim at num, #2:action,
-                                %#3:button face and colour combination
+                                %#3:button face and colour+alpha+... combination
     \edef\@anim at arg{#2}\@anim at jstrue\@anim at mktrue%
     \def\@anim at annotflag{/F 0}% visible, but don't print
     \ifx\@anim at PlayLeft\@anim at arg\@anim at jsfalse\fi%       %hidden, don't print |
@@ -2078,7 +2100,18 @@
   \@anim at endsanitize%
   \if at anim@export\else\leavevmode\fi%
   \@anim at reset% to default settings
+  \if at anim@dvisvgm%
+    \special{dvisvgm:raw{?nl}%
+      <!-- animation by LaTeX-package `animate',
+        https://ctan.org/tex-archive/macros/latex/contrib/animate,
+        v. \@anim at version\space-->%
+    }%
+  \fi%
   \begingroup%
+  %store current abs. page num in macro \@anim at abspage
+  \zref at labelbyprops{anim at abspage\the\@anim at num}{abspage}%
+  \zref at def@extractdefault{\@anim at abspage}{%
+    anim at abspage\the\@anim at num}{abspage}{-1}%
   \@anim at beginLTR%
   \ifdefined\NoHyper\NoHyper\fi% silently suppress any hyperref specials
   \ifcsname Ginput at path\endcsname% make use of graphic[xs] search path
@@ -2145,8 +2178,11 @@
     \if at anim@export\else%
       % insert <script> part
       \if at anim@dvisvgm\@anim at script{\the\@anim at num}\fi%
-      \@anim at insertwidgets{\the\@anim at num}{\@anim at bgcolour:\@anim at fgcolour:%
-        \@anim at alpha\if at anim@dvisvgm:\@anim at btnsize\fi\@anim at lscape}%
+      \@anim at insertwidgets{\the\@anim at num}{%
+        \@anim at bgcolour:\@anim at fgcolour:\@anim at alpha%
+        \if at anim@dvisvgm:\@anim at btnsize:\@anim at abspage\fi%
+        \@anim at lscape%
+      }%
     \fi%
     % if last frame used as poster, write frame num to aux file
     \ifnum\@anim at poster=\@anim at mone\relax%
@@ -3532,9 +3568,6 @@
     \fi
     var a#1_fps,a#1_spd;$% frames per second (FPS), speed scaling factor
     var a#1_setFps;$% function pointer for setting FPS
-    \if at anim@controls at speed
-      var a#1_spdIncr,a#1_spdDecr,a#1_spdReset;$% function pointers
-    \fi%
     \if at anim@meas % speed measurement
       var spc=String.fromCharCode(32);$%
       var a#1_frcnt,% frame counter
@@ -3547,8 +3580,17 @@
     % array of function pointers to timeline JS actions, indexed by frame number
     var a#1_usrJS,a#1_curjs;$%
   \fi
-  var a#1_seekFrame,a#1_stopFirst,a#1_stopLast,a#1_gotoNext,a#1_gotoPrev,%
-    a#1_stepBwd,a#1_stepFwd;$%
+  var a#1_seekFrame,a#1_gotoNext,a#1_gotoPrev;$%
+  var a#1_stopFirst,a#1_stopLast;$%
+  \if at anim@controls at play
+    var a#1_playPauseBwd,a#1_playPauseFwd;$%
+  \fi%
+  \if at anim@controls at step
+    var a#1_stepBwd,a#1_stepFwd;$%
+  \fi%
+  \if at anim@controls at speed
+    var a#1_spdIncr,a#1_spdDecr,a#1_spdReset;$%
+  \fi%
   \ifx\empty\@anim at label\empty\else
     var anim;$%
   \fi%
@@ -3870,6 +3912,14 @@
           \fi%
         \fi%
       };$%
+      \if at anim@controls at play
+        a#1_playPauseBwd=function(){%
+          if(a#1_playing){a#1_pause();}else{a#1_playBwd();}%
+        };$%
+        a#1_playPauseFwd=function(){%
+          if(a#1_playing){a#1_pause();}else{a#1_playFwd();}%
+        };$%
+      \fi%
       \if at anim@controls at speed
         a#1_spdIncr=function(){% speed up animation
           a#1_spd*=1.1;%
@@ -4009,6 +4059,7 @@
   \@anim at streamobj{}{%
 %    \@anim at consoleshow%
 %    console.clear();%
+    app.focusRect=false;%
     \@anim@@jsvardecls{#1}%
     \@anim@@jsinit{#1}%
     \@anim@@pojscript{#1}%
@@ -4051,9 +4102,6 @@
 
 %other trigger events in the anim widget's AA dictionary
 \gdef\@anim at wdgtDownJS#1{%
-  \if at anim@dvisvgm\else
-    app.focusRect=false;$% disable focus rectangle
-  \fi%
   \if at anim@step\else % pause on MouseDown
     try{if(a#1_playing){a#1_pause();}}catch(e){}$%
   \fi%
@@ -4124,9 +4172,6 @@
 
 %actions for control buttons
 \gdef\@anim at btnJS#1#2{%
-  \if at anim@dvisvgm\else
-    app.focusRect=false;%
-  \fi%
   \ifx#2\@anim at EndLeft
     a#1_stopFirst();%
   \else%
@@ -4134,10 +4179,10 @@
     a#1_stepBwd();%
   \else%
   \ifx#2\@anim at PlayPauseLeft
-    if(a#1_playing){a#1_pause();}else{a#1_playBwd();}%
+    a#1_playPauseBwd();%
   \else%
   \ifx#2\@anim at PlayPauseRight
-    if(a#1_playing){a#1_pause();}else{a#1_playFwd();}%
+    a#1_playPauseFwd();%
   \else%
   \ifx#2\@anim at StepRight
     a#1_stepFwd();%
@@ -4162,73 +4207,75 @@
       $<defs>$%
       <script type="text/javascript">$%
       <![CDATA[$%
-        \@anim@@jsvardecls{#1}%
-        function onload(){$%
-          \@anim@@jsinit{#1}%
-          \if at anim@nomouse\else
-            document.getElementById('anm#1').addEventListener('mouseup',%
-              onMouseUpWdgt);$%
-            document.getElementById('anm#1').addEventListener('mousedown',%
-              onMouseDownWdgt);$%
-            document.getElementById('anm#1').addEventListener('touchend',%
-              onTouchEndWdgt);$%
-            document.getElementById('anm#1').addEventListener('touchstart',%
-              onTouchStartWdgt);$%
-            document.getElementById('anm#1').addEventListener('touchmove',%
-              onTouchMove);$%
-          \fi%
-          onvisible();$% in case of `autoplay' option
-        }$%
-        function onvisible(){$%
-          \@anim@@pojscript{#1}%
-        }$%
-        function onhidden(){$%
-          \@anim@@pcjscript{#1}%
-        }$%
-        function onVisibilityChange(){$%
-          if(document.hidden){%
-            try{onhidden();}catch(e){}%
-          }else{%
-            try{onvisible();}catch(e){}%
+        \@anim@@jsvardecls{#1}% variables that are supposed to be global
+        (function(){$% IIFE (self-executing anon. function) to limit scope
+          function onload(){$%
+            \@anim@@jsinit{#1}%
+            \if at anim@nomouse\else
+              document.getElementById('anm#1').addEventListener('mouseup',%
+                onMouseUpWdgt);$%
+              document.getElementById('anm#1').addEventListener('mousedown',%
+                onMouseDownWdgt);$%
+              document.getElementById('anm#1').addEventListener('touchend',%
+                onTouchEndWdgt);$%
+              document.getElementById('anm#1').addEventListener('touchstart',%
+                onTouchStartWdgt);$%
+              document.getElementById('anm#1').addEventListener('touchmove',%
+                onTouchMove);$%
+            \fi%
+            onvisible();$% in case of `autoplay' option
           }$%
-        }$%
-	      document.addEventListener('visibilitychange',onVisibilityChange);$%
-	      window.addEventListener('load',onload);$%
-        \if at anim@nomouse\else
-          var permPause#1=false;
-          function onWidgetUpAction(event){$%
-            \@anim at wdgtUpJS{#1}%
+          function onvisible(){$%
+            \@anim@@pojscript{#1}%
           }$%
-          function onTouchStartWdgt(event){$%
-            event.preventDefault();$%
-            event.stopPropagation();$%
-            permPause#1=false;
-            \@anim at wdgtDownJS{#1}%
+          function onhidden(){$%
+            \@anim@@pcjscript{#1}%
           }$%
-          function onTouchEndWdgt(event){$%
-            event.preventDefault();$%
-            event.stopPropagation();$%
-            if(event.targetTouches.length>0){permPause#1=true;}$%
-            else{$%
-              if(permPause#1){permPause#1=false;}$%
-              else{onWidgetUpAction(event);}$%
+          function onVisibilityChange(){$%
+            if(document.hidden){%
+              try{onhidden();}catch(e){}%
+            }else{%
+              try{onvisible();}catch(e){}%
             }$%
           }$%
-          function onTouchMove(event){$%
-            event.preventDefault();$%
-            event.stopPropagation();$%
-          }$%
-          function onMouseDownWdgt(event){$%
-            event.preventDefault();$%
-            event.stopPropagation();$%
-            \@anim at wdgtDownJS{#1}%
-          }$%
-          function onMouseUpWdgt(event){$%
-            event.preventDefault();$%
-            event.stopPropagation();$%
-            onWidgetUpAction(event);$%
-          }$%
-        \fi%
+	        document.addEventListener('visibilitychange',onVisibilityChange);$%
+	        window.addEventListener('load',onload);$%
+          \if at anim@nomouse\else
+            var permPause#1=false;
+            function onWidgetUpAction(event){$%
+              \@anim at wdgtUpJS{#1}%
+            }$%
+            function onTouchStartWdgt(event){$%
+              event.preventDefault();$%
+              event.stopPropagation();$%
+              permPause#1=false;
+              \@anim at wdgtDownJS{#1}%
+            }$%
+            function onTouchEndWdgt(event){$%
+              event.preventDefault();$%
+              event.stopPropagation();$%
+              if(event.targetTouches.length>0){permPause#1=true;}$%
+              else{$%
+                if(permPause#1){permPause#1=false;}$%
+                else{onWidgetUpAction(event);}$%
+              }$%
+            }$%
+            function onTouchMove(event){$%
+              event.preventDefault();$%
+              event.stopPropagation();$%
+            }$%
+            function onMouseDownWdgt(event){$%
+              event.preventDefault();$%
+              event.stopPropagation();$%
+              \@anim at wdgtDownJS{#1}%
+            }$%
+            function onMouseUpWdgt(event){$%
+              event.preventDefault();$%
+              event.stopPropagation();$%
+              onWidgetUpAction(event);$%
+            }$%
+          \fi%
+        })();$% end of IIFE
       ]]>$%
       </script>$%
       </defs>%



More information about the tex-live-commits mailing list