summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/animate
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-01-22 03:01:16 +0000
committerNorbert Preining <norbert@preining.info>2022-01-22 03:01:16 +0000
commit26bfc07f2b7829213356de43cf5b81c3ba99e338 (patch)
treeefb3037df2c42c45c904ad131334e8fc626cea19 /macros/latex/contrib/animate
parent5d5f239204f5c0d1f7573c9ebc64b5ad1ae75b49 (diff)
CTAN sync 202201220301
Diffstat (limited to 'macros/latex/contrib/animate')
-rw-r--r--macros/latex/contrib/animate/ChangeLog3
-rw-r--r--macros/latex/contrib/animate/README.md4
-rw-r--r--macros/latex/contrib/animate/animate.pdfbin3862673 -> 3871621 bytes
-rw-r--r--macros/latex/contrib/animate/animate.sty52
-rw-r--r--macros/latex/contrib/animate/animate.tex9
-rw-r--r--macros/latex/contrib/animate/files/scarab.mp18
6 files changed, 48 insertions, 38 deletions
diff --git a/macros/latex/contrib/animate/ChangeLog b/macros/latex/contrib/animate/ChangeLog
index bc00502144..1c2cbfcd74 100644
--- a/macros/latex/contrib/animate/ChangeLog
+++ b/macros/latex/contrib/animate/ChangeLog
@@ -1,3 +1,6 @@
+2022-01-21
+ * fix: clipping for dvisvgm
+
2021-11-09
* improvement: play from beginning, regardless of poster frame setting
diff --git a/macros/latex/contrib/animate/README.md b/macros/latex/contrib/animate/README.md
index 3252779d44..1756bd8cd5 100644
--- a/macros/latex/contrib/animate/README.md
+++ b/macros/latex/contrib/animate/README.md
@@ -30,7 +30,7 @@ keepaspectratio, scale=<factor>,
bb=<llx> <lly> <urx> <ury>,
viewport=<llx> <lly> <urx> <ury>,
trim=<left> <bottom> <right> <top>,
-clip, hiresbb, pagebox=..., interpolate,
+hiresbb, pagebox=..., interpolate,
type=[<file ext>],
final, draft, nomouse,
autopause, autoplay, autoresume,
@@ -73,7 +73,7 @@ keepaspectratio, scale=<factor>,
bb=<llx> <lly> <urx> <ury>,
viewport=<llx> <lly> <urx> <ury>,
trim=<left> <bottom> <right> <top>,
-clip, hiresbb, pagebox=..., interpolate,
+hiresbb, pagebox=..., interpolate,
type=[<file ext>],
final, draft, nomouse,
autopause, autoplay, autoresume,
diff --git a/macros/latex/contrib/animate/animate.pdf b/macros/latex/contrib/animate/animate.pdf
index 2b0b39f0f1..5c84024b33 100644
--- a/macros/latex/contrib/animate/animate.pdf
+++ b/macros/latex/contrib/animate/animate.pdf
Binary files differ
diff --git a/macros/latex/contrib/animate/animate.sty b/macros/latex/contrib/animate/animate.sty
index cedd442a72..ff05e49d9c 100644
--- a/macros/latex/contrib/animate/animate.sty
+++ b/macros/latex/contrib/animate/animate.sty
@@ -13,7 +13,7 @@
\NeedsTeXFormat{LaTeX2e}[2020-10-01]
-\def\@anim@version{2021/11/09}
+\def\@anim@version{2022/01/21}
\ProvidesPackage{animate}
[\@anim@version\space PDF & SVG animations from files and inline graphics]
@@ -203,8 +203,8 @@
\def\ocgbase@add@to@off@list#1{%
\xdef\@anim@curocg{\@anim@curocg\space visibility='hidden'}%
}
- \def\ocgbase@oc@bdc#1{\special{dvisvgm:raw {?nl}<g #1>}}
- \def\ocgbase@oc@emc{\special{dvisvgm:raw {?nl}</g>}}
+ \def\ocgbase@oc@bdc#1{\special{dvisvgm:raw <g #1>}}
+ \def\ocgbase@oc@emc{\special{dvisvgm:raw </g>}}
\else
\ExplSyntaxOn
\def\@anim@dictobj#1{
@@ -476,11 +476,32 @@
\def\@anim@makeframe#1#2{%
%container box
\edef\@anim@tmpvar{\@anim@getkeyval{frmcontent@#2},}%
- \global\setbox\@anim@box=\hbox to \@anim@animwidth{%
- \vrule width \z@ height \@anim@animheight depth \@anim@animdepth%
- \expandafter\@anim@insertfrmcontent\@anim@tmpvar\@nil%
- \hss%
- }%
+ \if@anim@dvisvgm%
+ \global\setbox\@anim@box=\hbox to \@anim@animwidth{%
+ \raise\@anim@animheight\hbox{%
+ \special{dvisvgm:raw
+ <g transform="translate({?x},{?y})"><svg overflow="hidden"
+ width="\strip@pt\dimexpr0.996264\dimexpr\@anim@animwidth"
+ height="\strip@pt\dimexpr0.996264\dimexpr\@anim@animtotalheight"
+ viewBox="%
+ {?x}
+ {?(y-\strip@pt\dimexpr0.996264\dimexpr\@anim@animheight)}
+ {?(\strip@pt\dimexpr0.996264\dimexpr\@anim@animwidth)}
+ {?(\strip@pt\dimexpr0.996264\dimexpr\@anim@animtotalheight)}%
+ ">%
+ }%
+ \vrule width \z@ height \@anim@animheight depth \@anim@animdepth%
+ \expandafter\@anim@insertfrmcontent\@anim@tmpvar\@nil%
+ \special{dvisvgm:raw </svg></g>}%
+ }\hss%
+ }%
+ \else%
+ \global\setbox\@anim@box=\hbox to \@anim@animwidth{%
+ \vrule width \z@ height \@anim@animheight depth \@anim@animdepth%
+ \expandafter\@anim@insertfrmcontent\@anim@tmpvar\@nil%
+ \hss%
+ }%
+ \fi%
%inside a `landscape' environment together with the icon and widget methods,
%the frame content needs to be rotated counter-clockwise by 90 deg
\ifnum\@anim@method>\@ne\else%
@@ -1531,7 +1552,7 @@
\fi%
\@anim@reset% to default settings
\if@anim@dvisvgm%
- \special{dvisvgm:raw{?nl}%
+ \special{dvisvgm:raw
<!-- animation by LaTeX-package `animate',
https://ctan.org/tex-archive/macros/latex/contrib/animate,
v. \@anim@version\space-->%
@@ -1566,8 +1587,6 @@
\ifx\@anim@gropts\@empty\else,\fi\@anim@trim}\fi%
\ifx\@anim@angle\@empty\else\xdef\@anim@gropts{\@anim@gropts%
\ifx\@anim@gropts\@empty\else,\fi\@anim@angle}\fi%
- \if@anim@clip\xdef\@anim@gropts{\@anim@gropts%
- \ifx\@anim@gropts\@empty\else,\fi clip}\fi%
\if@anim@hiresbb\xdef\@anim@gropts{\@anim@gropts%
\ifx\@anim@gropts\@empty\else,\fi hiresbb}\fi%
\if@anim@interpolate\xdef\@anim@gropts{\@anim@gropts%
@@ -2057,7 +2076,7 @@
\if@anim@export\else\leavevmode\fi%
\@anim@reset% to default settings
\if@anim@dvisvgm%
- \special{dvisvgm:raw{?nl}%
+ \special{dvisvgm:raw
<!-- animation by LaTeX-package `animate',
https://ctan.org/tex-archive/macros/latex/contrib/animate,
v. \@anim@version\space-->%
@@ -2845,9 +2864,8 @@
\define@key{anim@user}{angle}{%
\xdef\@anim@angle{angle=#1}%
}
-\newboolean{@anim@clip}
-\define@key{anim@usr}{clip}[true]{%
- \setboolean{@anim@clip}{#1}%
+\define@key{anim@user}{clip}[true]{%
+ %no-op, as embedded graphics are always clipped to widget box
}
\newboolean{@anim@hiresbb}
\define@key{anim@user}{hiresbb}[true]{%
@@ -3158,7 +3176,6 @@
\global\let\@anim@viewport\@anim@@viewport%
\global\let\@anim@trim\@anim@@trim%
\global\let\@anim@angle\@anim@@angle%
- \global\let\if@anim@clip=\if@anim@@clip%
\global\let\if@anim@hiresbb=\if@anim@@hiresbb%
\global\let\if@anim@interpolate=\if@anim@@interpolate%
\global\let\@anim@pagebox\@anim@@pagebox%
@@ -3376,9 +3393,8 @@
\define@key{anim@pkg}{angle}{%
\xdef\@anim@@angle{angle=#1}%
}
-\newboolean{@anim@@clip}
\define@key{anim@pkg}{clip}[true]{%
- \setboolean{@anim@@clip}{#1}%
+ %no-op, as embedded graphics are always clipped to widget box
}
\newboolean{@anim@@hiresbb}
\define@key{anim@pkg}{hiresbb}[true]{%
diff --git a/macros/latex/contrib/animate/animate.tex b/macros/latex/contrib/animate/animate.tex
index b85eaa7b50..6d3101f084 100644
--- a/macros/latex/contrib/animate/animate.tex
+++ b/macros/latex/contrib/animate/animate.tex
@@ -174,7 +174,6 @@ scale=<factor>
bb=<llx> <lly> <urx> <ury>
viewport=<llx> <lly> <urx> <ury>
trim=<left> <bottom> <right> <top>
-clip
hiresbb
interpolate
pagebox=...
@@ -348,10 +347,10 @@ viewport=<llx> <lly> <urx> <ury>
trim=<left> <bottom> <right> <top>
\end{verbatim}
(\verb+\animategraphics+ only.) Crops graphic at the edges. The four lengths specify the amount to be removed from or, if negative values have been provided, to be added to each side of the graphic.
-\begin{verbatim}
-clip
-\end{verbatim}
-(\verb+\animategraphics+ only.) Clips the graphic to the (possibly modified) bounding box.
+%\begin{verbatim}
+%clip
+%\end{verbatim}
+%(\verb+\animategraphics+ only.) Clips the graphic to the (possibly modified) bounding box.
\begin{verbatim}
pagebox=...
hiresbb
diff --git a/macros/latex/contrib/animate/files/scarab.mp b/macros/latex/contrib/animate/files/scarab.mp
index ff4b9ebc6a..038157ead6 100644
--- a/macros/latex/contrib/animate/files/scarab.mp
+++ b/macros/latex/contrib/animate/files/scarab.mp
@@ -1,5 +1,5 @@
% Maxime Chupin, Alexander Grahn
-% 2021/04/08
+% 2022/01/21
prologues:=3;
outputtemplate := "%j_%c.mps";
@@ -75,16 +75,12 @@ for i:=0 upto 100:
endfor;
fi;
beginfig(i) %red scarabaeus segments
- setbounds currentpicture to
- (u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
pickup pencircle scaled 1pt;
draw scara withcolor red;
- clip currentpicture to
+ setbounds currentpicture to
(u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
endfig;
beginfig(i+101) %moving construction lines and labels
- setbounds currentpicture to
- (u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
draw 12[P,Q]--12[Q,P] dashed evenly;
draw O--M dashed evenly;
pickup pencircle scaled 1.4pt;
@@ -93,15 +89,13 @@ for i:=0 upto 100:
dotlabel.urt(btex $P$ etex, P);
dotlabel.llft(btex $Q$ etex,Q);
dotlabel.top(btex $M$ etex,M);
- clip currentpicture to
+ setbounds currentpicture to
(u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
endfig;
if (i/2.-floor(i/2.))=0: %gray lines every second image
beginfig(i/2+202)
- setbounds currentpicture to
- (u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
draw P--Q withcolor 0.8 white;
- clip currentpicture to
+ setbounds currentpicture to
(u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
endfig;
fi;
@@ -109,8 +103,6 @@ endfor;
%coordinate axes and stationary stuff
beginfig(253);
- setbounds currentpicture to
- (u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
path ida,mida;
drawarrow(-1.5u,0)--(1u,0);
drawarrow(0,-1.2u)--(0,1.2u);
@@ -129,7 +121,7 @@ beginfig(253);
dotlabel.rt(btex $B$ etex,B);
dotlabel.lft(btex $C$ etex,C);
dotlabel.lft(btex $D$ etex,D);
- clip currentpicture to
+ setbounds currentpicture to
(u,1.2u)--(u,-1.2u)--(-1.5u,-1.2u)--(-1.5u,1.2u)--cycle;
endfig;