Related to the question Drawing a system of pendulums I tried to draw the case when the bobs are in opposite phases (the last figure in the output), by mimicking the stretch of the spring.
The code is:
\documentclass{article}
\usepackage{tikz}
\usepackage{tikz}
\usetikzlibrary{
angles,
quotes,
arrows.meta,
decorations.markings,
decorations.pathmorphing,
decorations.pathreplacing,
calc,
patterns,
positioning
}
\tikzset{
spring/.style={thick,decorate,decoration={aspect=0.5, segment length=#1, amplitude=3mm,zigzag}},
springgg/.style={thick,decorate,decoration={aspect=0.5, segment length=#1, amplitude=2mm,zigzag}},
blank/.style={draw=none,fill=none,pos=0.5},
ground/.style={fill,pattern=north east lines,draw=none,minimum width=0.5cm,minimum height=0.3cm},
damper/.style={thick,
decoration={markings, mark connection node=dmp,
mark=at position 0.5 with
{
\node (dmp) [thick,inner sep=0pt,transform shape,rotate=-90,minimum width=10pt,minimum height=3pt,draw=none] {};
\draw [thick] ($(dmp.north east)+(2pt,0)$) -- (dmp.south east) -- (dmp.south west) -- ($(dmp.north west)+(2pt,0)$);
\draw [thick] ($(dmp.north)+(0,-3pt)$) -- ($(dmp.north)+(0,3pt)$);
}
}, decorate
},
box/.style={draw,thick,minimum width=1cm, minimum height=1cm},
dot/.style={circle,inner sep=1pt,fill,label={#1},name=#1},
extended line/.style={shorten >=-#1,shorten <=-#1},
extended line/.default=0cm,
bob/.style={draw,fill=gray!40,circle,minimum size=6pt,inner sep=6pt}
}
\begin{document}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\begin{scope}
\node (wall) [ground, minimum width=4cm] {};
\draw (wall.south east) -- (wall.south west);
\coordinate (pivot1) at (-1,-0.16);
\draw[thick,-] (pivot1) -- ++ (0,-4)
node (bob1) [bob]{$$}
coordinate [midway] (resort1);
\coordinate (pivot2) at (1,-0.16);
\draw[thick,-] (pivot2) -- ++ (0,-4)
node (bob2) [bob]{$$}
coordinate [midway] (resort2);
\coordinate (topspring) at ($(resort1) + (0.2cm,0)$);
\coordinate (bottomspring) at ($(resort2) - (0.2cm,0)$);
\draw [decoration={aspect=0.3, pre length=0.3cm, post length=0.3cm, segment length=3mm, amplitude=3mm,zigzag},thick,decorate] (resort1)--(resort2);
\draw[decorate,decoration={brace,amplitude=.35cm}] (pivot2) -- node[right=3mm] {$l$} (resort2);
\draw[decorate,decoration={brace,mirror,amplitude=.35cm}] (pivot1) to node[left=3mm] {$L$} (bob1);
\end{scope}
\begin{scope}[xshift=4.5cm]
\node (wall) [ground, minimum width=4cm] {};
\draw (wall.south east) -- (wall.south west);
\useasboundingbox (wall.north west) rectangle ([yshift=-4cm]wall.east);
\pgfmathsetmacro{\myAngle}{30}
\coordinate (pivot1) at (-1,-0.16);
\draw[thick] (pivot1) -- ++ (270+\myAngle:4cm)
node (bob1) [bob]{$$}
coordinate [midway] (spring1);
\coordinate (c1) at (pivot1|-spring1);
\pic [draw, -,font=\small,"$\theta_1$", angle eccentricity=1.5] {angle = c1--pivot1--bob1};
\coordinate (pivot2) at (1,-0.16);
\draw[thick] (pivot2) -- ++(270+\myAngle:4cm)
node (bob2) [bob]{$$}
coordinate [midway] (spring2);
\coordinate (c2) at (pivot2|-spring2);
\pic [draw, font=\small, "$\theta_2$", angle eccentricity=1.5] {angle = c2--pivot2--bob2};
\coordinate (topspring) at ($(spring1) + (0.2cm,0)$);
\coordinate (bottomspring) at ($(spring2) - (0.2cm,0)$);
\draw [decoration={aspect=0.3, pre length=0.3cm, post length=0.3cm, segment length=3mm, amplitude=3mm,zigzag},thick,decorate] (spring1)--(spring2);
\draw [thick, densely dotted] (pivot1) |- (spring1);
\draw [thick, densely dotted] (pivot2) |- (spring2);
\draw[decorate,decoration={brace,mirror,amplitude=.25cm}] (c1) -- node[below=2mm] {$x$} (spring1);
\draw[decorate,decoration={brace,mirror,amplitude=.25cm}] (c2) -- node[below=2mm] {$y$} (spring2);
\draw[decorate,decoration={brace,amplitude=.35cm}] (pivot1) -- node[blank,right=3mm,yshift=2mm] {$l$} (spring1);
\draw[decorate,decoration={brace,amplitude=.35cm}] (pivot2) -- node[blank,right=3mm,yshift=2mm] {$L$}(bob2) ;
\end{scope}
\end{tikzpicture}
\end{figure}
\begin{figure}[htbp]
\centering
\begin{tikzpicture}
\node (wall) [ground, minimum width=4cm] {};
\draw (wall.south east) -- (wall.south west);
\pgfmathsetmacro{\myAngle}{30}
\coordinate (pivot1) at (-1,-0.16);
\draw[thick] (pivot1) -- ++ (270+\myAngle-60:4cm)
node (bob1) [bob]{$$}
coordinate [midway] (arc1);
\coordinate (c1) at (pivot1|-arc1);
\pic [draw, -,font=\small,"$\theta_1$", angle eccentricity=1.5] {angle = bob1--pivot1--c1};
\coordinate (pivot2) at (1,-0.16);
\draw[thick] (pivot2) -- ++(270+\myAngle:4cm)
node (bob2) [bob]{$$}
coordinate [midway] (arc2);
\coordinate (c2) at (pivot2|-arc2);
\pic [draw, font=\small, "$\theta_2$", angle eccentricity=1.5] {angle = c2--pivot2--bob2};
\draw [decoration={aspect=0.3, pre length=0.3cm, post length=0.3cm, segment length=7mm, amplitude=2mm,zigzag},thick,decorate] (arc1)--(arc2);
\draw [thick, densely dotted] (pivot1) |- (arc1);
\draw [thick, densely dotted] (pivot2) |- (arc2);
\draw[decorate,decoration={brace,amplitude=.25cm}] (c1) -- node[below=2mm] {$x$} (arc1);
\draw[decorate,decoration={brace,mirror,amplitude=.25cm}] (c2) -- node[below=2mm] {$y$} (arc2);
\draw[decorate,decoration={brace,mirror,amplitude=.35cm}] (pivot1) -- node[blank,left=3mm,yshift=2mm] {$l$} (arc1);
\draw[decorate,decoration={brace,amplitude=.35cm}] (pivot2) -- node[blank,right=3mm,yshift=2mm] {$L$}(bob2);
\end{tikzpicture}
\end{figure}
\end{document}
Th problem is that the lengths of the segments connecting the left-right ends of the springs to the points where the springs are attached to the strings are different, even if the pre length and post length in the definition of the springs are both equal to 0.3cm.
How could I make these segments of equal lengths ?

