# TikZ arrowheads on every dash of dashed line

I'd like to create a dashed line in TikZ with an arrow head at the end of each dash. The following code accomplishes this using a \foreach loop but looking for a way to do this with a style key instead. Something similar to

\draw [densely dashed, ->] (0,0) -- ++(100pt,0);


but places arrowheads on all dashes not just the end.

MWE:

\documentclass[12pt]{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\draw [densely dashed] (0,0) -- ++(100pt,0);
\foreach \i in {0,5,10,...,100}{%
\draw [->] (\i*1pt,-0.25) -- ++(3pt,0);
}
\end{tikzpicture}
\end{document}


I guess for this one of the simplest possibilities will be to employ decorations.markings.

\documentclass[12pt]{article}
\usepackage{tikz}
\usetikzlibrary{decorations.markings}
\begin{document}
\begin{tikzpicture}
\draw [dash pattern=on 3pt off 2pt,postaction={decorate,
decoration={markings,
mark=between positions 3pt and 1 step 5pt with {\arrow{>};}}}] (0,0) -- ++(100pt,0);
\end{tikzpicture}
\end{document}


Depending on the real application, one could make this a style, or, what might be better for curved paths, just declare a new (meta) decoration. Luckily, the pgfmanual has on p. 1007 a meta decoration that one only has to slightly modify to arrive at

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{decorations,arrows.meta}
\state{initial}[width=0pt, next state=arrow] {
\let\factor\pgfmathresult
%\pgfsetlinewidth{1pt}
\pgfset{/pgf/decoration/segment length=4pt}
}
\state{arrow}[
next state=end arrow]
{
\decoration{curveto}
\beforedecoration
{
} }
\decoration{curveto}
\afterdecoration
{
\pgfsetarrowsend{Latex[length=1pt,width=1pt]}
\pgfusepath{stroke}
}
}