Created
February 18, 2019 02:38
-
-
Save Symbol1/6e9c164612770eb9875e1dc01b7af88a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass[border=9,tikz]{standalone} | |
\usetikzlibrary{decorations.pathreplacing} | |
\begin{document} | |
\def\niterate{64} | |
\def\rolldice{ | |
\pgfmathsetmacro\rndlinewidth{6/(2+\i)} | |
\pgfmathsetmacro\rndon{8+8*rnd} | |
\pgfmathsetmacro\rndoff{2*rnd} | |
\pgfmathsetmacro\rndshift{sqrt((1-\rndlinewidth/2)*10*rnd)} | |
\pgfmathsetmacro\rndblend{50+\i*50*rand/\niterate} | |
} | |
\tikzset{ | |
put dashes/.style={ | |
/utils/exec=\rolldice, | |
line width=\rndlinewidth, | |
dash pattern=on \rndon off \rndoff, | |
dash phase=(\rndon+\rndoff)*rnd, | |
shift={(rnd*360:\rndshift pt)}, | |
line cap=round, | |
blue!\rndblend!green, | |
opacity=.6 | |
}, | |
brush/.style={ | |
decorate, | |
decoration={ | |
show path construction, | |
lineto code={ | |
\foreach\i in{1,...,\niterate}{ | |
\draw[put dashes] | |
(\tikzinputsegmentfirst)--(\tikzinputsegmentlast); | |
} | |
}, | |
curveto code={ | |
\foreach\i in{1,...,\niterate}{ | |
\draw[put dashes] | |
(\tikzinputsegmentfirst)..controls | |
(\tikzinputsegmentsupporta)and(\tikzinputsegmentsupportb) | |
..(\tikzinputsegmentlast); | |
} | |
}, | |
closepath code={ | |
\foreach\i in{1,...,\niterate}{ | |
\draw[put dashes] | |
(\tikzinputsegmentfirst)--(\tikzinputsegmentlast); | |
} | |
} | |
} | |
} | |
} | |
\tikz{ | |
\draw(0,0)rectangle(100pt,100pt); | |
\foreach\x in{2.5,7.5,...,99}{ | |
\xdef\ysofar{0} | |
\foreach\y in{1,...,10}{ | |
\ifdim \ysofar pt < 99pt | |
\pgfmathsetmacro\ystep{10+20*rnd} | |
\pgfmathsetmacro\ytarget{\ysofar+\ystep} | |
\ifdim \ytarget pt > 100pt | |
\pgfmathsetmacro\ytarget{100} | |
\fi | |
\draw[brush](\x pt,\ysofar pt)--(\x pt,\ytarget pt); | |
\xdef\ysofar{\ytarget} | |
\fi | |
} | |
} | |
} | |
\message{^^J^^J time = \the\numexpr\pdfelapsedtime*1000/65536 ms ^^J^^J} | |
\end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment