summaryrefslogtreecommitdiff
path: root/info/drawing-with-metapost/src/explode.mp
blob: 8d03d9484679519657a2cbbf360e85fb6e016a20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
\documentclass[border=5mm]{standalone}
\usepackage{luamplib}
\usepackage{fontspec}
\setmainfont{PlayfairDisplay-Black}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
input colorbrewer-rgb
randomseed:=2128.5073;
beginfig(1);
n = 40; r = 7 ; s = 44;
path explosion, splash;
explosion = for i=1 upto n:
  (s if odd(i): - else: + fi r + uniformdeviate r,0) rotated (i*360/n) --
endfor cycle; 

splash = for i=1 upto n:
  (s if odd(i): - else: + fi r + uniformdeviate r,0) rotated (i*360/n) ..
endfor cycle; 
splash := splash shifted (3s,0);

fill explosion withcolor Oranges 7 4;
draw explosion withpen pencircle scaled 2 withcolor Reds 7 7;
label(TEX("\textbf{BOOM!}") scaled 1.6, center explosion) withcolor Reds 7 7;

fill splash withcolor Blues 7 2;
draw splash withpen pencircle scaled 2 withcolor Blues 7 7;
label(TEX("\bfseries SPLAT!") scaled 1.6, center splash) withcolor Blues 7 7;
endfig;
\end{mplibcode}
\end{document}