Since you want to animate the swing of the pendulum, I would suggest a different approach using polar coordinates. This makes things much easier (I used Black Mild's nice answer as basis for this, hence the similarity of the design):
\documentclass[border=10pt]{standalone}
\usepackage{animate}
\usepackage{tikz}
\pgfmathsetmacro{\pendulumswing}{40}
\pgfmathsetmacro{\pendulumlength}{5}
\begin{document}
\begin{animateinline}[controls, palindrome]{45}
\multiframe{45}{rt=0+4}{%
\begin{tikzpicture}[line width=1pt]
\draw[dashed] (0:0) -- (90:{-\pendulumlength}) coordinate (o);
\draw[dashed] ({90-\pendulumswing}:{-\pendulumlength}) coordinate (a)
arc[start angle={90-\pendulumswing}, end angle={90+\pendulumswing}, radius={-\pendulumlength}] coordinate (b);
\draw[dashed, red] (a) -- (a |- o) coordinate (c) node[below] {$-x_m$};
\draw[dashed, red] (b) -- (b |- o) coordinate (d) node[below] {$x_m$};
\draw[-stealth, red] ([xshift=-1cm]c) -- ([xshift=1cm]d);
% variable \rt goes from 0 to 180
% cos(\rt) returns a value between -1 and 1 following a (co)sine curve
\pgfmathsetmacro{\pendulumangle}{cos(\rt)*\pendulumswing}
\draw (0:0) -- ({90+\pendulumangle}:{-\pendulumlength})
node[circle, fill=blue, text=white] {$\mathbf{m}$};
\end{tikzpicture}%
}%
\end{animateinline}
\end{document}

The macro \pendulumswing takes the maximum angle the pendulum goes to the left or right. The macro \pendulumlength takes the length of the pendulum. Change these values to get longer pendulums or pendulums with different deflection.
Compile and use Acrobat to play the animation. With other viewers, the animation may not work correctly. Below is a GIF approximation of the output:

In a similar way, you can draw the first figure with the ball:
\documentclass[border=10pt]{standalone}
\usepackage{animate}
\usepackage{tikz}
\usetikzlibrary{patterns}
\pgfmathsetmacro{\pendulumswing}{80}
\pgfmathsetmacro{\pendulumlength}{3}
\pgfmathsetmacro{\floordepth}{0.2}
\pgfmathsetmacro{\bobsize}{.75}
\begin{document}
\begin{animateinline}[controls, palindrome]{45}
\multiframe{45}{rt=0+4}{%
\begin{tikzpicture}[line width=1pt]
\coordinate (o) at (90:{-\pendulumlength-\bobsize/2});
\fill[orange!10, draw=black] (180:{-\pendulumlength-\bobsize/2}) coordinate (a)
arc[start angle={180}, end angle={0}, radius={-\pendulumlength-\bobsize/2}] coordinate (b) -- cycle;
\coordinate (a) at ({90-\pendulumswing}:{-\pendulumlength-\bobsize/2});
\coordinate (b) at ({90+\pendulumswing}:{-\pendulumlength-\bobsize/2});
\draw[dashed, red] (a) -- (a |- o) coordinate (c) node[below={\floordepth1cm}] {$-x_m$};
\draw[dashed, red] (b) -- (b |- o) coordinate (d) node[below={\floordepth1cm}] {$x_m$};
\fill[pattern=north east lines] ([xshift=-1cm]c) rectangle ([xshift=1cm, yshift={\floordepth*-1cm}]d);
\draw[-stealth, red] ([xshift=-1cm]c) -- ([xshift=1cm]d);
% variable \rt goes from 0 to 180
% cos(\rt) returns a value between -1 and 1 following a (co)sine curve
\pgfmathsetmacro{\pendulumangle}{cos(\rt)*\pendulumswing}
\node[circle, draw, fill=gray, text=white, text width={\bobsize*1cm}, inner sep=0pt, align=center]
at ({90+\pendulumangle}:{-\pendulumlength}) {$\mathbf{m}$};
\end{tikzpicture}%
}%
\end{animateinline}
\end{document}

In case the animation becomes too slow, because it has so many frames or for whatever reason, you can tweak the frame rate and/or reduce the number of steps, for example using:
% [...]
\begin{animateinline}[controls, palindrome]{30}
\multiframe{30}{rt=0+6}{%
% [...]
}
\end{animateinline}
% [...]
You only need to make sure that the macro \rt goes from 0 to 180. Here, \multiframe{30}{rt=0+6} means that the variable \rt will start with 0 and is increased by 6 for each frame, with 30 frames in total (resulting in \rt being equal to 180 in the last frame).
arccommand? https://www.ctan.org/pkg/pgf – Black Mild Oct 05 '22 at 15:23dynamictag, that you have added, seems to be inappropriate. Simple pendulum is a basic model in ODEs. Are you asking for an animated gif of a simple pendulum? I suggest improving the question to clarify it, and providing the mathematical context or source (textbook, link, etc) – Black Mild Oct 06 '22 at 16:02