b2dMeshAnimate

Blends two morph frames (by t, 0..1) into the mesh's current pose.

2D Overlay

Parameters & Returns

Parameters

handle Int
frameA Int
frameB Int
t Double

Returns

Void

Quick Summary

Blends two morph frames (by t, 0..1) into the mesh's current pose.

Technical Exegesis...

Linearly interpolates between morph frames frameA and frameB by t (0..1) and stores the result as the mesh's CURRENT pose; the next b2dMeshCopyVertsX/Y/Z calls then read that blended pose. Frames and t are clamped to valid ranges. To play a clip, work out which two frames you're between from elapsed time and the clip's fps (see b2dMeshClipStart / b2dMeshClipFrames / b2dMeshClipFPS), looping within the clip. Faces and UVs never change - only positions - so the rest of your draw loop is unchanged.

Example

Example.bam
Local fpos:Double = animTime * clipFPS
Local fi:Int      = ToInt(fpos) Mod clipFrames
Local t:Double    = fpos - ToDouble(ToInt(fpos))
b2dMeshAnimate(mesh, clipStart + fi, clipStart + ((fi + 1) Mod clipFrames), t)
b2dMeshCopyVertsX(mesh, mvx)   ; ...Y, ...Z, then project + draw