Spaces:
Sleeping
Sleeping
Download src/lib/VRMAnimation/loadVRMAnimation.ts from ratalai/chatvrm_for_desh: direct link, hf CLI and curl.
- Browser
- Download file 587 Bytes
-
https://huggingface.co/spaces/ratalai/chatvrm_for_desh/resolve/main/src/lib/VRMAnimation/loadVRMAnimation.ts
- Command line
-
hf download hf://spaces/ratalai/chatvrm_for_desh/src/lib/VRMAnimation/loadVRMAnimation.ts
-
curl -L -o loadVRMAnimation.ts https://huggingface.co/spaces/ratalai/chatvrm_for_desh/resolve/main/src/lib/VRMAnimation/loadVRMAnimation.ts
587 Bytes
| import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader'; | |
| import { VRMAnimation } from './VRMAnimation'; | |
| import { VRMAnimationLoaderPlugin } from './VRMAnimationLoaderPlugin'; | |
| const loader = new GLTFLoader(); | |
| loader.register((parser) => new VRMAnimationLoaderPlugin(parser)); | |
| export async function loadVRMAnimation(url: string): Promise<VRMAnimation | null> { | |
| const gltf = await loader.loadAsync(url); | |
| const vrmAnimations: VRMAnimation[] = gltf.userData.vrmAnimations; | |
| const vrmAnimation: VRMAnimation | undefined = vrmAnimations[0]; | |
| return vrmAnimation ?? null; | |
| } | |