3

How can I obtain an expanding wave in tikz that starts with a longer arc?

The minimal example below indicates what I want. The first two arcs, which are slightly visible should be removed completely and programmatically. Actually, I do not want to overwrite them by some workaround.

Is there a option for expanding waves to obtain this?

minimal

\documentclass[]{scrreprt}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{amssymb}

\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing, decorations.pathreplacing}

\begin{document}
    \begin{figure}
        \begin{tikzpicture}
            \draw[decoration={expanding waves,segment length=1.5mm, angle=20}, ultra thick, decorate] (0, 0) -- ++(1.2,0);
            \draw[decoration={expanding waves,segment length=1.5mm, angle=20}, ultra thick, decorate, white] (0,0) -- ++(0.3,0);
        \end{tikzpicture}
    \end{figure}
\end{document}

Note: In a earlier version of this question I used the snake tikz library, which is now deprecated.

2
  • 2
    snakes has been deprecated for ten years or so. Please use decorations. Commented Feb 19, 2022 at 18:54
  • It is not possible with expanding waves. Do you prefer a low level altenative with app. 26 lines of complicated pgfcode defining a new decoration or a high level TikZ solution that \draws the relevant arcs? Edit: could also be done wit a clip. - I will post that. Commented Feb 19, 2022 at 21:11

1 Answer 1

4

It can not be done with expanding waves alone as there is no option for alt. start point. A new decoration could be defined, but it is much simpler to just use clip (only things within the clip path is drawn):

\documentclass[tikz, border=1cm]{standalone}
\usetikzlibrary{decorations.pathreplacing, patterns}
\begin{document}
\begin{tikzpicture}
\pattern [pattern=checkerboard,pattern color=black!30] (0,-1) rectangle (2,1);
\clip (3.5mm, -1) rectangle (2,1);
\draw[decoration={expanding waves, segment length=1.5mm, angle=20}, ultra thick, decorate, red] (0, 0) -- ++(1.2,0);
\end{tikzpicture}
\end{document}

Expanding waves on checkerboard

1
  • This is the canonical answer I was looking for. Canonical in the sense that can be understood intuitively if someone else reads your TikZ code as opposed to solutions with overwriting by other shapes. Moreover, overwriting with rectangles, which I also tried, led to the additional problem that this tends to hide other things, too.
    – aiquita
    Commented Feb 20, 2022 at 13:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .