Ich versuche, die Spiralform im Bild unten in TikZ zu reproduzieren. Mich interessieren nicht die Atome und der Text, nur die Spirale. Ich möchte, dass die Spirale wie im Bild grün gefärbt wird.
Ich habe überlegt, irgendwie mehrere Sinuskurven zusammenzusetzen, aber das scheint mir keine wirklich effiziente Methode zu sein und ich weiß nicht, wie ich die Form mit dieser Methode einfärben soll.
Antwort1
Hier ist eine mögliche Lösung:
\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}
Antwort2
Inspiriert (und mit Code) von Paul, hier ist eine enge Spirale mit in
und out
Winkeln, nur um eine andere Möglichkeit zu zeigen:
\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}
Antwort3
Hier ist der Code von Paul Gaborit, der mit Triple umgeschrieben wurde, foreach
um ihn kürzer zu machen ;).
\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}
Notiz:Ich habe die Aktualisierung mithilfe des Ignasi-Vorschlags durchgeführt, die zentrale Symmetrie zwischen (-1.5,-1) cos ++(.5,1) sin ++(.5,1) -- ++(1,0)
und cos ++(-.5,-1) sin ++(-.5,-1) -- cycle
durch Einführung eines dritten zu verwenden \foreach
.