This repository demonstrates animated plots with Matplotlib in JupyterLab and Jupyter Notebook 7+ interfaces in sessions served via the MyBinder system.
(If your Jupyter interface is based on NbClassic or Jupyter Notebook 6.4 or earlier, see here.)
Not sure what flavor of Jupyter tech you are using for your notebooks, then see 'Quickly Navigating the tech of the Jupyter ecosystem post-2023'.
JupyterLab interface:
Jupyter Notebook 7+:
Click on launch binder
badge above to spin up a sesion where you can run animated plots.