# Reproducing image of a spiral using TikZ

I'm trying to reproduce the spiral shape in the picture below in TikZ, I'm not interested in the atoms and the text, just the spiral. I want the spiral to be coloured green like in the image.

I was considering somehow putting together several sinus curves, however that seems like a really inefficient way to do this, and I don't know how I would colour the shape using that method.

Here is a possible solution:

\documentclass[tikz]{standalone}

\begin{document}
\begin{tikzpicture}
\colorlet{color 2}{lime!50!gray}
\colorlet{color 1}{white}
\foreach \dx in {0,2,4}{
\begin{scope}[xshift=\dx cm]
\draw[draw=gray,top color=color 2,bottom color=color 1]
(0,0) -- ++(1,0) cos ++(.5,1) sin ++(.5,1) -- ++(-1,0) cos ++(-.5,-1) sin ++(-.5,-1) -- cycle;
\end{scope}
}
\foreach \dx in {0,2,4}{
\begin{scope}[xshift=1cm + \dx cm]
\draw[draw=gray,top color=color 1,bottom color=color 2]
(0,2) -- ++(1,0) cos ++(.5,-1) sin ++(.5,-1) -- ++(-1,0) cos ++(-.5,1) sin ++(-.5,1) -- cycle;
\end{scope}
}
\end{tikzpicture}
\end{document}

• Your colors are upside down ;) Dec 12 '14 at 0:59
• @ColeJohnson Are you sure? Where is the light? ;-) Dec 12 '14 at 5:43

Taking inspiration (and code) from Paul, here is a cramped spiral using in and out angles, just to show another way:

\documentclass[tikz,border=5]{standalone}
\begin{document}
\begin{tikzpicture}[x=3cm,y=0.8cm]
\colorlet{color 2}{lime!50!gray}
\colorlet{color 1}{white}
\foreach \dx in {0,6,12}{
\begin{scope}[xshift=\dx cm]
\draw[draw=gray,top color=color 2,bottom color=color 1]
(0,0) -- ++(1,0) to[out=0,in=180] ++(1,3) -- ++(-1,0) to[out=180,in=0] ++(-1,-3) -- cycle;
\end{scope}
}
\foreach \dx in {0,6,12}{
\begin{scope}[xshift=3cm + \dx cm]
\draw[draw=gray,top color=color 1,bottom color=color 2]
(0,3) -- ++(1,0) to[out=0,in=180] ++(1,-3) -- ++(-1,0) to[out=180,in=0] ++(-1,3) -- cycle;
\end{scope}
}
\end{tikzpicture}
\end{document}


Here is the Paul Gaborit's code rewriten with triple foreach to make it shorter ;).

\begin{tikzpicture}
\colorlet{color 1}{lime!50!gray}
\colorlet{color -1}{white}
\foreach \s [evaluate=\s as \w using int(-\s)] in {1,-1} {
\foreach \t in {0,1,2} {
\draw[draw=gray,top color=color \s,bottom color=color \w, xshift=2*\t cm, xscale=\s]
(-1.5,-1) \foreach \i in {1,-1} {cos ++(\i/2,\i) sin ++(\i/2,\i) -- ++(\i,0)};
}
}
\end{tikzpicture}


Note: I came to update using the Ignasi suggestion to use the central symetry between (-1.5,-1) cos ++(.5,1) sin ++(.5,1) -- ++(1,0) and cos ++(-.5,-1) sin ++(-.5,-1) -- cycle by introducing a third \foreach.

• You can mark your answer as CW if rep point is a concern for yourself. Otherwise no problem. Dec 11 '14 at 17:09
• @percusse sorry what meens CW ? And how to do it ? Thanks in advance for your help.
– Kpym
Dec 11 '14 at 17:19
• It's Community Wiki. Before you post it should be on the lower right corner, a tick box, that you can mark it as a CW. See this for example. Dec 11 '14 at 17:21
• @Kpym What about (-1.5,-1) \foreach \i in {1,-1} {cos ++(.5*\i,1*\i) sin ++(.5*\i,1*\i) -- ++(\i,0)} -- cycle; ? Dec 11 '14 at 18:02
• @Ignasi I like this ! I'll edit the answer with your code.
– Kpym
Dec 11 '14 at 18:14