Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Created January 18, 2022 07:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zr-tex8r/b5cc0e8c3c14f7ab752b340ae47247dd to your computer and use it in GitHub Desktop.
Save zr-tex8r/b5cc0e8c3c14f7ab752b340ae47247dd to your computer and use it in GitHub Desktop.
LaTeX: Happy World Day of Snowman!
% tcspingif -e pdflatex -t 256 -i 20 --alternate
\documentclass{standalone}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\newcommand*{\cLobs}[1]{%
\fontfamily{Lbstr-LF}\fontsize{#1}{0}\selectfont}
\usepackage{xcolor}
\usepackage{tikz,pgfmath,scsnowman}
\colorlet{mybase}{green!70!blue}
\colorlet{mytext}{mybase!60!black}
\definecolor{myred}{rgb}{1.0,0.0,0.0}
\definecolor{myblue}{rgb}{0.0,0.0,1.0}
\definecolor{mybutton}{rgb}{0.1,0.6,0.2}
\definecolor{myarm}{rgb}{0.4,0.1,0.0}
\definecolor{mybroom}{rgb}{0.7,0.5,0.0}
\pagecolor{mybase!10}
\newcommand*{\cLet}{\pgfmathsetmacro}
\cLet{\vT}{\number\faStopTicks/\number\faAllTicks}
\cLet{\vSS}{11}
\newcommand*{\cSnowman}[1]{\makebox[0pt][l]{\scsnowman[scale=\vSS,
body=white, mouth=false]}%
\scsnowman[scale=\vSS, buttons=mybutton, arms=myarm, broom=mybroom,
hat=#1!75!black, muffler=#1]}
\begin{document}
\begin{tikzpicture}[x=1bp,y=1bp]
\useasboundingbox (-240,-135) rectangle (240,135);
\draw[mybase!50, line width=20bp]
(-240,-135) rectangle (240,135);
\draw[mybase!50, line width=20bp, rounded corners=36bp]
(-240,-135) rectangle (240,135);
\node[text=mytext, font={\cLobs{28}}]
at (0,72) {Happy World Day of Snowman!};
\node[text=mytext, font={\cLobs{18}}]
at (0,44) {January 18th};
%
\foreach \vN in {0,1,...,4} {%
\cLet{\vU}{(\vT-(0.2+0.15*\vN))/0.15}
\cLet{\vU}{(\vU<-1) ? (-1) : ((\vU>1) ? 1 : \vU)}
\cLet{\yA}{1-\vU*\vU}
\cLet{\vA}{(\vU<0) ? (-\vU) : \vU}\cLet{\vA}{pow(\vA,0.5)}
\cLet{\vA}{((\vU<0) ? (-\vA) : (\vA))*1}
%
\cLet{\xS}{80*(\vN-2)}\cLet{\yS}{-60+120*\yA}
\cLet{\vC}{100/4*\vN}\cLet{\vAA}{-360*mod(\vA,1)}
\node[rotate=\vAA] at (\xS,\yS) {\cSnowman{myblue!\vC!myred}};
}
\end{tikzpicture}
\end{document}
@zr-tex8r
Copy link
Author

Generate an animated GIF using tcspingif.

tcspingif -e pdflatex -t 256 -i 20 --alternate wdsnowman2022.tex

Result (on Twitter)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment