TikZ/PGF 覚書(10) 手書き風描画繰返模様 [TikZ/PGF]
一週間を空けて?の投稿。
なかなか落ち着いてコード書けないな。
やっぱり今年の二月三月は特別だったなあ。
さて、TikZ/PGFの問題点が次々と明らかになります。
パスを組み合わせる事がよく判らない。
できるのだろうか。
例えば,両端が開いたパスを3つ用意して,
三角に組み合わせて閉じたパスを作りたい。
それぞれのパスは例えば
(0,0)から(1,0)へ向けて定義して,
そのパスをrotateしたり,逆順にしたり,shiftしたりして繋げて,
閉じたPathを作りたい。
なんかできそうになりので不細工なコードに。
\begin{tikzpicture}[scale=2,pencildraw/.style={decorate,decoration={random steps,segment length=4pt,amplitude=0.6pt}}] % Unit Tile Drawing \def\drawBox[#1](#2){ \begin{scope}[line width=2 pt]%,nearly transparent,cap=round] \pgfmathsetmacro{\sixh}{sin(60)} \draw [pencildraw,fill=#2,rotate=#1*60] (0,0) to[out=20,in=220] (1,0) to[out=135,in=315] (1/2,\sixh) to[out=280,in=110] (0,0); \fill [fill=white,rotate=#1*60] (0.7,0.2) circle (3pt); \fill [fill=white,rotate=#1*60] (0.6,0.5) circle (3pt); \draw [pencildraw,rotate=#1*60] (0.7,0.2) circle (3pt); \draw [pencildraw,rotate=#1*60] (0.6,0.5) circle (3pt); % \fill [pencildraw,fill=black] (-0.25,0.3) circle (1pt); \end{scope} } % Repeat Tiling \foreach \x in {-2,...,2}{\foreach \y in {-1,...,2}{ \pgfmathsetmacro{\xd}{3/2*\x}; \pgfmathsetmacro{\yd}{(2*\y+mod(abs(\x),2))*sin(60)}; \begin{scope}[shift={(\xd,\yd)}] \foreach \i in {0,...,5}{ \drawBox[\i](orange);} \end{scope}}} \end{tikzpicture}
コメント 0