Last active
November 26, 2016 11:24
-
-
Save rinx/6f068182cf345e511c28cf5366020af4 to your computer and use it in GitHub Desktop.
animation sample of beamer with TikZ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[ignorenonframetext,svgnames,14pt]{beamer} | |
\usepackage{amssymb,amsmath} | |
\usepackage{ifxetex,ifluatex} | |
\usepackage{fixltx2e} % provides \textsubscript | |
\ifxetex | |
\usepackage{fontspec,xltxtra,xunicode} | |
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} | |
\else | |
\ifluatex | |
\usepackage{fontspec} | |
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} | |
\else | |
\usepackage[utf8]{inputenc} | |
\fi | |
\fi | |
\usepackage{tikz} | |
\usepackage{tikzscale} | |
\usetikzlibrary{calc} | |
\usetikzlibrary{shapes} | |
\usetikzlibrary{spy} | |
\usetikzlibrary{positioning} | |
\usetikzlibrary{arrows.meta} | |
\usepackage{graphicx} | |
\usepackage{tcolorbox} | |
\usepackage{ragged2e} | |
\usepackage{animate} | |
\newcount\myFrameIndex | |
\newcount\anmTotalFrame | |
\anmTotalFrame=130 | |
\mode<handout>{\anmTotalFrame=1} | |
\definecolor{CinderellaA}{HTML}{A3B8FB} | |
\definecolor{CinderellaB}{HTML}{5978D5} | |
\definecolor{CinderellaC}{HTML}{98DEEA} | |
\definecolor{CinderellaD}{HTML}{EDBECE} | |
\definecolor{CinderellaE}{HTML}{F7CA65} | |
\begin{document} | |
\begin{frame} | |
\animate<1-\anmTotalFrame> | |
\animatevalue<1-\anmTotalFrame>\myFrameIndex{1}{\anmTotalFrame} | |
\pgfmathsetmacro\myA{80/\anmTotalFrame} | |
\pgfmathsetmacro\nowA{\myA * \myFrameIndex - 80} | |
\pgfmathsetmacro\shtA{-70 - 200/\anmTotalFrame * \myFrameIndex} | |
\pgfmathsetmacro\lngA{-150 - 120/\anmTotalFrame * \myFrameIndex} | |
\pgfmathsetmacro\tmpA{\nowA -90} | |
\pgfmathsetmacro\tmpB{\nowA -60} | |
\pgfmathsetmacro\tmpC{\nowA -30} | |
\pgfmathsetmacro\tmpD{\nowA + 0} | |
\pgfmathsetmacro\tmpE{\nowA +30} | |
\pgfmathsetmacro\tmpF{\nowA +60} | |
\pgfmathsetmacro\tmpG{\nowA +90} | |
\pgfmathsetmacro\tmpH{\nowA +120} | |
\pgfmathsetmacro\tmpI{\nowA +150} | |
\pgfmathsetmacro\tmpJ{\nowA +180} | |
\pgfmathsetmacro\tmpK{\nowA +210} | |
\pgfmathsetmacro\tmpL{\nowA +240} | |
\pgfmathsetmacro\cicA{200 + 360/\anmTotalFrame * \myFrameIndex} | |
\pgfmathsetmacro\colFrac{100} | |
% \pgfmathsetmacro\colFrac{100 / \anmTotalFrame * \myFrameIndex} | |
\justifying | |
\vbox{} | |
\vfill | |
{\rm | |
\begin{center}\begin{tikzpicture} | |
\shade[left color=CinderellaC,right color=CinderellaE] (0,0) circle [radius=5]; | |
\draw[fill=white,draw=none] (0,0) circle [radius=4.90]; | |
\shade[left color=CinderellaC,right color=CinderellaD, shading angle=\cicA] (0,0) circle [radius=3]; | |
\draw[fill=white,draw=none] (0,0) circle [radius=2.95]; | |
\node (O) at (0,0) {}; | |
\path (O) ++ (0:2.5) node[CinderellaA,scale=2.5] {\LARGE\bfseries 3}; | |
\path (O) ++ (30:2.7) node[CinderellaB,scale=2.5] {\large\bfseries 2}; | |
\path (O) ++ (60:2.5) node[CinderellaA,scale=2.5] {\LARGE\bfseries 1}; | |
\path (O) ++ (90:2.7) node[CinderellaB,scale=2.5] {\large\bfseries 1\!2}; | |
\path (O) ++ (120:2.5) node[CinderellaA,scale=2.5] {\LARGE\bfseries 1\!1}; | |
\path (O) ++ (150:2.7) node[CinderellaB,scale=2.5] {\large\bfseries 1\!0}; | |
\path (O) ++ (180:2.5) node[CinderellaA,scale=2.5] {\LARGE\bfseries 9}; | |
\path (O) ++ (210:2.7) node[CinderellaB,scale=2.5] {\large\bfseries 8}; | |
\path (O) ++ (240:2.5) node[CinderellaA,scale=2.5] {\LARGE\bfseries 7}; | |
\path (O) ++ (270:2.7) node[CinderellaB,scale=2.5] {\large\bfseries 6}; | |
\path (O) ++ (300:2.5) node[CinderellaA,scale=2.5] {\LARGE\bfseries 5}; | |
\path (O) ++ (330:2.7) node[CinderellaB,scale=2.5] {\large\bfseries 4}; | |
\path (O) ++ (\nowA + 0:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpA}{\Large I\!I\!I}}; | |
\path (O) ++ (\nowA +30:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpB}{\Large I\!I}}; | |
\path (O) ++ (\nowA +60:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpC}{\Large I}}; | |
\path (O) ++ (\nowA +90:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpD}{\Large X\!I\!I}}; | |
\path (O) ++ (\nowA +120:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpE}{\Large X\!I}}; | |
\path (O) ++ (\nowA +150:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpF}{\Large X}}; | |
\path (O) ++ (\nowA +180:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpG}{\Large I\!X}}; | |
\path (O) ++ (\nowA +210:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpH}{\Large V\!I\!I\!I}}; | |
\path (O) ++ (\nowA +240:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpI}{\Large V\!I\!I}}; | |
\path (O) ++ (\nowA +270:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpJ}{\Large V\!I}}; | |
\path (O) ++ (\nowA +300:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpK}{\Large V}}; | |
\path (O) ++ (\nowA +330:4) node[CinderellaA,scale=1.7] {\rotatebox{\tmpL}{\Large I\!V}}; | |
\draw[draw=CinderellaE, fill=CinderellaE] (O) circle [radius=0.3]; | |
\draw[-{Triangle[length=25pt, width=12pt]}, line width=5pt, draw=CinderellaE, fill=CinderellaE] (O) -- ++ (\shtA:4); | |
\draw[-{Kite[length=45pt, width=22pt]}, line width=5pt, draw=CinderellaE, fill=CinderellaE] (O) -- ++ (\lngA:3); | |
\end{tikzpicture}\end{center} | |
} | |
\end{frame} | |
\end{document} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment