我一直在想办法让重叠的圆沿着一条封闭曲线的路径。我发现,如果我使用贝塞尔曲线命令,那么我几乎可以得到我想要的东西,但用它构造曲线非常困难(至少对我来说)。使用下面的代码,它似乎根本不起作用;我只得到了代码下面的图片。有没有办法让重叠的圆覆盖这条封闭曲线(有点像这) 通过修改下面的代码(而不是使用controls
曲线命令)?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{hobby}
\begin{document}
\begin{tikzpicture}
\draw[line width=0.05cm] (6,6) to [closed, curve through = {(4.2,6) (0,4) (-4,4) (-6,0) (-4.2,-5.2)
(-1.5,-5.2) (3,-4)}] (5,-2) foreach \t in {0,0.1,0.2,...,1} {pic [pos=\t] {code={\draw[line width=0.02cm,blue]
circle [radius=1cm];}}};
\end{tikzpicture}
\end{document}
答案1
和decorations.markings
图书馆一起。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{
decorations.markings,%<-- added
hobby,
}
\begin{document}
\begin{tikzpicture}
\draw[
postaction=decorate,
decoration={
name=markings,
mark=between positions 0. and 1. step .1 with {\draw[line width=0.02cm,blue] circle [radius=1cm]; }
}
](6,6) to [closed, curve through = {%
(4.2,6) (0,4) (-4,4) (-6,0) (-4.2,-5.2)(-1.5,-5.2) (3,-4)}] (5,-2);
\end{tikzpicture}
\end{document}