Using a Rotation Matrix to Draw a Spring on a hill using “Scatter Plots”

ClearAll["Global`*"];

m=0.5;k=200;  (* mass, spring constant *)
L0=1.5;c=.2; (* orig length of spring -> must be bigger than displacement!, springwidth *)
g = 9.8;b = 0.5; (* g; box size *)
θ=32*Degree; (*angle of the hill *)
displacement=1.0; (* how far did the spring gets pulled down by the person? *)
ΔLeq = ((m*g*Sin[θ])/k); (* Physics: in equilibrium, how much is spring stretched? *)
repeats=4.0; (* how many spring bounces to show? *)
frames=100;

w=3;h1=w*Tan[θ]; (* "w" is the physical width of the plot *)
wallsx={0,w,w-1*Tan[θ],w+1,w+1,0}; (* define coordinates of walls *)
wallsy={0,h1,h1+1,h1+1,0,0};
wallpoints = Length[wallsx]; (*how many coords make up this wall graphic? *)
boxx={0,b,b,0,0}; (*define coordinates of unrotated and undeflected box*)
boxy={0,0,b,b,0}; 
boxpoints= Length[boxx]; (* ie, there are 5 coordinates for the box corners... *)
springpoints = 50.0;springloops=3.0; (* decisions about appearance of spring... *)
springx[Lact_] := Table[((i*Lact)/springpoints),{i,0,springpoints+1}]; (* define coordinates of the spring *)
springy = Table[c*Sin[((2*π*springloops*i )/springpoints)],{i,0,springpoints+1}];

walls=ListPlot[Table[{wallsx[[i]],wallsy[[i]]},{i,1,wallpoints}],Joined->True,PlotRange->{{0.0,4.5},{-.1,4.4}},AspectRatio->1,PlotStyle->{DarkBlue, Thick},Axes->{False,False}] ;

z0=(w/(Cos[θ]))-b-L0-ΔLeq;ω=(Sqrt[(k/m)]);period = ((2*π)/ω); (* Physics and some geometry *)
z[t_] =z0-displacement*Cos[ω*t];(* Calculate position of box as a function of time... *)
x[t_]:=z[t]*Cos[θ];y[t_]:=z[t]*Sin[θ];
xboxnew[t_]:=x[t]+boxx*Cos[θ] - boxy*Sin[θ];(*rotate and move the box... *)
yboxnew[t_]:=y[t]+boxx*Sin[θ] + boxy*Cos[θ];
Lact[t_]:=L0+displacement*Cos[ω*t];
xspringnew[t_]:=x[t]+springx[Lact[t]]*Cos[θ] - springy*Sin[θ]+b*Cos[θ]-0.5*b*Sin[θ];(*rotate and move the spring... *)
yspringnew[t_]:=y[t]+springx[Lact[t]]*Sin[θ] + springy*Cos[θ]+b*Sin[θ]+0.5*b*Cos[θ];
boxfinal[t_] := ListPlot[Table[{xboxnew[t][[i]],yboxnew[t][[i]]},{i,1,boxpoints}],Joined->True,PlotRange->{{0.0,4.5},{-.1,4.4}},AspectRatio->1,PlotStyle->{Brown,Thick},Axes->{False,False}];
springfinal[t_] := ListPlot[Table[{xspringnew[t][[i]],yspringnew[t][[i]]},{i,1,springpoints+1}],Joined->True,PlotRange->{{0.0,4.5},{-.1,4.4}},AspectRatio->1,PlotStyle->{Purple,Thick},Axes->{False,False}];
thismovie=Manipulate[Show[boxfinal[t],walls,springfinal[t]],{t,0,repeats*period}]

allframes=Table[Show[boxfinal[t],walls,springfinal[t]],{t,0,repeats*period,((repeats*period)/frames)}];
Export["C:\\Users\\pogo\\Desktop\\mma\\spring.gif",allframes,"DisplayDurations"->1/30];