think you need to trigger the animation to render. You can do this directly with anim.to_jshtml () or anim.to_html5_video (). Should also work by having anim at the end of the cell...BUT: On my system ...
The canonical FuncAnimation example does not work in https://molab.marimo.io (nor in https://marimo.app for that matter) even though it works in plain old jupyter and even pyscript. mo.mpl.interactive ...