@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in.
44 lines (43 loc) • 1.93 kB
TypeScript
import { AnimationAction, AnimationClip, AnimationMixer, Object3D } from "three";
import type { Context } from "./engine_context.js";
import { IAnimationComponent, Model } from "./engine_types.js";
/**
* Registry for animation related data. Use {@link registerAnimationMixer} to register an animation mixer instance.
* Can be accessed from {@link Context.animations} and is used internally e.g. when exporting GLTF files.
* @category Animation
*/
export declare class AnimationsRegistry {
readonly context: Context;
readonly mixers: AnimationMixer[];
constructor(context: Context);
/** @hidden @internal */
onDestroy(): void;
/**
* Register an animation mixer instance.
*/
registerAnimationMixer(mixer: AnimationMixer): void;
/**
* Unregister an animation mixer instance.
*/
unregisterAnimationMixer(mixer: AnimationMixer | null | undefined): void;
}
/**
* Utility class for working with animations.
*/
export declare class AnimationUtils {
/**
* Tries to get the animation actions from an animation mixer.
* @param mixer The animation mixer to get the actions from
* @returns The actions or null if the mixer is invalid
*/
static tryGetActionsFromMixer(mixer: AnimationMixer): Array<AnimationAction> | null;
static tryGetAnimationClipsFromObjectHierarchy(obj: Object3D, target?: Array<AnimationClip>): Array<AnimationClip>;
/**
* Assigns animations from a GLTF file to the objects in the scene.
* This method will look for objects in the scene that have animations and assign them to the correct objects.
* @param file The GLTF file to assign the animations from
*/
static assignAnimationsFromFile(file: Pick<Model, "animations" | "scene">, opts?: {
createAnimationComponent(obj: Object3D, animation: AnimationClip): IAnimationComponent;
}): void;
}