I have a question similar to TikZ Fading Speed and defining a fading-style directly in the fill command but I can't figure out how to get a nice solution. I would like to, given a list of increasing integers from 0 to 100, generate the following piece of code:

\documentclass[10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{tikz}
\usetikzlibrary{positioning,fit,calc}
\begin{document}
\begin{tikzpicture}[start chain=1 going right,node distance=-0.15mm]
\node [on chain=1] at (-1.5,-.4) {\ldots};
\node [draw,dashed,on chain=1] {};
\node [draw,dashed,on chain=1] {};
\end{tikzpicture}
\end{document}


Here, obviously my list is {0, 70, 100}. I would like to use a foreach loop inide my tikzpicture, but I can't place the \tikzfading inside the tikzpicture, and I didn't suceed in using the answer from the above-mentioned post, could someone help me out ?

Thanks

-

You can do it by the following

\documentclass[border=2mm]{standalone}
\usepackage{tikz}
\def\lastx{0}
\foreach \x[remember=\x as \lastx,count=\xi from 0] in {20,40,70,100}{
}
\begin{document}

\begin{tikzpicture}[start chain=1 going right,node distance=-0.15mm,]

Well spotted by canaaerus that initially option causes some trouble. There was another question where I had the same problem but I couldn't find it. It's best to define \lastx out of the loop.
It seems like \lastx is always 0!?! –  canaaerus Aug 3 '12 at 10:31
@canaaerus You are right, it happened to me before with initially option. I'll fix it in a sec. –  percusse Aug 3 '12 at 10:38