# Mesh vertex animation

My prerequisites: Little to no experience with blender, advanced experience in python

Starting Point: Mesh M with n vertices and m faces as .obj file.

Next step : Change coordinates of the n vertices incrementally.

What I have : Python script that calculates the new vertex coordinates for X timesteps

What I need : How to apply the list of new vertex coordinates to the mesh in blender with the related timesteps (=frames). (Python API of blender?) Is there something like:

for timestep in range(0,len(timesteps)):
newCoordinates = calculateCoordinates(mesh.vertices, timestep)
mesh.co = newCoordinates
mesh.Update()

# --> add keyframe to animation


What I tried:

• PlugIn Animall seems to have that functionality, however, I was not able to get that to work for my problem
• Keyframe animation is an older post from 2015. The aim appears to be similar, however none of the code snippets is working nor is leading to the desired results
• Does this answer your question? How to keyframe mesh vertices in Python Aug 18 '20 at 8:54
• Have made the necessary (and very minor) edits to 2 of 3 answers to update them to 2.8. The other handler technique is similar to blender.stackexchange.com/questions/187361/… Aug 18 '20 at 9:23
• blender.stackexchange.com/questions/74063/… Aug 18 '20 at 9:35
• Okay thanks a lot! Will check that tonight Aug 18 '20 at 9:37
• Thank you very much batfinger, it works now! Just one little additional question : Is it possible to "vectorize" the "for v in mesh.vertices"- loop in your first suggested answer? I do have N - matrices containing the vertex coordinates for N frames. I would just have to rewrite the vertice coordinates for each frame instead of for each vertex for each frame. Is it possible to improve its performance here? Aug 19 '20 at 13:57