%% examples/mechanics-spring-block.tex
%% A spring node 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$};

  \node[spring, minimum width=4cm,
        pre length=5pt,
        post length=5pt,
        amplitude=4.5pt,
        segment length=4.5pt,
        anchor=end] (S) at (B.west) {};
  \node[above=3pt] at (S.coil-mid) {$k$};

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