是否可以增加线从起点到终点的宽度?

是否可以增加线从起点到终点的宽度?

我想知道是否可以让线的宽度从起点到终点动态增加。我在一本书中找到了这样的插图: 在此处输入图片描述

我是一个 TikZ 新手,但我想到的起点如下:

\documentclass{standalone}
\usepackage{xcolor}
\definecolor{darkred}{cmyk}{0,.81,.75,.37}
\usepackage{tikz}
\usetikzlibrary{arrows}

\begin{document}
\begin{tikzpicture}
\coordinate (S) at (1,1);
\coordinate (E) at (5,1);

\draw [darkred,dashed,bend angle=30,bend left,->,>=triangle 45,line width=1.5pt] (S) to (E);

\end{tikzpicture}
\end{document}

得出以下结果: 在此处输入图片描述

有人知道是否有可能达到预期的结果吗?

答案1

有人可以让它更漂亮,但装饰和标记库

在此处输入图片描述

\documentclass{article}
\usepackage{xcolor}
\definecolor{darkred}{cmyk}{0,.81,.75,.37}
\usepackage{tikz}
\usetikzlibrary{arrows,decorations,decorations.markings}
\newdimen\zzlen
\zzlen=.6pt
\begin{document}
\begin{tikzpicture}[decoration={markings,
      mark=between positions 0 and .85step 9pt
         with { \node [fill=red, 
                              ,transform shape] {%
\textcolor{red}{\rule{.5pt}{%
  \pgfkeysvalueof{/pgf/decoration/mark info/sequence number}\zzlen}}};}}]
\coordinate (S) at (1,1);
\coordinate (E) at (5,1);

\draw [white,bend angle=30,bend left,-{>[red]},>=triangle 45,
line width=3pt,postaction={decorate}]
(S)to (E);



\end{tikzpicture}

\end{document}

答案2

这是一个与之兼容的简单构造dash pattern

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing}

\begin{document}

\tikzset{
    fan/.style={
        decorate,
        decoration={
            show path construction,
            curveto code={
                \foreach\i in{1,...,50}{
                    \draw[dash pattern=on1off2on2off2on4off2on8off2on3off2on2off2]
                         [shift={(\tikzinputsegmentfirst)}][scale=-1][rotate=\i/10]
                         [shift={(\tikzinputsegmentfirst)}][scale=-1]
                         (\tikzinputsegmentfirst)..controls(\tikzinputsegmentsupporta)
                              and(\tikzinputsegmentsupportb)..(\tikzinputsegmentlast);
                }
            }
        }
    }
}

\begin{tikzpicture}
    \coordinate (S) at (1,1);
    \coordinate (E) at (5,1);
    \draw[bend angle=30,bend left,fan](S)to(E);
\end{tikzpicture}

\end{document}

相关内容