How can I animate a vertex translation of a triangular mesh?
Scripting blenders animation system.
Back in the old days one of the common methods to animate a mesh was via a hook.
Similarly to How to transform a mesh with many objects? here is code to add and assign a hook empty to each vertex of the object named &quot;Triangle&quot; in the scene.
Setup script: add hooks
import bpy

context = bpy.context
scene = context.scene
tri = scene.objects.get(&quot;Triangle&quot;)
if tri:
    me = tri.data
    for v in me.vertices:
        name = f&quot;Vert_{v.index}&quot;
        bpy.ops.object.empty_add(
                location=tri.matrix_world @ v.co
                )
        mt = context.object
        mt.name = name
        hm = tri.modifiers.new(
                name=name,
                type='HOOK',
                )
        hm.object = mt
        hm.vertex_indices_set([v.index]) 

To move any vert simply animate the associated hook.
To animate.
Each hook is a proxy for its associated vert in global space.
Demo script, at each 50 frame interval keyframe the location of vertex 2's hook such that it is 25% further from vertex 2 moving along the direction of edge (v1, v2).
import bpy
context = bpy.context

ob = context.object # Hooked object


v1, v2, v3 = [m.object for m in ob.modifiers
        if m.type == 'HOOK' and m.object]
context.scene.frame_set(1)        
for frame in range(1, 250, 58):
    v2.keyframe_insert(&quot;location&quot;, frame=frame)
    v2.location += 0.25 * (v2.location - v1.location)

removing the hooks and / or the hook modifiers returns the triangle back to its original geometry.