import { VRMAnimation } from './VRMAnimation'; import { VRMAnimationLoaderPlugin } from './VRMAnimationLoaderPlugin'; import { GLTFParser, GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js'; const loader = new GLTFLoader(); loader.register((parser: GLTFParser) => new VRMAnimationLoaderPlugin(parser)); export async function loadVRMAnimation(url: string): Promise { const gltf = await loader.loadAsync(url); const vrmAnimations: VRMAnimation[] = gltf.userData.vrmAnimations; const vrmAnimation: VRMAnimation | undefined = vrmAnimations[0]; return vrmAnimation ?? null; }