[Tex/LaTex] TiKZ: “hand-drawn” explosion

funtikz-pgftikz-shape

Is there an elegant way to simulate a handdrawn explosion as shown in the following image using tikz?

enter image description here

Best Answer

There's the starburst shape in the shapes.symbols library:

enter image description here

The code:

\documentclass[tikz,border=4pt]{standalone}
\usetikzlibrary{shapes.symbols}

\begin{document}

\begin{tikzpicture}

\node[starburst, draw, minimum width=3cm, minimum height=2cm,red,fill=orange,line width=1.5pt]
{BOOM!};
\end{tikzpicture}

\end{document}

Or a more colorful version:

enter image description here

\documentclass[tikz,border=4pt]{standalone}
\usetikzlibrary{shapes.symbols,decorations.text}
\usepackage{contour}
\usepackage{fontspec}

\setmainfont{Smartie CAPS}

\definecolor{color1}{RGB}{252,57,0}
\definecolor{color2}{RGB}{252,115,0}
\definecolor{color3}{RGB}{252,173,0}
\definecolor{color4}{RGB}{252,202,0}
\definecolor{color5}{RGB}{252,255,130}
\definecolor{contornoin}{RGB}{255,255,0}
\definecolor{contornoout}{RGB}{228,0,5}

\begin{document}

\contourlength{2pt}
\begin{tikzpicture}

\foreach \Escala [count=\xi] in {1,0.8,...,0.4}
\node[
  starburst,
  scale=\Escala,
  fill=color\xi, 
  minimum width=3cm, 
  minimum height=2cm,
  line width=1.5pt
  ]
  at (0,0) {};
\node[font=\Large] 
  at (0,0) 
  {\contour*{contornoin}{\textcolor{contornoout}{BANG!}}};

\end{tikzpicture}

\end{document}

Update

Where would the fun be without an animation?

enter image description here

The code:

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc,shapes.symbols,shapes.geometric}

\definecolor{color1}{RGB}{252,57,0}
\definecolor{color2}{RGB}{252,115,0}
\definecolor{color3}{RGB}{252,173,0}
\definecolor{color4}{RGB}{252,202,0}
\definecolor{color5}{RGB}{252,255,130}
\definecolor{contornoin}{RGB}{255,255,0}
\definecolor{contornoout}{RGB}{228,0,5}
\definecolor{dinamitadark}{RGB}{205,25,28}
\definecolor{dinamitalight}{RGB}{237,27,38}

\setbeamertemplate{navigation symbols}{}

 \tikzset{
  invisible/.style={opacity=0},
  visible on/.style={alt={#1{}{invisible}}},
  alt/.code args={<#1>#2#3}{%
    \alt<#1>{\pgfkeysalso{#2}}{\pgfkeysalso{#3}}
  },
}

\begin{document}

\begin{frame}
\centering
\begin{tikzpicture}[scale=2,transform shape]
\node[
  cylinder,
  draw=red!70!black, 
  minimum height=2cm, 
  minimum width=0.5cm,
  top color=dinamitadark,
  bottom color=dinamitalight!40,
  visible on=<1-12>
  ] (dynamite) {};
\coordinate[visible on=<1->] 
  (start) 
  at ( $ (dynamite.before top)!0.5!(dynamite.after top) $ );  
\draw[
  line width=0.8pt,
  double,
  overlay,
  visible on=<1-12>
  ]
  (start) -- ++ (30pt,0) coordinate (end);
\foreach \Valor in {0,1,2,...,12}
{
    \fill[white,visible on=<\Valor>]  
      ([yshift=10pt,xshift=1pt]end) 
        rectangle 
  ([yshift=-10pt] $ (end)!2pt*\Valor!(start) $ )
  ++(5pt,0) 
    node[
      outer sep=0pt,
      draw,
      fill=contornoin!90!black,
      starburst,
      overlay,
      scale=0.5,
      yshift=18.5pt,
      minimum size=6pt
      ] {}; 
}
\onslide<13-16>{
\foreach \Escala [count=\xi] in {1,0.8,...,0.4}
\node[
  starburst,
  scale=\Escala,
  fill=color\xi, 
  minimum width=3cm, 
  minimum height=2cm,
  line width=1.5pt,
  ]
  at (0,0) {};
\node[font=\Large] 
  at (0,0) 
  {BANG!};
}
\coordinate<15-18>;  
\end{tikzpicture}
\end{frame}

\end{document}

The animation was produced thriugh ImageMagick running in a terminal

convert -verbose -delay 12 -loop 0 -density 300 a.pdf a.gif
Related Question