Contest
add tag
samcarter
TopAnswers 1st birthday is coming up soon:

[![Screen Shot 2020-10-17 at 14.53.00.png](/image?hash=777029321177030ccfa174ed98efacb6ae9a166dee910723468bbb2372243eeb)](https://topanswers.xyz/transcript?room=1&id=77424#c77424)

The perfect opportunity for a contest! Let your creativity free reins on how to use TeX and friends to celebrate the birthday!

P.S. I'll be bringing cupcakes to the party :)

Top Answer
samcarter
I did some baking and here are the promised cupcakes:

```
\documentclass{standalone}

\usepackage{tikz}

\newif\ifcream
\newif\ifcandle
\newif\ifcherry
\newif\ificing

\tikzset{
  /cupcake/.search also={/tikz,/pgf},
  /cupcake/.cd,
  cake/.code         = \def\cakecol{#1},
  cake               = brown!70!black,
  paper/.code        = \def\papercol{#1},
  paper              = orange,
  cream/.code        = \creamtrue
                       \def\creamcol{#1},
  cream/.default     = white!80!brown,     
  candle/.code       = \candletrue
                       \def\candlecol{#1},
  candle/.default    = teal,      
  icing/.code        = \icingtrue
                       \def\icingcol{#1},
  icing/.default     = red!40!white,                     
  cherry/.code       = \cherrytrue , 
}

\newcommand*{\cupcake}[1][]{%
  \begin{scope}%
    \tikzset{/cupcake/.cd,#1}%
    %
    % cake
    \fill[\cakecol] (1.0966,-0.3858) .. controls (1.0966,-0.6255) and (0.8500,-0.5988) .. (0.5738,-0.5988) .. controls (0.2976,-0.5988) and (0.0283,-0.5972) .. (0.0283,-0.3575) .. controls (0.0283,-0.1177) and (0.2919,-0.0084) .. (0.5681,-0.0084) .. controls (0.8443,-0.0084) and (1.0966,-0.1461) .. (1.0966,-0.3858) -- cycle;
    %
    % paper
    \fill[\papercol] (0.1908,-1.1091) -- (0.2770,-1.1438) -- (0.3723,-1.1693) -- (0.4735,-1.1854) -- (0.5777,-1.1920) -- (0.6819,-1.1887) -- (0.7831,-1.1754) -- (0.8783,-1.1518) -- (0.9644,-1.1178) -- (1.0687,-0.4832) -- (0.9622,-0.5625) -- (0.8447,-0.5254) -- (0.7190,-0.5946) -- (0.5880,-0.5448) -- (0.4547,-0.5989) -- (0.3218,-0.5313) -- (0.1923,-0.5650) .. controls (0.1923,-0.5650) and (0.1088,-0.4882) .. (0.0691,-0.4745) -- cycle;
    \fill[\papercol!70!white] (0.9622,-0.5625) -- (0.8447,-0.5254) -- (0.7831,-1.1754) .. controls (0.8160,-1.1692) and (0.8479,-1.1614) .. (0.8783,-1.1518) -- cycle(0.7190,-0.5946) -- (0.5880,-0.5448) -- (0.5777,-1.1920) .. controls (0.6126,-1.1925) and (0.6475,-1.1914) .. (0.6819,-1.1887) -- cycle(0.0691,-0.4745) -- (0.1908,-1.1091) .. controls (0.2177,-1.1221) and (0.2466,-1.1337) .. (0.2770,-1.1438) -- (0.1923,-0.5650) .. controls (0.1923,-0.5650) and (0.1088,-0.4882) .. (0.0691,-0.4745) -- cycle(0.4547,-0.5989) -- (0.3218,-0.5313) -- (0.3723,-1.1693) .. controls (0.4052,-1.1762) and (0.4391,-1.1816) .. (0.4735,-1.1854) -- cycle;
    %
    % cream
    \ifcream
      \shade[bottom color=\creamcol!80!black, top color=\creamcol] (-0.0006,-0.2983) .. controls (0.0384,-0.0436) and (1.1885,0.0531) .. (1.1213,-0.2983) .. controls (1.0542,-0.6496) and (-0.0397,-0.5530) .. (-0.0006,-0.2983) -- cycle;
      \shade[bottom color=\creamcol!80!black, top color=\creamcol] (0.0544,-0.1310) .. controls (0.1155,0.0781) and (1.0505,0.2007) .. (1.0203,-0.1130) .. controls (0.9902,-0.4267) and (-0.0068,-0.3400) .. (0.0544,-0.1310) -- cycle;
      \shade[bottom color=\creamcol!80!black, top color=\creamcol] (0.6580,0.4040) .. controls (0.4945,0.4547) and (0.1504,0.2911) .. (0.2020,0.0980) .. controls (0.2536,-0.0951) and (0.7031,-0.1115) .. (0.8140,0.0260) .. controls (0.9250,0.1635) and (0.5095,0.1493) .. (0.6580,0.4040) -- cycle;
    \fi  
    % 
    % icing
    \ificing
      \fill[\icingcol] (1.0966,-0.3769) .. controls (1.0310,-0.5432) and (0.9599,-0.3729) .. (0.8991,-0.3806) .. controls (0.8510,-0.3922) and (0.7886,-0.4927) .. (0.7267,-0.4940) .. controls (0.6647,-0.4952) and (0.6258,-0.3859) .. (0.5568,-0.3859) .. controls (0.2284,-0.3456) and (0.3629,-0.4659) .. (0.3278,-0.4684) .. controls (0.2737,-0.4724) and (0.2856,-0.3966) .. (0.1767,-0.3797) .. controls (0.1323,-0.3728) and (0.0283,-0.4085) .. (0.0283,-0.3485) .. controls (0.0283,-0.1088) and (0.2919,0.0005) .. (0.5681,0.0005) .. controls (0.8443,0.0005) and (1.0966,-0.1372) .. (1.0966,-0.3769) -- cycle;
    \fi
    %
    % candle
    \ifcandle
      \fill[\candlecol] (0.5207,0.6088) -- (0.6171,0.6088) -- (0.6171,-0.0657) -- (0.5207,-0.0657) -- cycle;
      \fill[yellow!95!red] (0.5239,0.9460) .. controls (0.5752,0.9835) and (0.6833,0.8626) .. (0.6671,0.7199) .. controls (0.6509,0.5772) and (0.5097,0.5651) .. (0.4749,0.6667) .. controls (0.4400,0.7683) and (0.5705,0.7578) .. (0.5239,0.9460) -- cycle;
    \fi
    %
    % cherry
    \ifcherry
      \draw[green!50!black,line width=1pt] (0.4414,0.4723) .. controls (0.5894,0.3381) and (0.6294,0.2694) .. (0.5491,0.0812);
      \fill[red!80!black] (0.7701,0.1124) .. controls (0.7733,-0.0018) and (0.6800,-0.0945) .. (0.5689,-0.0945) .. controls (0.4578,-0.0945) and (0.3703,-0.0018) .. (0.3677,0.1124) .. controls (0.3627,0.3287) and (0.5042,0.2286) .. (0.5746,0.2286) .. controls (0.6744,0.2343) and (0.7644,0.3173) .. (0.7701,0.1124) -- cycle;
    \fi
  \end{scope}%
}

\begin{document}

\begin{tikzpicture}
\cupcake
\end{tikzpicture}

\begin{tikzpicture}
\cupcake[cake=brown,paper=teal]
\end{tikzpicture}

\begin{tikzpicture}
\cupcake[cream]
\end{tikzpicture}

\begin{tikzpicture}
\cupcake[paper=violet,candle=red!80!black]
\end{tikzpicture}

\begin{tikzpicture}
\cupcake[cherry,paper=blue!60!black]
\end{tikzpicture}

\begin{tikzpicture}
\cupcake[icing]
\end{tikzpicture}

\end{document}
```

![cupcake.png](/image?hash=d0e652160d99091973c426a2030c1c5e43db96bb5f7a41017509835318b16920)

(this code is also available as a small package at https://github.com/samcarter/tikzbits)
Answer #2
user 3.14159
Do not look at this before November 3, 2020.

```
\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikzlings}
\usetikzlibrary{shapes.geometric,calc,fpu,shapes.callouts,decorations.text}
\usetikzlibrary{decorations.pathmorphing}
\definecolor{honey1}{RGB}{244,255,89}
\definecolor{honey2}{RGB}{248,195,12}
\definecolor{darkhoney}{HTML}{E79100}
\usepgfmodule{nonlineartransformations} 
\newcommand{\PgfmathsetmacroFPU}[2]{\begingroup% https://tex.stackexchange.com/a/503835
\pgfkeys{/pgf/fpu,/pgf/fpu/output format=fixed}%
\pgfmathsetmacro{#1}{#2}%
\pgfmathsmuggle#1\endgroup}%
\makeatletter
\def\generictransformation{% similar to the pgfmanual section 103.4.2
\PgfmathsetmacroFPU{\myx}{xnlt(\pgf@x,\pgf@y)}%
\PgfmathsetmacroFPU{\myy}{ynlt(\pgf@x,\pgf@y)}%
\pgf@y=\myy pt%
\pgf@x=\myx pt%
} 
\makeatother
\tikzset{pics/.cd,
  A/.style={code={\draw[pic actions] 
  (0,-0.5) -- (0.3,0.4) -- (0.6,-0.5);
  \draw[pic actions](0.1,1/3-0.45) -- coordinate(-mid)
  (0.5,1/3-0.45);}},
  B/.style={code={\draw[pic actions] (0,-0.45) -- (0,0.45)
  to[out=0,in=0,looseness=2.5]  (0,0) coordinate(-mid)  
  -- (0.1,0)
  to[out=0,in=0,looseness=2.5] (0.1,-0.45) -- cycle;}},
  C/.style={code={\draw[pic actions]
   (0,0) to[out=90,in=110,looseness=2]  (0.5,0.25);
   \draw[pic actions](0,0) coordinate(-mid) to[out=-90,in=-110,looseness=2]  (0.5,-0.25);
   }},
  D/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45) 
   -- (0.1,0.45) to[out=0,in=0,looseness=1.5]
   (0.1,-0.45)--  cycle;
  }},
  E/.style={code={\draw[pic actions] 
  (0.5,-0.45) --(0,-0.45) -- (0,0.45)  -- (0.5,0.45);
  \draw[pic actions] (0,0) -- coordinate(-mid) (0.5,0);
  }},
  F/.style={code={\draw[pic actions] 
  (0,-0.45) -- (0,0.45)  -- (0.5,0.45);
  \draw[pic actions] (0,0) -- coordinate(-mid) (0.5,0);
  }},
  G/.style={code={\draw[pic actions]
   (0,0) to[out=90,in=110,looseness=2]  (0.5,0.25);
   \draw[pic actions] (0,0) coordinate(-mid) to[out=-90,in=-110,looseness=2]  
   (0.5,-0.25);
   \draw[pic actions] (0.54,-0.25) to (0.3,-0.25);}},
  H/.style={code={\draw[pic actions] 
  (0,-0.5) -- (0,0.5);  
  \draw[pic actions] (0.5,-0.5) -- (0.5,0.5);
  \draw[pic actions] (0,0) -- coordinate(-mid) (0.5,0);}},
  I/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45);}},
  J/.style={code={\draw[pic actions] 
  (0.2,0.45) -- coordinate[pos=0.5](-mid) (0.2,-0.35) to[out=-90,in=0]
  (0.1,-0.45) to[out=180,in=-90] (0,-0.35);}},
  K/.style={code={\draw[pic actions] 
  (0,-0.45) -- (0,0.45); 
  \draw[pic actions] (0.4,0.45) -- (0.02,0)coordinate(-mid) --  (0.4,-0.45);}},
  L/.style={code={\draw[pic actions] 
  (0,0.5) -- coordinate[pos=0.5](-mid) (0,-0.45) -- (0.4,-0.45);}},
  M/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45) -- 
  (0.3,0.25) -- (0.6,0.45) -- (0.6,-0.45);}},
  N/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45) -- (0.6,-0.4) --
  (0.6,0.45);}},
  O/.style={code={\draw[pic actions] (0.3,0)coordinate(-mid) circle(0.3 and 0.48);}},
  P/.style={code={\draw[pic actions] (0,-0.45) -- coordinate[pos=0.5](-mid)(0,0.45) 
  to[out=0,in=0,looseness=2.5]  (0,0);}},
  Q/.style={code={\draw[pic actions] 
  (0.3,0) coordinate[pos=0.5](-mid) circle(0.3 and 0.48);
  \draw[pic actions](0.35,-0.25) -- (0.6,-0.45);}},
  R/.style={code={\draw[pic actions] 
  (0,-0.45) -- coordinate[pos=0.5](-mid) (0,0.45) 
  to[out=0,in=0,looseness=2.5]  (0.05,0) -- (0.4,-0.45);}},
  S/.style={code={\draw[pic actions] (0.5,0.4)  
  to[out=160,in=165,looseness=2]  (0.3,0)  coordinate(-mid)
  to[out=-15,in=-20,looseness=2] (0.1,-0.4);}},
  T/.style={code={\draw[pic actions] (0.35,-0.45) -- coordinate[pos=0.5](-mid) (0.35,0.45) (0,0.45) -- (0.7,0.45);}},
  U/.style={code={\draw[pic actions] (0,0.5) -- (0,0)coordinate(-mid) to[out=-90,in=-90,looseness=2.5]
  (0.6,0) -- (0.6,0.5);}},
  V/.style={code={\draw[pic actions] (0,0.5) -- coordinate[pos=0.5](-mid) (0.3,-0.4) -- (0.6,0.5);}},
  W/.style={code={\draw[pic actions] (0,0.45) -- coordinate[pos=0.5](-mid) (0.3,-0.4) -- (0.45,-0.1)
  -- (0.6,-0.4) -- (0.9,0.45);}},
  X/.style={code={\draw[pic actions] 
  (0,0.45) -- coordinate[pos=0.5](-mid) (0.6,-0.45);
   \draw[pic actions] (0.6,0.45)
  -- (0,-0.45);}},
  Y/.style={code={\draw[pic actions] 
  (0,0.45) -- (0.3,0) coordinate(-mid);  
  \draw[pic actions] (0.6,0.45)
  -- (0,-0.45);}},
  Z/.style={code={\draw[pic actions] (0,0.45) --(0.6,0.45) 
  -- coordinate[pos=0.5](-mid) (0,-0.45)  
  -- (0.6,-0.45);}},
  space/.style={code={\path (0,0) (0.2,0);}},
  a/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  	\draw[pic actions] (0.4,-0.5) -- (0.4,0) coordinate(-mid);}},
  b/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  	\draw[pic actions] (0,-0.5) -- coordinate[pos=0.5](-mid)(0,0.5);}},
  c/.style={code={\draw[pic actions] (0.2,-0.25)+ (40:0.2 and 0.25) arc[start angle=40,
  	end angle=320,x radius=0.2,y radius=0.25];
	\path (0.2,0) coordinate(-mid);}},
  d/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  	\draw[pic actions] (0.4,-0.5) -- coordinate[pos=0.5](-mid)(0.4,0.5);}},
  e/.style={code={\draw[pic actions] (0,-0.25) -- (0.4,-0.25) arc[start angle=0,
  	end angle=320,x radius=0.2,y radius=0.25];
	\path (0.2,0) coordinate(-mid);}},
  f/.style={code={\draw[pic actions] (0.2,-0.5)
  -- (0.2,0.3) arc[start angle=180,end angle=0,radius=0.15];
  \draw[pic actions] (0,0) -- (0.4,0) coordinate[pos=0.5](-mid);}},
  g/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  	\draw[pic actions] (0.4,0) coordinate(-mid)-- (0.4,-0.6)
	arc[start angle=0,end angle=-140,radius=0.2];}},
  h/.style={code={\draw[pic actions] (0,-0.5)--(0,0.4);
  	\draw[pic actions] (0,-0.2) arc[start angle=180,end angle=0,radius=0.2]
	 coordinate[pos=0.5](-mid)-- (0.4,-0.5);}},
  i/.style={code={\draw[pic actions] (0,-0.5) -- (0,0.1)coordinate(-mid); 
  \fill (0,0.25) circle[radius=0.05];}},
  j/.style={code={\draw[pic actions] (0,-0.6) arc[start angle=180,end angle=360,
  radius=0.1] -- (0.2,0.1)coordinate(-mid); 
  \fill (0.2,0.25) circle[radius=0.05];}},
  k/.style={code={\draw[pic actions] (0,-0.5) -- (0,0.4);
  \draw[pic actions](0.2,-0.5) -- (0,-0.05)coordinate(-mid) -- (0.2,0.4);}},
  l/.style={code={\draw[pic actions] (0,-0.5) -- coordinate[pos=0.5](-mid) (0,0.4);}},
  m/.style={code={\draw[pic actions] (0,-0.5) -- (0,0) coordinate(-mid);
   \draw[pic actions] (0,-0.2) arc[start angle=180,end angle=0,radius=0.2]
	 -- (0.4,-0.5);
	 \draw[pic actions] (0.4,-0.2) arc[start angle=180,end angle=0,radius=0.2] -- (0.8,-0.5);}},
  n/.style={code={\draw[pic actions] (0,-0.5) -- (0,0) coordinate(-mid);
   \draw[pic actions] (0,-0.2) arc[start angle=180,end angle=0,radius=0.2]
	 -- (0.4,-0.5);}},
  o/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  \path (0,0) coordinate(-mid);}},
  p/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  \draw[pic actions] (0,0) coordinate(-mid) -- (0,-0.8);}},
  q/.style={code={\draw[pic actions] (0.2,-0.25) circle[x radius=0.2,y radius=0.25];
  \draw[pic actions] (0.4,0) coordinate(-mid) -- (0.4,-0.8);}},
  r/.style={code={\draw[pic actions] (0,-0.5) -- (0,0)coordinate(-mid);
  \draw (0,-0.1) arc[start angle=140,end angle=40,radius=0.2]; }},
  s/.style={code={\draw[pic actions] (0,-0.5) -- (0.2,-0.5)
  arc[start angle=-90,end angle=45,radius=0.125] 
  -- ++ (135:0.2) coordinate[pos=0.5](-mid)
  arc[start angle=225,end angle=90,radius=0.125] -- ++ (0.1,0) ;}},
  t/.style={code={\draw[pic actions] (0.2,-0.5) -- (0.2,0.3);
  \draw[pic actions] (0,0) -- (0.4,0) coordinate[pos=0.5](-mid);}},
  u/.style={code={\draw[pic actions] (0.4,-0.5) -- (0.4,0) coordinate(-mid);
   \draw[pic actions] (0,0) -- (0,-0.3) arc[start angle=180,end angle=360,radius=0.2];}},
  v/.style={code={\draw[pic actions] (0,0) coordinate(-mid) 
  -- (0.25,-0.5) -- (0.5,0); }},
  w/.style={code={\draw[pic actions] (0,0) coordinate(-mid) 
  -- (0.2,-0.5) -- (0.3,-0.3) -- (0.4,-0.5) -- (0.6,0);}},
  x/.style={code={\draw[pic actions] (0,0) coordinate(-mid) -- (0.4,-0.5);
  \draw[pic actions] (0,-0.5) -- (0.4,0); }},
  y/.style={code={\draw[pic actions] (0,0) coordinate(-mid)  -- (0.25,-0.5);
   \draw[pic actions] (0.5,0) -- (0.125,-0.75);}},
  z/.style={code={\draw[pic actions] (0,0) coordinate(-mid) -- (0.3,0) -- (0,-0.5) -- (0.3,-0.5);}},
}
\begin{document}
\foreach \X in {0}% {-10,...,10}
{\begin{tikzpicture}[radii/.style={x radius=3*##1,y radius=##1},
	radii/.default=29pt]
 \path[bottom color=blue!30,top color=blue,middle color=blue!10]
  (-4,-2.5) rectangle (4,9);
 \path[left color=honey1,right color=darkhoney,middle color=honey2]
  (-87pt,-1) arc[start angle=180,end angle=360,radii] 
  -- (87pt,4)   arc[start angle=0,end angle=-180,radii]   -- cycle;
 \begin{scope}
  \clip (-87pt,-1) arc[start angle=180,end angle=360,radii]  -- (87pt,4cm) 
   arc[start angle=0,end angle=-180,radii]  -- cycle;
  \begin{scope}[transform shape nonlinear=true,
 	 nodes={transform shape nonlinear=true},
	 declare function={xnlt(\x,\y)=ifthenelse(\x<-90,\x,%
			 ifthenelse(\x>90,\x,sin(\x)*90));
		 ynlt(\x,\y)=ifthenelse(\x<-90,\y,%
			 ifthenelse(\x>90,\y,\y-30*cos(\x)));}%
	 ]
   \pgftransformnonlinear{\generictransformation}
   \path[ultra thick] (-1.5,3.35) pic{H}
    ++ (0.6,0) pic{A} ++ (0.65,0) pic{P} ++ (0.5,0) pic{P} ++ (0.5,0) pic{Y};
   \path[ultra thick] (-2.35,2.1) pic{B}
    ++ (0.65,0) pic{I} ++ (0.2,0) pic{R} ++ (0.45,0) 
	pic{T} ++ (0.8,0) pic{H} ++ (0.7,0) pic{D} ++ (0.65,0) pic{A} 
	++ (0.7,0) pic{Y};
   \koala[yshift=-1cm,xshift=-1.5cm+\X*2mm]
   \penguin[yshift=-1cm,xshift=1mm+\X*2mm]
   \squirrel[yshift=-1cm,xshift=1.5cm+\X*2mm]
  \end{scope}
 \end{scope}
 \path[fill=white,decoration={random steps,segment length=1.5pt,amplitude=1pt}] 
  (-87pt,5cm)  -- (-87pt,4cm) 
  arc[start angle=-180,end angle=0,x radius=87pt,y radius=29pt]
  -- (87pt,5cm)
  decorate {arc[start angle=0,end angle=180,x radius=87pt,y radius=29pt] }
  -- cycle;
 \path[left color=red!80,right color=red,middle color=red!70] 
 (-0.6,5) arc[start angle=180,end angle=360,x radius=0.6,y radius=0.2]
 -- (0.6,7) 
 arc[start angle=0,end angle=180,x radius=0.6,y radius=0.2] -- cycle;
 \path[fill=white,decoration={random steps,segment length=1.5pt,amplitude=1pt}] 
  (-0.6,4.9)
  arc[start angle=180,end angle=360,x radius=0.6,y radius=0.2]
  -- (0.6,5.1)
  decorate {arc[start angle=0,end angle=-180,x radius=0.6,y radius=0.2]}
  -- cycle;
 \begin{scope} 
  \clip (0.6,7) 
 arc[start angle=0,end angle=-180,x radius=0.6,y radius=0.2]
  -- ++ (0,1) -| cycle;
  \path[outer color=red,inner color=red!20]
   (0.6,7) arc[start angle=0,end angle=180,x radius=0.6,y radius=0.2]
   -- ++ (0,-1) -| cycle;
  \draw[line width=0.8mm,line cap=round] (0,6.7) to[bend left=10] (0,7.2);
 \end{scope}
 % from https://tex.stackexchange.com/a/147357
 \path[shift={(0,7.2)},outer color=orange,inner color=yellow,opacity=0.8] 
   (0,0) 
   arc (270:180:3/8) 
   .. controls ++(0,1/4) and ++(0,-1/4) .. (0,3/2)
   arc (90:0:3/8 and 1) arc (360:270:3/8 and 1/2); 
\end{tikzpicture}}
\end{document}
```
![Screen Shot 2020-10-17 at 7.58.40 PM.png](/image?hash=5af7fceed3b07cd02562c8c2ee39c0b5e1461b15e7da507d05ae669086bc1a5b)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.