UNPKG

sandai-react

Version:

React components and utilities for the Sandai 3D AI Characters.

65 lines 3.09 kB
import { VRM, VRMPose } from "@pixiv/three-vrm"; import * as THREE from "three"; import { MotionConversionWorkerClient } from "./MotionExpressionWorkerClient"; import { Observable } from "rxjs"; import { ExpressionOptions, LoopType } from "./ExpressionManager"; export interface MotionExpression<T = any> { clip: THREE.AnimationClip; duration?: number; metadata?: T; } export declare class MotionExpressionManager { private _vrm; private _mixer; private _fbxConverter; private _bvhConverter; private _vrmaConverter; private _currentAnimationClip; private _startNextTimer; private _worker; private _destroyed; private _currentObservers; private _currentActions; private _frameOverride; private _currentPose; private _dynamicBaseQuats?; private _staticBaseQuats?; private _smoothing; set smoothing(values: Partial<typeof this._smoothing>); constructor(vrm: VRM, vrmUrl: string, workerClient?: MotionConversionWorkerClient); x2motion(type: "fbx" | "bvh" | "vrma", filePath: string, onProgress?: (name: string, progress: number) => void): Promise<MotionExpression>; fbx2motion(filePath: string, onProgress?: (name: string, progress: number) => void): Promise<MotionExpression>; bvh2motion(filePath: string, onProgress?: (name: string, progress: number) => void): Promise<MotionExpression>; vrma2motion(filePath: string, onProgress?: (name: string, progress: number) => void): Promise<MotionExpression>; frameOverride(onFrame: (() => { pose: VRMPose; ease?: number; }) | null): void; private _applyExpressionSmoothing; /** * * @param expressions * @param loop * @param opt defines expression options for interpolation and blending and the like * @param opt.interpolationMode uses the underlying THREE.InterpolationMode to set the interpolation mode of the animation clips * @param opt.animationBlendMode uses the underlying THREE.AnimationBlendMode to set the blend mode of the animation clips * @param opt.smoothing number between 0 and 1. smoothes/dampens the animation. the closer the value is to 1, the less the animation will deviate * from the idle pose. This might make specific gestures unrecognizable, but may be helpful for general motion, where * specific gestures are undesired but instead some loosely fitting animations fulfill the purpose good enough. * 0 = no smoothing, 1 = idle pose * @param skipFirstRender skips the initial render. set this to true if you're managing the inital render yourself. * @returns */ applyExpressions(expressions: MotionExpression[], loop?: LoopType, opt?: ExpressionOptions, skipFirstRender?: boolean): Observable<MotionExpression>; private _getStaticBaseQuats; private _applyExpressions; private _setClipInterpolation; /** * * @param delta time delta provided by threejs * @returns */ processExpressions(delta: number): void; destroy(): void; } //# sourceMappingURL=MotionExpressionManager.d.ts.map