[Tex/LaTex] TeX Art Fun – Mandalas

fun

I can't help but feel we need more fun coding contests here on TeX.SX, and since these seemed to do well in the past (e.g. TeX-mas, Groundhog Day) I thought I'd try my hand at putting together one of my own. Maybe it can even become a regular thing?

The Contest

Your mission, should you choose to accept it, is to create a mandala using nothing but TeX. The design is entirely up to you – any theme you like (if any), as simple or as complex as you like, and it can be coloured or monochrome. For examples of what I mean by mandala, click here.

Rules

  • Entry must be made using nothing but TeX and derived languages, packages, etc. No outside graphics (but things like tikzlings and tikzsymbols are fine).
  • Post both the image and your code, so we can see what you did.
  • You can enter as many times as you like.
  • Contest ends 11:59pm GMT, July 12th, 2019.
  • Winner is whichever valid entry receives the most upvotes by the end of the contest.
  • Have fun! 🙂

Prizes

  • Bragging rights.
  • Optional: You get to host the next TeX coding contest in this series.
  • Something else? Suggestions?

I look forward to seeing all your creative entries! 🙂

Winners

Congratulations to @Mark Wibrow for his very clever and beautiful mandala, which was the clear winner after receiving the most votes by far. You have received the bounty, as well as being selected as the chosen answer. If you like, you can also put together a fun contest of your own, or perhaps choose someone to take on the honour instead.

Thank you everyone who submitted an entry to this contest. I loved seeing all your creative and unique designs and clever code. For anyone who wanted to have a go at this but were unable to get an entry in in time, please feel free to submit one anyway, whenever you like. It'll just be for fun, not to win, but I'll always be keen to see what wonderful things you guys can come up with.

Happy coding!

Best Answer

One colossal fading...

\documentclass[tikz,border=5]{standalone}
\usetikzlibrary{fadings}
\begin{tikzfadingfrompicture}[name=mandela]
\tikzset{%
  filled/.style={%
    fill=pgftransparent,
    draw=pgftransparent!0,
  },
  line join=round,
  doubled/.style={
    double=pgftransparent,
    double distance=#1,
  }, 
  doubled/.default=1.5}
\foreach \i in {0,2,...,15}{
  \tikzset{shift=(360/16*\i:4)}
  \foreach \j in {0,...,19}
    \path[filled,doubled] (360/19*\j:1) circle [radius=1/6];
  \path [filled,doubled] circle [radius=1];
  \foreach \j in {0,...,23}
    \path[filled,doubled] (360/24*\j:6/8) circle [radius=1/16];
}
\foreach \i in {1,3,...,15}{
  \tikzset{shift=(360/16*\i:3), rotate=360/16*\i+90, scale=-1}
  \path [discard] (1,0) arc (315:450:1/2) arc (315:450:1/3) arc (315:360:1/4)
    coordinate (a);
  \path [filled, doubled] 
    (-1,0) arc (225:90:1/2) arc (225:90:1/3) arc (225:180:1/4)
    .. controls ++(90:1/4) and ++(260:1/4) ..(0,5/2) 
    .. controls ++(280:1/4) and ++(90:1/4) .. (a)
    arc (360:315:1/4) arc (450:315:1/3) arc(450:315:1/2);
  \foreach \j in {0,1,-1,2,-2,3,-3}
    \path [filled, doubled, shift=(270:1/3),rotate=90+10*\j]
      (0,0) .. controls ++(1/8,0) and ++(-1/8,0) .. ({1.5-abs(\j/3)},-1/8)
      arc (270:450:1/8) -- cycle;
}
\foreach \i in {0,1}{
  \foreach \j [evaluate={\k=360/8*(\i+\j);}] in {0,2,...,7}{
    \tikzset{shift=(\k:2), rotate=\k+90, scale=-1}
    \path [discard] (1,0) arc (315:450:1/2) arc (315:360:1/3)
      coordinate (a);
    \path [filled, doubled] 
      (-1,0) arc (225:90:1/2) arc (225:180:1/3)
      .. controls ++(90:1/4) and ++(260:1/4) ..(0,9/4) 
      .. controls ++(280:1/4) and ++(90:1/4) .. (a)
      arc (360:315:1/3) arc(450:315:1/2);
    \foreach \k in {0,1,-1}
      \path [filled, doubled, rotate=90+10*\k]
        (1/2,0) .. controls ++(1/8,0) and ++(-1/8,0) .. ({1.5-abs(\k/3)},-1/8)
         arc (270:450:1/8) -- cycle;
  }
}
\foreach \i in {0,2,...,15}{
  \tikzset{shift=(360/16*\i:2)}
  \foreach \j in {0,...,19}
    \path [filled,doubled] (360/19*\j:3/4) circle [radius=1/8];
  \path [filled,doubled] circle [radius=3/4];
  \path [filled,doubled] circle [radius=1/2];
  \path [filled,doubled] circle [radius=1/4];
}
\path [filled, doubled] circle [radius=9/4];
\foreach \i in {0,2,...,31}
  \path[filled,doubled] (360/32*\i:6/4) circle [radius=1/3];
\foreach \i in {0,1}{
 \foreach \j [evaluate={\k=360/16*(\i+\j);}] in {0,2,...,15}{
   \tikzset{shift=(\k:1), rotate=\k+90, scale=-1}
   \path [filled, doubled]
     (-1/4, 0) 
     .. controls ++(135:1/2) and ++(260:1/2) .. (0,7/8)
     .. controls ++(280:1/2) and ++(45:1/2)  .. (1/4,0);
  \path [filled, doubled]
    (0,0) .. controls ++(135:1/8) and ++(270:1/8) ..
    (-1/8,1/3) arc (180:0:1/8) .. controls ++(270:1/8) and ++(45:1/8) .. cycle;
  }
}
\path [filled, doubled] circle [radius=5/4];
\foreach \i in {0,1}
  \foreach \j in {0,1,...,11}
    \path [filled, doubled, rotate=90+30*\j+\i*15]
      (0,0) .. controls ++(1/8,0) and ++(-1/8,0) .. (7/8,-1/8)
       arc (270:450:1/8) -- cycle;     
\path [filled, doubled] circle [radius=3/4];
\foreach \i in {0,1}{
 \foreach \j [evaluate={\k=360/6*(\i+\j);}] in {0,2,...,5}{
   \tikzset{shift=(\k:1/4), rotate=\k+90, scale=-1}
   \path [filled, doubled]
     (-1/8, 0) 
     .. controls ++(135:1/8) and ++(250:1/8) .. (0,1/4)
     .. controls ++(290:1/8) and ++(45:1/8)  .. (1/8,0);
  }
}
\path [filled, doubled] circle [radius=1/4];
\end{tikzfadingfrompicture}
\pgfdeclareradialshading{mandela}{\pgfpointorigin}{%
  color(0cm)=(yellow);
  color(0.2cm)=(red);
  color(0.4cm)=(purple);
  color(0.6cm)=(blue);
  color(0.8cm)=(cyan);
  color(1cm)=(cyan)}
\begin{document}
\begin{tikzpicture}
\shade [shading=mandela, path fading=mandela, fit fading=false]
  (-6,-6) rectangle (6,6);
\end{tikzpicture}
\end{document}

enter image description here