I want draw a figure like fig 1, but my Latex give fig 2. I think the problem is in:
\shade[top color=blue!20] (-1,-1.2) rectangle (3,3);
Here is the Latex code:
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing,patterns}
\usetikzlibrary{arrows.meta}
\begin{document}
\begin{tikzpicture}
\draw[decoration={aspect=0.3, segment length=1.5mm, amplitude=2.4mm,coil},decorate] (1,5) -- (1,3.3);
\fill [pattern = north east lines] (-0.5,5) rectangle (2.5,5.2);
\draw[thick] (-0.5,5) -- (2.5,5);
%\filldraw[fill=blue!20, draw=blue!60] (-1,-1.2) rectangle (3,3);
\draw[line width=0.5pt] (1,3.3) -- (1,2.5);
\draw[line width=1pt] (-1,3) -- (3,3);
\draw[->] (1,0.2) -- (1,-0.8);
\node[draw=none,right=.1cm] at (1.3,4.25) (a) {$K$};
\node[draw=none,right=.1cm] at (0,-0.5) (a) {$f(t)$};
\draw[line width=6pt] (1,2.5) -- (1,-0.2);
\shade[top color=blue!20] (-1,-1.2) rectangle (3,3);
\end{tikzpicture}
\end{document}
The output is not correct!