summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/animate
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-08-22 21:30:27 +0000
committerKarl Berry <karl@freefriends.org>2018-08-22 21:30:27 +0000
commit54c2af3ea9049e37e7d59eb5563834b7339defbe (patch)
tree2d47631dab9eff06a3d4b4d93abda6f7a6d0c2c1 /Master/texmf-dist/tex/latex/animate
parentbe3509525c1dff73357ecd5c3037598ebaaa2268 (diff)
animate (22aug18)
git-svn-id: svn://tug.org/texlive/trunk@48455 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/animate')
-rw-r--r--Master/texmf-dist/tex/latex/animate/animate.sty171
1 files changed, 126 insertions, 45 deletions
diff --git a/Master/texmf-dist/tex/latex/animate/animate.sty b/Master/texmf-dist/tex/latex/animate/animate.sty
index fb750a5184f..9e5e3d63566 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{2018/06/27}
+\def\@anim@version{2018/08/22}
\ProvidesPackage{animate}
[\@anim@version\space PDF animations from files and inline graphics]
@@ -56,6 +56,30 @@
\setboolean{@anim@dvipdfmx}{true}
\setboolean{@anim@dvips}{false}
\fi
+%exporting animation frames
+\newboolean{@anim@export}
+\setboolean{@anim@export}{false}
+\newboolean{@anim@insideexport}
+\setboolean{@anim@insideexport}{false}
+\newenvironment{anim@export}{%
+ \global\@anim@insideexporttrue%
+}{%
+ \global\@anim@insideexportfalse%
+}
+\DeclareOptionX{export}{%
+ \@ifclassloaded{standalone}{}{
+ \PackageError{animate}{%
+ Option `export' requires `standalone' document class.\MessageBreak%
+ Replace current document class with `standalone'%
+ }{%
+ Put the line\MessageBreak%
+ `\protect\documentclass{standalone}'\MessageBreak%
+ at the beginning of the document preamble.%
+ }%
+ }%
+ \setboolean{@anim@export}{true}
+ \standaloneenv{anim@export}
+}
\DeclareOptionX*{}\ProcessOptionsX*\relax %allow anything as an option
%(remaining package options will be processed near end of this file)
@@ -416,18 +440,20 @@
/T (#1.#2)%
}%
\or% ocg based
- \@anim@newocg{#1}{#2}%
- %initial visibility
- \ifnum\@anim@poster=\@anim@mone\relax% use last frame as poster
- \ifthenelse{%
- \NOT\equal{\@anim@getkeyval{a#1.poster}}{}\AND%
- #2=\@anim@getkeyval{a#1.poster}%
- }{}{%
- \ocgbase@add@to@off@list{\@anim@curocg}%
- }%
- \else%
- \ifnum#2=\@anim@poster\relax\else%
- \ocgbase@add@to@off@list{\@anim@curocg}%
+ \if@anim@export\else%
+ \@anim@newocg{#1}{#2}%
+ %initial visibility
+ \ifnum\@anim@poster=\@anim@mone\relax% use last frame as poster
+ \ifthenelse{%
+ \NOT\equal{\@anim@getkeyval{a#1.poster}}{}\AND%
+ #2=\@anim@getkeyval{a#1.poster}%
+ }{}{%
+ \ocgbase@add@to@off@list{\@anim@curocg}%
+ }%
+ \else%
+ \ifnum#2=\@anim@poster\relax\else%
+ \ocgbase@add@to@off@list{\@anim@curocg}%
+ \fi%
\fi%
\fi%
\def\@anim@needresize{0}%
@@ -446,15 +472,19 @@
}%
}%
\fi%
- %frame insertion
-% % marked content method
-% \@anim@xform{0}{0}{}{}{\@anim@box}%
-% \ocgbase@oc@bdc{\@anim@curocg}%
-% \@anim@refxform{\@anim@lastxform}%
-% \ocgbase@oc@emc%
- % /OC method
- \@anim@xform{0}{0}{}{/OC \@anim@curocg}{\@anim@box}%
- \@anim@refxform{\@anim@lastxform}%
+ \if@anim@export%
+ \box\@anim@box%
+ \else%
+ %frame insertion
+ % /OC method
+ \@anim@xform{0}{0}{}{/OC \@anim@curocg}{\@anim@box}%
+ \@anim@refxform{\@anim@lastxform}%
+% % marked content method
+% \@anim@xform{0}{0}{}{}{\@anim@box}%
+% \ocgbase@oc@bdc{\@anim@curocg}%
+% \@anim@refxform{\@anim@lastxform}%
+% \ocgbase@oc@emc%
+ \fi%
\fi%
}
@@ -712,7 +742,7 @@
%Distiller
mark /CA \@anim@alpha /ca \@anim@alpha /SetTransparency pdfmark%
} ifelse%
- }%
+ }%
\@anim@refxform{\@anim@lastxform}%
}\hss}%
\@anim@xform{0}{0}{}{}{\@anim@box}%
@@ -1292,7 +1322,7 @@
% #5: last frame (integer)
\newcommand{\animategraphics}[5][]{%
\@anim@endsanitize%
- \leavevmode%
+ \if@anim@export\else\leavevmode\fi%
\if@anim@grxloaded\else%
\if@anim@dvipdfmx\if@anim@xetex%
\@anim@missing{graphicx}\else%
@@ -1347,7 +1377,11 @@
\fi%
\global\@anim@curframe=\@anim@first%
\global\@anim@curframe@zb=\z@%
- %
+ \if@anim@export%
+ \def\@anim@method{\tw@}%
+ \setboolean{@anim@controls}{false}%
+ \setboolean{@anim@draft}{false}%
+ \fi%
\if@anim@draft%
\if@anim@multipage%
%store file in a box
@@ -1379,8 +1413,14 @@
\fi%
\xdef\@anim@fps{\@anim@nfps}%
%
+ \if@anim@export\if@anim@timeline%
+ \anim@export%
+ \fi\fi%
%read all frames of the sequence
\loop\ifnum\@anim@curframe\@anim@relop\@anim@last\relax\else%
+ \if@anim@export\if@anim@timeline\else%
+ \anim@export%
+ \fi\fi%
\if@anim@multipage%
%embed graphics
\@anim@ximage{\the\@anim@num}{\the\@anim@curframe@zb}{%
@@ -1394,6 +1434,9 @@
\@anim@ximage{\the\@anim@num}{\the\@anim@curframe@zb}{%
\@anim@pathtofile}{1}%
\fi%
+ \if@anim@export\if@anim@timeline\else%
+ \endanim@export%
+ \fi\fi%
\global\advance\@anim@curframe by \@anim@every%
\global\advance\@anim@curframe@zb by \@ne%
\repeat%
@@ -1402,16 +1445,16 @@
\global\advance\@anim@tmpcnt by -\@ne%
\xdef\@anim@maxframe{\the\@anim@tmpcnt}% highest frame index
%build timeline from optional timeline file
- \@anim@sanitizeJS%
\if@anim@timeline\@anim@buildtmln{\the\@anim@num}\fi%
% if last frame used as poster, write frame num to aux file
\ifnum\@anim@poster=\@anim@mone\relax%
\@anim@keytoaux{a\the\@anim@num.poster}{\@anim@maxframe}%
\fi%
- %insert animation widget & controls
- \@anim@insertwidgets{\the\@anim@num}{%
- \@anim@getkeyval{btncol:\@anim@bgcolour:\@anim@fgcolour\@anim@lscape}}%
- \@anim@endsanitize%
+ \if@anim@export\else%
+ %insert animation widget & controls
+ \@anim@insertwidgets{\the\@anim@num}{%
+ \@anim@getkeyval{btncol:\@anim@bgcolour:\@anim@fgcolour\@anim@lscape}}%
+ \fi%
\fi%
\@anim@endLTR%
\endgroup%
@@ -1475,7 +1518,7 @@
}
\newcount\@anim@resizeflags% resizing flags according to options given.
-%
+
%set animation widget dimensions
\def\@anim@scale#1{% #1: box number
\begingroup%
@@ -1695,10 +1738,11 @@
% #2: frame rate (fps)
\newenvironment{animateinline}[2][]{%
\@anim@endsanitize%
- \leavevmode%
+ \if@anim@export\else\leavevmode\fi%
\@anim@reset% to default settings
\begingroup%
\@anim@beginLTR%
+ \ifdefined\NoHyper\NoHyper\fi% silently suppress any hyperref specials
\ifcsname Ginput@path\endcsname% make use of graphic[xs] search path
\let\input@path\Ginput@path%
\fi%
@@ -1719,6 +1763,11 @@
\fi%
\global\@anim@curframe@zb=\z@%
\global\@anim@skipfram=\z@%
+ \if@anim@export%
+ \def\@anim@method{\tw@}%
+ \setboolean{@anim@controls}{false}%
+ \setboolean{@anim@draft}{false}%
+ \fi%
\if@anim@draft\else%
%create button faces if necessary
\if@anim@controls%
@@ -1733,8 +1782,10 @@
\xdef\@anim@nfps{-1}%
\@anim@processfpsarg{#2}%
\fi%
+ \if@anim@export\if@anim@timeline%
+ \anim@export%
+ \fi\fi%
\fi%
- \ifdefined\NoHyper\NoHyper\fi% silently suppress any hyperref specials
\let\newframe\@anim@@newframe%
\let\multiframe\@anim@multiframe%
\@anim@beginframe%
@@ -1742,7 +1793,6 @@
}{%
\unskip%
\@anim@endframe{\the\@anim@num}{\the\@anim@curframe@zb}%
- \ifdefined\endNoHyper\endNoHyper\fi%
\global\advance\@anim@curframe@zb by \@ne%
\if@anim@draft\else%
\xdef\@anim@frames{\the\@anim@curframe@zb}% total number
@@ -1750,17 +1800,18 @@
\global\advance\@anim@tmpcnt by -\@ne%
\xdef\@anim@maxframe{\the\@anim@tmpcnt}% highest frame index
%build timeline from optional timeline file
- \@anim@sanitizeJS%
\if@anim@timeline\@anim@buildtmln{\the\@anim@num}\fi%
%insert animation widget & controls
- \@anim@insertwidgets{\the\@anim@num}{%
- \@anim@getkeyval{btncol:\@anim@bgcolour:\@anim@fgcolour\@anim@lscape}}%
- \@anim@endsanitize%
+ \if@anim@export\else%
+ \@anim@insertwidgets{\the\@anim@num}{%
+ \@anim@getkeyval{btncol:\@anim@bgcolour:\@anim@fgcolour\@anim@lscape}}%
+ \fi%
% if last frame used as poster, write frame num to aux file
\ifnum\@anim@poster=\@anim@mone\relax%
\@anim@keytoaux{a\the\@anim@num.poster}{\@anim@maxframe}%
\fi%
\fi%
+ \ifdefined\endNoHyper\endNoHyper\fi%
\@anim@endLTR%
\endgroup%
\global\advance\@anim@num by \@ne%
@@ -1845,6 +1896,9 @@
%starts new frame
\def\@anim@beginframe{%
+ \if@anim@export\if@anim@timeline\else\ifnum\@anim@skipfram=\z@\relax%
+ \anim@export%
+ \fi\fi\fi%
\begingroup%
\lrbox{\@anim@box}% store graphics in a box
\ifdefined\@anim@curTxtDir\textdir\@anim@curTxtDir\fi%
@@ -1887,6 +1941,9 @@
\if@anim@draft\else%
\@anim@xinline{#1}{#2}{\@anim@box}{!}%
\fi%
+ \if@anim@export\if@anim@timeline\else%
+ \endanim@export%
+ \fi\fi%
\fi%
\global\advance\@anim@skipfram by \@ne%
\ifnum\@anim@skipfram=\@anim@every\relax%
@@ -2086,11 +2143,13 @@
\newcount\@anim@curfield %current field of input line processed
\def\@anim@buildtmln#1{% #1:@anim@num
- \endlinechar=-1% suppress trailing space at input line end
\global\@anim@curframe@zb=\z@%
%read timeline file a first time to get number of lines (= number of frames)
\openin\@anim@@tmlnfile=\@anim@tmlnfile%
- \read\@anim@@tmlnfile to \@anim@inputline%
+ \@anim@sanitizeJS%
+ \endlinechar=-1% suppress trailing space at input line end
+ \global\read\@anim@@tmlnfile to \@anim@inputline%
+ \@anim@endsanitize%
\edef\@anim@inputline{\@anim@inputline\space}%
%remove all spaces from input line
\edef\@anim@inputline{\expandafter\zap@space\@anim@inputline\@empty}%
@@ -2103,7 +2162,10 @@
\@anim@newkey{frmcontent@\the\@anim@curframe@zb}{}%
\global\advance\@anim@curframe@zb by \@ne%
}%
- \read\@anim@@tmlnfile to \@anim@inputline%
+ \@anim@sanitizeJS%
+ \endlinechar=-1% suppress trailing space at input line end
+ \global\read\@anim@@tmlnfile to \@anim@inputline%
+ \@anim@endsanitize%
\edef\@anim@inputline{\@anim@inputline\space}%
\edef\@anim@inputline{\expandafter\zap@space\@anim@inputline\@empty}%
\ifeof\@anim@@tmlnfile\setboolean{@anim@eof}{true}\else%
@@ -2120,7 +2182,10 @@
%reopen timeline file and build timeline
\openin\@anim@@tmlnfile=\@anim@tmlnfile%
\global\@anim@lineno=\z@%
- \read\@anim@@tmlnfile to \@anim@inputline%
+ \@anim@sanitizeJS%
+ \endlinechar=-1% suppress trailing space at input line end
+ \global\read\@anim@@tmlnfile to \@anim@inputline%
+ \@anim@endsanitize%
\edef\@anim@inputlinenospc{\@anim@inputline\space}%
\edef\@anim@inputlinenospc{%
\expandafter\zap@space\@anim@inputlinenospc\@empty}%
@@ -2153,11 +2218,13 @@
\global\advance\@anim@curlayer by \@ne%
\repeat%
%detect multiple inclusion of the same transp. in the current frame
- \edef\@anim@trlst{%
+ \xdef\@anim@trlst{%
\the\@anim@curframe@zb.\@anim@getkeyval{trlst@\the\@anim@curframe@zb}}%
\expandafter\@anim@findmult\@anim@trlst,\@nil%
+ \if@anim@export\if@anim@insideexport\else\anim@export\fi\fi%
%insert frame Widget
\@anim@makeframe{#1}{\the\@anim@curframe@zb}%
+ \if@anim@export\endanim@export\fi%
%clean-up
\expandafter\@anim@resetmult\@anim@trlst,\@nil%
\@anim@newkey{trlst@\the\@anim@curframe@zb}{}%
@@ -2165,12 +2232,16 @@
\message{.}%
\global\advance\@anim@curframe@zb by \@ne%
}%
- \read\@anim@@tmlnfile to \@anim@inputline%
+ \@anim@sanitizeJS%
+ \endlinechar=-1% suppress trailing space at input line end
+ \global\read\@anim@@tmlnfile to \@anim@inputline%
+ \@anim@endsanitize%
\edef\@anim@inputlinenospc{\@anim@inputline\space}%
\edef\@anim@inputlinenospc{%
\expandafter\zap@space\@anim@inputlinenospc\@empty}%
\ifeof\@anim@@tmlnfile\setboolean{@anim@eof}{true}\else%
- \setboolean{@anim@eof}{false}\fi%
+ \setboolean{@anim@eof}{false}%
+ \fi%
}%
\message{\the\@anim@curframe@zb\space frames built}%
\closein\@anim@@tmlnfile%
@@ -2760,6 +2831,13 @@
}{}%
}%
}%
+\define@key{anim@pkg}{export}[]{
+ \ifthenelse{\equal{#1}{}}{}{%
+ \PackageError{animate}{%
+ Package option `export' does not accept arguments%
+ }{}%
+ }%
+}%
\def\@anim@@bg{}
\def\@anim@@bgcolour{}
\define@key{anim@pkg}{buttonbg}{%background colour of buttons
@@ -2990,6 +3068,9 @@
}%
\define@key{anim@pkg}{draft}[true]{%
\setboolean{@anim@@draft}{#1}%
+ \if@anim@export%
+ \setboolean{@anim@@draft}{false}%
+ \fi%
}
\define@key{anim@pkg}{final}[true]{%
\ifthenelse{\equal{#1}{true}}{%