0

I'm using the method described here to produce a presentation in SVG format. Ideally I would like some frames to contain multiple slides (using <1->,<2->... for example) some of which would play an animation (I use TIKZ's animations library). I am struggling to find a way to trigger such an animation with the beginning of a slide: basically I get all the animations in the frame starting at once(which again is not the point). Has anyone succeded in creating a frame consisting of a sequence (triggered) of slides, some static, some animated?

Here is a minimal example with 4 text blocks and two animated arrows. When using ArrowDown to navigate to slide 2, the first animation is played a second time (along with the second animation).

\documentclass[dvisvgm,aspectratio=169]{beamer}

\usepackage{tikz} \usetikzlibrary{calc,angles,animations,arrows,backgrounds,patterns,intersections,tikzmark,decorations.pathreplacing,calligraphy}

%%%%%%% SO TIKZMARK WORKS WITH XETEX
\makeatletter
\def\pgfsys@hboxsynced#1{%
  {%
    \pgfsys@beginscope%
    \setbox\pgf@hbox=\hbox{%
      \hskip\pgf@pt@x%
      \raise\pgf@pt@y\hbox{%
        \pgf@pt@x=0pt%
        \pgf@pt@y=0pt%
        \special{pdf: content q}%
        \pgflowlevelsynccm%
        \pgfsys@invoke{q -1 0 0 -1 0 0 cm}%
        \special{pdf: content -1 0 0 -1 0 0 cm q}% translate to original coordinate system
        \pgfsys@invoke{0 J [] 0 d}% reset line cap and dash
        \wd#1=0pt%
        \ht#1=0pt%
        \dp#1=0pt%
        \box#1%
        \pgfsys@invoke{n Q Q Q}%
      }%
      \hss%
    }%
    \wd\pgf@hbox=0pt%
    \ht\pgf@hbox=0pt%
    \dp\pgf@hbox=0pt%
    \pgfsys@hbox\pgf@hbox%
    \pgfsys@endscope%
  }%
}
\makeatother

%%%%%%% NAVIGATION WITH ARROWUP AND ARROWDOWN

\usepackage[totpages]{zref}
\usepackage{atbegshi}
\usepackage{fontawesome}
\setbeamertemplate{navigation symbols}{}
\AtBeginShipout{%
  \AtBeginShipoutAddToBox{%
    \special{dvisvgm:raw
      &lt;defs&gt;
      &lt;script type=&quot;text/javascript&quot;&gt;
      &lt;![CDATA[
        document.addEventListener('keydown', function(e){
          if(e.key=='ArrowDown'){
            \ifnum\thepage&lt;\ztotpages
              document.location.replace('\jobname-\the\numexpr\thepage+1\relax.svg');%
            \fi
          }else if(e.key=='ArrowUp'){
            \ifnum\thepage&gt;1
              document.location.replace('\jobname-\the\numexpr\thepage-1\relax.svg');%
            \fi%
          }
        });
      ]]&gt;
      &lt;/script&gt;
      &lt;/defs&gt;
    }%
  }%

}%

%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{frame}[plain]
\begin{tikzpicture}[remember picture]

\huge

\draw[thick] (0,0) rectangle (16,9);
\clip (0,0) rectangle (16,9);

%%%%%%% 1st slide
\begin{onlyenv}&lt;1-&gt;

\draw (4,8) node[text width=7.2cm, align=left, anchor=base] 
{Some text\subnode[inner sep=0pt]{a}{.}};

\draw (12,8) node[text width=7.2cm, align=left, anchor=base] 
{\subnode[inner sep=0pt]{b}{A}nd then some...};


\draw[thick,-&gt;] :rotate = {base = &quot;90&quot;,0s=&quot;90&quot;, 1s=&quot;0&quot;, forever, origin = {(0,0)}}  (a) --(b)  ;

\end{onlyenv}

%%%%%%% 2nd slide
\begin{onlyenv}&lt;2-&gt;

\draw (4,6) node[text width=7.2cm, align=left, anchor=base] 
{And so on \subnode[inner sep=0pt]{c}{.}};

\draw (12,6) node[text width=7.2cm, align=left, anchor=base] 
{\subnode[inner sep=0pt]{d}{.}.. and so forth...};


\draw[thick,-&gt;] :rotate = {base = &quot;90&quot;,0s=&quot;90&quot;, 1s=&quot;0&quot;, forever, origin = {(0,0)}}  (c) --(d)  ;

\end{onlyenv}



\end{tikzpicture}

\end{frame}

\end{document}

This is compiled using

xelatex -no-pdf svgbeamer.tex && xelatex -no-pdf svgbeamer.tex && dvisvgm --font-format=ttf --exact --zoom=-1 -p1,- svgbeamer.xdv

I guess this is because on each slide the timeline is reset to 0. So, ideally, I would like to find a way to make a single slide with an animation that can be paused (using a key for instance).

0 Answers0