Je cherche à créer une animation en plusieurs étapes et je pensais utiliser Voici mon code (qui ne compile pas : j'avoue avoir du mal avec les tests logiques et la gestion des nombres dans LaTeX...) \documentclass[french,11pt,a4paper]{article} \usepackage{tikz} \usepackage{animate} \usepackage{ifthen} \usepackage{siunitx} \begin{document} \begin{center} \begin{animateinline}[controls=all]{25} \multiframe{151}{rx=0+0.02}{% \ifthenelse{\rx<1}{% \begin{tikzpicture} \GrAide{0}{0}{5}{5} \draw[fill=blue] (1+\rx,1) circle (0.2cm); \draw[fill=red] (2,1) circle (0.2cm); \draw[fill=green] (3,1) circle (0.2cm); \end{tikzpicture} }{\ifthenelse{\rx<2}{% \begin{tikzpicture} \draw[fill=blue] (2,1) circle (0.2cm); \draw[fill=red] (2+\rx,1) circle (0.2cm); \draw[fill=green] (3,1) circle (0.2cm); \end{tikzpicture} }{% \begin{tikzpicture} \GrAide{0}{0}{5}{5} \draw[fill=blue] (2,1) circle (0.2cm); \draw[fill=red] (3,1) circle (0.2cm); \draw[fill=green] (3+\rx,1) circle (0.2cm); \end{tikzpicture} }} } \end{animateinline} \end{center} \end{document} Posée 05 Jan, 12:09 ablasz |
Voici une solution. Merci Cédric P. \documentclass{article} \usepackage{tikz} \usepackage{siunitx} \usepackage{animate} \usepackage{xintexpr} \begin{document} \begin{center} \begin{animateinline}[controls=all]{25} \multiframe{151}{rx=0+0.02}{% \xintifboolexpr{ \rx < 1}% {% \begin{tikzpicture} \draw[thin,lightgray] (0,0) grid (7,4) ; \draw[fill=blue] (1+\rx,1) circle (0.2cm); \draw[fill=red] (2,2) circle (0.2cm); \draw[fill=green] (3,3) circle (0.2cm); \end{tikzpicture} }% {}% \xintifboolexpr{ \rx >= 1 'and' \rx < 2}% {% \begin{tikzpicture} \draw[thin,lightgray] (0,0) grid (7,4) ; \draw[fill=blue] (2,1) circle (0.2cm); \draw[fill=red] (1+\rx,2) circle (0.2cm); \draw[fill=green] (3,3) circle (0.2cm); \end{tikzpicture} }% {}% \xintifboolexpr{ \rx >=2 }% {% \begin{tikzpicture} \draw[thin,lightgray] (0,0) grid (7,4) ; \draw[fill=blue] (2,1) circle (0.2cm); \draw[fill=red] (3,2) circle (0.2cm); \draw[fill=green] (1+\rx,3) circle (0.2cm); \end{tikzpicture} }% {}% }% \end{animateinline} \end{center} \end{document} Publiée 05 Jan, 21:31 ablasz |
Autre possibilité: plusieurs boucles de \documentclass[french,11pt,a4paper]{article} \usepackage{tikz} \usepackage{animate} \usepackage{siunitx} \begin{document} \begin{center} \begin{animateinline}[controls=all]{25} \multiframe{50}{rx=0+0.02}{% \begin{tikzpicture} \draw[thin,lightgray] (0,0) grid (7,4) ; \draw[fill=blue] (1+\rx,1) circle (0.2cm); \draw[fill=red] (2,2) circle (0.2cm); \draw[fill=green] (3,3) circle (0.2cm); \end{tikzpicture} } \newframe \multiframe{50}{rx=1+0.02}{% \begin{tikzpicture} \draw[thin,lightgray] (0,0) grid (7,4) ; \draw[fill=blue] (2,1) circle (0.2cm); \draw[fill=red] (1+\rx,2) circle (0.2cm); \draw[fill=green] (3,3) circle (0.2cm); \end{tikzpicture} } \newframe \multiframe{51}{rx=2+0.02}{% \begin{tikzpicture} \draw[thin,lightgray] (0,0) grid (7,4) ; \draw[fill=blue] (2,1) circle (0.2cm); \draw[fill=red] (3,2) circle (0.2cm); \draw[fill=green] (1+\rx,3) circle (0.2cm); \end{tikzpicture} } \end{animateinline} \end{center} \end{document} Publiée 08 Jan, 13:54 alexg |
Plutôt que de fermer la question parce qu'une solution trouvée, ne pourriez-vous pas plutôt partager cette solution ?