如果您知道直线部分的长度,您可以执行以下操作:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations,decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\draw[decorate,
decoration={snake,amplitude=1.5pt,segment length=8pt,post length=1cm}]
(0,0) to (2,0);
\end{tikzpicture}
\end{document}