I'm trying to create an interactive diagram, much like the one used in the EPUBs sold by Go Books:
What I mean by "interactive" is that the user controls when things are triggered. For example, animations are not what I would call interactivity because they happen regardless of what the user does. (Of course, in-between each move, we could have an animation.)
I quite frankly don't know if that's even possible with TikZ. Is it? Maybe there's a way of injecting HTML and JS into TikZ?
Here's a minimal example of a Go board with 3 moves, the idea would be to have TikZ add some sort of UI for going back and forth, and then showing each move accordingly — no need for the play button —:
\documentclass{article}
\usepackage{tikz}
\newlength{\step}
\begin{document}
\begin{tikzpicture}
\setlength{\step}{\dimexpr 10cm / 18 \relax}
\draw[step=\step] (0, 0) grid (10, 10);
\draw[draw = white, fill = black, line width = 0.1mm]
(2 * 10cm / 18, 3 * 10cm / 18)
circle [radius = 0.2575cm]
node[color = white] {1};
\draw[draw = black, fill = white, line width = 0.1mm]
(3 * 10cm / 18, 3 * 10cm / 18)
circle [radius = 0.2575cm]
node[color = black] {2};
\draw[draw = white, fill = black, line width = 0.1mm]
(4 * 10cm / 18, 3 * 10cm / 18)
circle [radius = 0.2575cm]
node[color = white] {3};
\end{tikzpicture}
\end{document}
Best Answer
Here is an example using
animateinline
from packageanimate
. It is working in Adobe Reader, and Foxit Reader (it doesn't seem to work on VS Code's PDF Viewer):And this animation is controlled by this: