• Resample AnimationChannels, losslessly deduplicating keyframes to reduce file size. Duplicate keyframes are commonly present in animation 'baked' by the authoring software to apply IK constraints or other software-specific features.

    Optionally, a WebAssembly implementation from the keyframe-resample library may be provided. The WebAssembly version is usually much faster at processing large animation sequences, but may not be compatible with all runtimes and JavaScript build tools.

    Result: (0,0,0,0,1,1,1,0,0,0,0,0,0,0) → (0,0,1,1,0,0)


    import { resample } from '@gltf-transform/functions';
    import { ready, resample as resampleWASM } from 'keyframe-resample';
    // JavaScript (slower)
    await document.transform(resample());
    // WebAssembly (faster)
    await document.transform(resample({ ready, resample: resampleWASM }));
Function symbol, where the argument and output are a box labeled 'glTF'.

Made by Don McCurdy. Documentation built with greendoc and published under Creative Commons Attribution 3.0.