6

I'm trying to decorate a snake path, but I don't get any output using a postaction. Here's the example code.

\begin{tikzpicture}
  \draw [snake=expanding waves, segment amplitude = 1.5cm, segment length = 0.3 cm, postaction={decorate, decoration={random steps,segment length=3pt,amplitude=5pt}}] (0,0) -- (-2,0);
\end{tikzpicture}

Any help would be greatly appreciated.

Caramdir
  • 89,023
  • 26
  • 255
  • 291
Derek
  • 317
  • 1
  • 7

1 Answers1

5

The postaction is newer drawn. You need to add a draw option to it. On the other hand, I guess that you don't want to draw the main path. In that case, you should change \draw to \path.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,snakes}
\begin{document}
\begin{tikzpicture}
    \path [
           snake=expanding waves, segment amplitude = 1.5cm, segment length = 0.3 cm, 
           postaction={draw,decorate, decoration={random steps,segment length=3pt,amplitude=5pt}}
          ]
          (0,0) -- (-2,0);
\end{tikzpicture}

\end{document}

result

Caramdir
  • 89,023
  • 26
  • 255
  • 291
  • Thanks, that worked. As a note, I had to change the \draw to a \path in order to achieve the effect I wanted (only the randomized postaction path). – Derek Mar 15 '11 at 23:54