tikz で画像を反転および回転する

tikz で画像を反転および回転する

次のような問題があります。この Web ページのフリーズをエミュレートしたいと思います。\url{https://maa.org/sites/default/files/images/upload_library/4/vol1/architecture/Math/seven.html}

F6 と F7 の画像で止まってしまいます。

F6 の場合、次のコードを試しました。

\begin{figure}
\centering
\begin{tikzpicture}[decoration={footprints, foot length=40pt, foot of=gnome}]
\foreach \x in {1,3,...,9}
\draw [decorate] (\x,0) -- (\x+1,0);
\end{tikzpicture}
\begin{tikzpicture}
[xshift=-1 cm, yshift=-1 cm, rotate=180, decoration={footprints, foot length=40pt, foot of=gnome}]
\foreach \x in {1,3,...,9}
\fill [decorate] (\x+1,0) -- (\x,0);
\end{tikzpicture}
\end{figure}

誰か助けてくれませんか?

答え1

\pgf@lib@foot@of@gnome以下の回答では、TikZ ライブラリのマクロを使用していますdecorations.footprints

4 つの引数を取るコマンド\footstepが定義されています。最初の 2 つの引数は と を決定しますxscaleyscale最後の 2 つの引数は位置を決定します。

ここに画像の説明を入力してください

\documentclass[border=6pt]{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.footprints}
\makeatletter
\newcommand{\footstep}[4]{
  \begin{scope}[
    shift={(#3*1.2pt,#4*1.2pt)},
    xscale=#1,
    yscale=#2,
    shift={(-0.5pt,-0.5pt)}
  ]
    \pgf@lib@foot@of@gnome
    \pgfusepath{fill}
  \end{scope}
}
\makeatother
\begin{document}
\begin{tabular}{c}
\begin{tikzpicture}[scale=10]
\foreach\x in {1,2,3,4}{
  \footstep{1}{1}{\x}{0}
  \footstep{1}{-1}{\x}{-1}
}
\end{tikzpicture}\\\hline
\begin{tikzpicture}[scale=10]
\foreach\x in {1,3,5}{
  \footstep{1}{1}{\x}{0}
  \footstep{1}{-1}{\x}{-1}
}
\foreach\x in {2,4,6}{
  \footstep{-1}{1}{\x}{0}
  \footstep{-1}{-1}{\x}{-1}
}
\end{tikzpicture}
\end{tabular}
\end{document}

関連情報