Skip to content

Instantly share code, notes, and snippets.

@zr-tex8r
Created October 17, 2020 04:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zr-tex8r/44cc60c30cc979ac844896efe664c390 to your computer and use it in GitHub Desktop.
Save zr-tex8r/44cc60c30cc979ac844896efe664c390 to your computer and use it in GitHub Desktop.
LaTeX:TeXでつくる「雪降りナントカ」
% tcspingif -e pdflatex -t 32 -b 0.75 snowingsnowman.tex
\documentclass[margin=0pt]{standalone}
\usepackage[svgnames]{xcolor}
\usepackage{tikz,pgfmath,scsnowman}
\newcommand*{\cLet}{\pgfmathsetmacro}
%
\cLet{\vES}{40}
\cLet{\xE}{160}\cLet{\yE}{160}
%
\cLet{\vT}{\number\faStopTicks/\number\faAllTicks}
\begin{document}
\begin{tikzpicture}[x=1bp,y=1bp]
\useasboundingbox (0,0) rectangle (320,320);
\fill[cyan!4] (0,0) rectangle (320,320);
% snow
\cLet{\vEN}{1.8ex*\vES}
\cLet{\xO}{\xE-\vEN/2}\cLet{\yO}{\yE-\vEN/2}
\foreach \vU in {0, 1}
\foreach \xSN/\ySN in {
0.07/0.28, 0.13/0.55, 0.08/0.68, 0.23/0.76,
0.42/0.89, 0.74/0.89, 0.88/0.73, 0.92/0.53,
0.94/0.23,
0.32/0.06, 0.09/0.07, 0.93/0.07, 0.72/0.08,
0.56/0.15, 0.39/0.29, 0.61/0.38, 0.36/0.45,
0.50/0.57, 0.63/0.72
} {
\cLet{\ySNx}{\ySN+\vU-\vT}
\cLet{\xS}{\xO+\xSN*\vEN}\cLet{\yS}{\yO+\ySNx*\vEN}
\cLet{\vCR}{(\ySNx<0.5) ? (\ySNx-0.07)/0.15 : (
(1.05-\ySNx)/0.15)}
\cLet{\vCR}{max(0,min(1,\vCR))*100}
\draw[SkyBlue!\vCR, line width=0.014*\vEN]
(\xS,\yS) circle[radius=0.04*\vEN];
};
% essential one
\node at (\xE,\yE) {\scsnowman[scale=\vES,
body=white,hat=white]};
\node at (\xE,\yE) {\scsnowman[scale=\vES,
muffler=Red,hat=Green,buttons=RoyalBlue,arms=Brown]};
\end{tikzpicture}
\end{document}
@zr-tex8r
Copy link
Author

tcspingif を用いてGIF画像に変換する。

perl tcspingif.pl -e pdflatex -t 32 -b 0.75 snowingsnowman.tex

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