4

Consider this minimal example:

\documentclass[aspectratio=169, 16pt]{beamer}
\usetheme[titleformat=smallcaps]{metropolis} % Usemetropolistheme

\usepackage[english]{babel}

\begin{document}
\begin{frame}[standout]
\only<+>{H}
\only<+>{He}
\only<+>{Hel}
\only<+>{Hell}
\only<+>{Hello}
\only<+>{Hello w}
\only<+>{Hello wo}
\only<+>{Hello wor}
\only<+>{Hello worl}
\only<+>{Hello world}
\only<+>{Hello world!}
\end{frame}
\end{document}

Basically, it's animated text using beamer's overlay. However, as far as I know, I have to manually go to the next slide to make it works. There is a way to temporize the process? I know that a solution could be to export the image, make a gif and use the animate package. However there are two downsides in this solution: gifs are not vectorial, I have to make a new gif each time I change something in the layout (like fonts or anything like that).

Note It's not mandatory to use beamer overlays. However, the solution must work with beamer class and xelatex compiler.

gvgramazio
  • 2,660
  • The animate way does not require the detour via GIF. Where did you get this information from? Pkg animate is perfectly suited for animating vectorial graphics within PDF. – AlexG Mar 11 '24 at 12:53

2 Answers2

5

You can specify the time each overlay should be shown with \transduration{<time in seconds>}:

\documentclass[aspectratio=169]{beamer}
\usetheme{moloch}% modern fork of the metropolis theme

\usepackage[english]{babel}

\begin{document} \begin{frame}[standout] \transduration{0.1} \only<+>{H} \only<+>{He} \only<+>{Hel} \only<+>{Hell} \only<+>{Hello} \only<+>{Hello w} \only<+>{Hello wo} \only<+>{Hello wor} \only<+>{Hello worl} \only<+>{Hello world} \only<+>{Hello world!} \end{frame} \end{document}

enter image description here

Note: the automatic slide transitions only work with pdf viewers that support java script and they need to be in presentation mode.

2

Just to clear up the misunderstanding that an animate-based solution would require a pre-fabricated set of bitmapped (gif, png, whatever) animation frames. Of course, a JavaScript supporting PDF viewer is required for this kind of animations; on Linux there is at least Okular that provides this functionality, besides Acrobat Reader for the other platforms.

\documentclass[aspectratio=169,16pt]{beamer}
\usetheme[titleformat=smallcaps]{metropolis} % Use metropolis theme

\usepackage{animate} \usepackage[english]{babel}

\begin{document} \begin{frame}[standout]

\begin{animateinline}[autoplay,loop]{2} \makebox[\widthof{\strut Hello world!}][l]{\strut} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut H} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut He} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut Hel} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut Hell} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut Hello} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut Hello w} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut Hello wo} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut Hello wor} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut Hello worl} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut Hello world} \newframe
\makebox[\widthof{\strut Hello world!}][l]{\strut Hello world!} \end{animateinline}

\end{frame} \end{document}

Click on the image to see the animated version (vectorial [SVG]):

AlexG
  • 54,894