I am making a picture using foreach
. MWE is appended below
\documentclass{article}
\usepackage[svgnames]{xcolor}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\foreach \x in {0,...,5}
\draw [DodgerBlue](\x,-1) circle (0.25);
\foreach \x in {0,...,5}
\draw [-latex,red](\x,-1) -- (\x,-1.5);
\foreach \x in {0,...,5}
\draw [-latex,DarkGreen](\x,-1) -- (\x,-0.5);
\draw [ultra thin] (5,-0.5) -- (0,-1);
\end{tikzpicture}
\end{document}
The resulting picture is attached below
Now what I want is that the green arrows on the top should be limited by the black line diagonal line. That is for the first circle there should be no green arrow, and its length should increase until it becomes equal to the red arrow in the last circle. How can this be done using foreach
using the variable \y
. Is there a way such that the intersection of the black diagonal line with the green arrows can be used to limit the length of the green arrows to the desired values? Or is there any other way to achieve this?