17

Many years ago when I saw these videos I has been fascinated by how the formulas were transformed and/or modified. See, for example this video of youtube (Kinetic and Potential Energy) from the minute 8:57:

enter image description here

or this video minutes 9:51 (The evolution of atomic models)

enter image description here

where the formulas are probably constructed with a character that is similar to computer modern(CM). It is interesting the movement and transformation for example of a summation with an integral.

But currently this kind of animated formulas like the videos I mentioned can be made with a specific package of LaTeX or is my question just an unrealizable request?

Sebastiano
  • 54,118
  • 1
    Those animations were made by Jim Blinn and he has some interesting links on his homepage: http://www.jimblinn.com – DG' Apr 01 '20 at 20:03
  • @DG' Thank you for the information I received I didn't know. I was asking if after so many years all this is possible at LaTeX. I'm seeing the site now. – Sebastiano Apr 01 '20 at 20:05
  • 2
    There is animate which can do a lot. But I'd rather create the formulas in LaTeX and animate them with some kind of specialised software, like blender, synfig studio or krita – DG' Apr 01 '20 at 20:31
  • @DG' I know what Krita is, but I wouldn't know where to start. I tend to zero in this area. I'm sorry. – Sebastiano Apr 01 '20 at 20:35
  • 2
    I would like to add „manim“. It‘s a Python module developed by 3blue1brown (one of my favorite channels on YouTube! His animations and the teaching style are stunning!). The module uses LaTeX to generate any mathematical graphics. So check it out. It is definitely worth taking a look at it: manim – Wulle Apr 02 '20 at 06:54
  • @Wulle I thank you so much for what you wrote with so much heart. Thank you for the addition that can not only be useful to me but also to other users. A cordial greeting. Sebastian – Sebastiano Apr 02 '20 at 10:12
  • @Wulle I have seen the videos...fantastic and I see if exists something for the integrals. But I not know Python :-( language. :-((((. – Sebastiano Apr 02 '20 at 11:32

1 Answers1

23

It is not particularly difficult to create something like this. If you want to see the animation on a pdf, use \usepackage{animate} instead of \usepackage[export]{animate}, and watch the resulting pdf with Acrobat Reader in the fullscreen mode.

\documentclass{standalone} 
%\usepackage{animate}
\usepackage[export]{animate}
\usepackage{tikz}
\tikzset{pics/shadowed/.style={code={
\node[xshift=-0.4ex,yshift=-0.4ex,text=gray!60!black]{#1};
\node[text=white]{#1};}}}
\begin{document}
\begin{animateinline}[autoplay,loop]{2}
\multiframe{42}{i=0+1}{%
 \begin{tikzpicture}[nodes={scale=1.5}]
  \fill[gray] (-5,-4) rectangle (5,4); % background
  \path (0,0) pic{shadowed={$\displaystyle r=\frac{\ifnum\i<36\relax
  L^2\else n^2\,\hbar^2\fi}{D\,M}$}}; %main (?) formula
  \ifnum\i>5 % L formula pops up at i=6
  \ifnum\i<36 % L formula disappears i=36
  \pgfmathsetmacro{\mysp}{max(0.8*(\i-24),0)}% negative space for i>24
  % define a path and move the L formula along it
  \path (1,1) arc[start angle=120,end angle=-200,x radius=1.2,y radius=1.45]
  pic[pos={min((\i-5)/18,1)}]{shadowed={$L_n\hspace{-\mysp pt}=\hspace{-\mysp pt}n\,\hspace{-\mysp pt}\hbar$}};
  \fi
  \fi
\end{tikzpicture}}
\end{animateinline}
\end{document}

enter image description here

Please note that I made no effort to fully reproduce the animation, just indicate some of the methods that might bring you there.

EDIT: Added explanations.

ADDENDUM: An animated version of this post for all who have to prepare online lectures in these crazy days.

\documentclass{standalone}
\usepackage{tikz}
\usepackage[export]{animate}
\begin{document}
\begin{animateinline}[autoplay,loop]{2}
\multiframe{24}{i=2+1}{%
\begin{tikzpicture}[>=stealth]
  \pgfmathsetmacro{\nextx}{4/\i}
  \pgfmathsetmacro{\xmax}{4-\nextx}
  \foreach \x in {0,\nextx,...,\xmax} {%
    \draw[fill=cyan] (\x,0) rectangle (\x+\nextx,{.25*pow(\x+\nextx,2)});
    \draw[fill=orange] (\x,0) rectangle  (\x+\nextx,.25*\x*\x);
  }
  \draw [->] (-.5,0) -- ++(5,0) node[below] {$x$};
  \draw [->] (0,-.5) -- ++(0,5) node[left] {$y$};
  \draw [thick,blue,domain=0:4] plot (\x,{.25*pow(\x,2)});
\end{tikzpicture}}
\end{animateinline}
\end{document}

enter image description here

  • Spectacular and incredible. It will be centuries before we understand your code. :-) To me it's just science fiction :-) I could never make one code himself. Of course you could enlarge the characters, reduce the speed, but I would never do it. That's an excellent answer for me. But couldn't you create a package with commands but simple one day? My best regards. – Sebastiano Apr 01 '20 at 20:51
  • 1
    @Sebastiano I added some explanations. BTW, making the nodes/formulae larger is as simple as saying nodes={scale=<factor>} in the options of the tikzpicture. –  Apr 01 '20 at 21:00
  • I have seen...but one day I must copy exactly your code :-(((....My humble advice is that if you make a package with simple explanations maybe one day I'll make one myself. But it's an Indiana Jones enterprise :-) for me....:)))) – Sebastiano Apr 01 '20 at 21:02
  • @Sebastiano I cannot write packages because I am not compatible with GitHub's philosophy (if there is any). –  Apr 01 '20 at 21:04
  • May I ask you a polite and cordial kindness? According to your creativity how would you understand with an animation that a summation is transformed with an integral one? I would only use the link to show all this to my students for distance learning. Always thanks. – Sebastiano Apr 01 '20 at 21:09
  • 3
    @Sebastiano You can use (for instance) the lower code of this answer and just replace the \foreach loop by the corresponding \multiframe. Please let me know if you have problems (but I will go out now for a while). –  Apr 01 '20 at 21:13
  • You've been exhaustive to the max and very helpful. – Sebastiano Apr 01 '20 at 21:25
  • @Sebastiano I added some integration illustration, this wasn't much efforts. –  Apr 01 '20 at 21:26
  • No no :-) always with animate formulas like before :((((( no with graphs. These aren't crazy days are crazy at best for me. – Sebastiano Apr 01 '20 at 21:27
  • 1
    @Schrödinger'scat Nice work! BTW, I fell in love with the SVG format lately and made animate support it (Kudos to M. Gieseking who develops dvisvgm!). So it doesn't depend on A-Reader anymore, and animations can be watched in a Web browser (Chrome and its relatives are stunningly performant, much better than AR) on many platforms. – AlexG Apr 02 '20 at 09:04
  • @AlexG Thanks for letting me know! Yes, maybe this is the way to go in the future. Where can one read about it? (TikZ also has an animations library that allows one to create animated svgs.) –  Apr 02 '20 at 14:58
  • 1
    @Schrödinger'scat Yes and both kinds of SVG animations do nicely coexist. Currently I am working on a package that facilitates embedding video and audio files into SVG. When ready, I will update https://tex.stackexchange.com/q/429 and https://tex.stackexchange.com/q/235139 – AlexG Apr 02 '20 at 15:24