I'd like to decorate path with double line of stars and expect the upper line of stars duplicate the lower ones. But why the stars in the state{initial}
part are still random size.
I try to set mininum width, but it gives all same stars.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations,shapes.geometric,decorations.shapes,decorations.pathmorphing}
\begin{document}
\begin{tikzpicture}
\pgfdeclaredecoration{stars}{initial}{
\state{initial}[width=15pt ] {
\pgfmathparse{round(rnd*100)}
\pgfsetfillcolor{yellow!\pgfmathresult!orange}
\pgfsetstrokecolor{yellow!\pgfmathresult!red}
% set node mininum width
%\pgfmathparse{\pgfkeysvalueof{/pgf/minimum width} }
%\pgfset{minimum width=\pgfmathresult pt }
\pgfnode{star}{center}{}{}{\pgfusepath{stroke,fill}} % line lower stars
\pgftransformshift{\pgfpoint{0pt}{12pt}}
\pgfnode{star}{center}{}{}{\pgfusepath{stroke,fill}} % line upper stars
}
\state{final} {
\pgfpathmoveto{\pgfpointdecoratedpathlast}
}
}
\draw[decorate, decoration={stars}, star point ratio=2, star points=5, inner sep=0, minimum width=rnd*10pt+2pt] (0,0) -- +(5,0);
\end{tikzpicture}
\end{document}
\pgfmathtruncatemacro{\myresult}{round(rnd*100)}
instead of using\pgfmathresult
multiple times?\pgfmathtruncatemacro{\myresult}{\pgfkeysvalueof{/pgf/minimum width}}
\pgfset{minimum width=\myresult }
. Thanks.\pgfnode
has different minimum width without explicitly setting the/pgf/minimum width