%% examples/mechanics-spring-block.tex
%% A spring path joining a fixed wall to a block on a horizontal platform.

\documentclass[tikz,border=5mm]{standalone}
\usepackage{tikzphysics}

\begin{document}
\begin{tikzpicture}[>=stealth]
  \node[platform-left, minimum width=6cm, minimum height=2cm,
        anchor=floor-top-mid] (P) at (0,0) {};

  \node[block, minimum width=1cm, minimum height=0.8cm,
        anchor=south] (B) at ($(P.floor-top-25)+(0,0)$) {$m$};

  \coordinate (A) at ($(B.west)+(-4cm,0)$);
  \draw[spring,
        pre length=5pt, post length=5pt,
        amplitude=4.5pt, segment length=4.5pt]
    (A) -- node[above=3pt] {$k$} (B.west);

  \draw[->,thick] (B.east) -- ++(1.1,0) node[right] {$v$};
\end{tikzpicture}
\end{document}
