5

I am trying to get a nice gradient, but mine's a litte choppy. Maybe you can help me out with that. For a bette idea:

enter image description here

(from top to bottom: luminosity, expansion speed, radius)

enter image description here


animation.tex

\documentclass[tikz]{standalone}
\usepackage{xcolor}

\begin{document}

\foreach \x in {60,62,...,100} %Color should change from white into a strong yellow
  {
    \begin{tikzpicture}[scale=.4]
        \pgfmathsetmacro\Radius{(\x-1)/41+3}
        \useasboundingbox[fill=black] (-10.2,-10.2) rectangle (10.2cm,10.2cm);
        \fill[fill=yellow!\x] (0,0) circle (\Radius); %Here in the first frame should be the brightest color (white) and then change into a strong yellow
    \end{tikzpicture}
  }
\foreach \x in {100,98,...,60} %Color should change from strong yellow into a strong orange
  {
    \begin{tikzpicture}[scale=.4]
        \pgfmathsetmacro\Radius{(\x-1)/41+3}
        \useasboundingbox[fill=black] (-10.2,-10.2) rectangle (10.2cm,10.2cm);
        \fill[fill=yellow!\x] (0,0) circle (\Radius);
    \end{tikzpicture}
  }
\foreach \x [count=\j] in {60,56,...,2} %Color should change into a light orange
  {
    \begin{tikzpicture}[scale=.4]
        \pgfmathsetmacro\Radius{(\x-1)/41+3}
        \useasboundingbox[fill=black] (-10.2,-10.2) rectangle (10.2cm,10.2cm);
        \fill[fill=yellow!\x!orange] (0,0) circle (\Radius);
    \end{tikzpicture}
  }
\foreach \x in {2,6,...,60} %Color should change into white
  {
    \begin{tikzpicture}[scale=.4]
        \pgfmathsetmacro\Radius{(\x-1)/41+3}
        \useasboundingbox[fill=black] (-10.2,-10.2) rectangle (10.2cm,10.2cm);
        \fill[fill=yellow!\x] (0,0) circle (\Radius);
    \end{tikzpicture}
  }
\end{document}

main.tex

\documentclass[tikz]{beamer}
\usepackage{animate}

\begin{document}
\begin{frame}[fragile]
\begin{center}
\animategraphics[controls,loop]{30}{animation}{}{}
\end{center}
\end{frame}
\end{document}
4

How about this? (I focus on the graphics, seeing you have found a nice way to include the animation in beamer.)

\documentclass[tikz]{standalone}
\usepackage{xcolor}

\begin{document}

\foreach \X in {0,2,...,358}
{\begin{tikzpicture}[scale=.4]
    \pgfmathsetmacro\Radius{4-2*cos(\X+30)}
    \useasboundingbox[fill=black] (-10.2,-10.2) rectangle (10.2cm,10.2cm);
    \ifnum\X<91
      \pgfmathtruncatemacro\OF{100*sin(\X)}
      \colorlet{mixyo}{yellow!\OF!white}
    \else
      \ifnum\X<271
         \pgfmathtruncatemacro\OF{50+50*sin(\X)}
         \colorlet{mixyo}{yellow!\OF!orange}
      \else
         \pgfmathtruncatemacro\OF{-100*sin(\X)}
         \colorlet{mixyo}{orange!\OF!white}
      \fi
    \fi
    \fill[fill=mixyo] (0,0) circle (\Radius); 
\end{tikzpicture}}
\end{document}

enter image description here

  • That's great! Exactly what I wanted! – Simba Mar 21 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.