/** * 库的摘要信息 * * @remarks * 库的说明信息 * * @packageDocumentation */ import type { AnimationAction } from 'three'; import type { AnimationBlendMode } from 'three'; import { AnimationClip } from 'three'; import type { AnimationMixer } from 'three'; import { Bone } from 'three'; import { BufferGeometry } from 'three'; import type { ClassType } from 'type-tls'; import type { Curve } from 'three'; import type { CurvePath } from 'three'; import { Euler } from 'three'; import type { EulerOrder } from 'three'; import { Event as Event_2 } from 'three'; import { EventDispatcher } from 'three'; import { EventListener as EventListener_2 } from 'three'; import type { InterpolationModes } from 'three'; import type { IVector2 } from 'type-tls'; import type { IVector3 } from 'type-tls'; import type { IVector4 } from 'type-tls'; import { KeyframeTrack } from 'three'; import { Line3 } from 'three'; import type { Material } from 'three'; import { Matrix4 } from 'three'; import type { Mesh } from 'three'; import { NormalBufferAttributes } from 'three'; import { Object3D } from 'three'; import { Quaternion } from 'three'; import { QuaternionKeyframeTrack } from 'three'; import { SampleOptions } from '@three3d/tools'; import { Skeleton } from 'three'; import { SkinnedMesh } from 'three'; import type { Vector2 } from 'three'; import { Vector3 } from 'three'; import { VectorKeyframeTrack } from 'three'; /** * AnimationAction 的控制器 * @remarks * 可用于 gui 的状态 */ export declare class AnimationActionController { get action(): AnimationOperate | null | undefined; set action(value: AnimationOperate | null | undefined); setAction(action?: AnimationAction | null): void; protected _action?: AnimationOperate | null; constructor(action?: AnimationAction | null); get play(): boolean; set play(value: boolean); stop(): void; } export declare class AnimationActionCreator extends AnimationClipCreator { constructor(mixer: AnimationMixer, root?: Object3D | null); protected _mixer: AnimationMixer; get mixer(): AnimationMixer; set mixer(value: AnimationMixer); protected _root?: Object3D | null; /** * 动画action作用的根对象 */ get root(): Object3D | null | undefined; set root(value: Object3D | null | undefined); /** * 循环模式 */ get loop(): any; set loop(value: any); /** * 循环次数 */ get repetitions(): any; set repetitions(value: any); clipChanged(): void; actionChanged(): void; protected _action?: AnimationAction | null; /** * 获取 AnimationAction */ get action(): AnimationAction; /** * 创建 AnimationAction * @param root * @param blendMode * @param mixer * @returns */ createAction(root?: Object3D | null, blendMode?: AnimationBlendMode | null, mixer?: AnimationMixer | null): AnimationAction; } /** * 获取 AnimationAction 的动画的关键帧信息 */ export declare class AnimationActionKeyframe extends AnimationClipKeyframe { readonly action: AnimationAction; readonly isAnimationActionKeyframe = true; constructor(action: AnimationAction); /** * 动画的当前时间 * @remarks * 表示一个循环周期中动画的执行时间; */ get time(): number; /** * 动画的持续时间 */ get duration(): number; /** * 动画的进度时间 * @remarks * 反应动画在一个周期内的动画运动位置处的时间; */ get progressTime(): number; set progressTime(value: number); /** * 动画的进度 */ get progress(): number; set progress(value: number); /** * 动画循环的次数 * @remarks * 从 0 开始 */ get loopCount(): number; /** * 是否正在反向循环 * @remarks * 表示当循环模式为 `LoopPingPong` 时,当前是否正处于反向的循环情况; */ get isReverseLoop(): boolean; /** * 循环方向系数 * @remarks * 当处理正向循环时 为 1; * 处理反向循环时 为 -1; * * 与 {@link AnimationActionKeyframe.isReverseLoop} 表达相同的意思; */ get loopDirFactor(): 1 | -1; /** * 是否正在反向运动 * @remarks * 与 {@link AnimationActionKeyframe.isReverseLoop} 不同的是,该属性还会考虑 `timeScale` 的影响; * 即:该属性表示的是最终的效果是否是在反向动画; */ get isReverse(): boolean; /** * 方向系数 * @remarks * 当处理正向动画时 为 1; * 处理反向动画时 为 -1; * * 与 {@link AnimationActionKeyframe.isReverseLoop} 表达相同的意思; */ get dirFactor(): 1 | -1; protected _trackNames?: string[]; /** * 动画的所有轨道的名字 */ get trackNames(): string[]; /** * 动画所有轨道的当前关键帧的索引 */ get keyframeIndexs(): { [name: string]: number; }; /** * 所有轨道当前的关键帧 */ get keyframes(): KeyframeInfos; protected _positionTrackName?: string | null; /** * 位置轨道的名字 */ get positionTrackName(): string | null; /** * 位置轨道的当前关键帧索引 */ get positionkeyframeIndex(): number | null; get positionKeyframe(): { index: number; value: Vector3 | null; } | null; protected _quaternionTrackName?: string | null; /** * 四元数的轨道名字 */ get quaternionTrackName(): string | null; /** * 四元数轨道的当前关键帧索引 */ get quaternionKeyframeIndex(): number | null; /** * 四元数轨道的当前关键帧 */ get quaternionKeyframe(): { index: number; value: Quaternion | null; } | null; protected _rotationTrackName?: string | null; /** * 旋转轨道的名字 */ get rotationTrackName(): string | null; /** * 旋转轨道的当前关键帧索引 */ get rotationkeyframeIndex(): number | null; /** * 旋转轨道的当前关键帧 */ get rotationKeyframe(): { index: number; value: Euler | null; } | null; protected _scaleTrackName?: string | null; /** * 缩放轨道的名字 */ get scaleTrackName(): string | null; /** * 缩放轨道的当前关键帧索引 */ get scaleKeyframeIndex(): number | null; /** * 缩放轨道的当前关键帧 */ get scaleKeyframe(): { index: number; value: Vector3 | null; } | null; /** * 事件派发器 */ protected event: EventDispatcher; protected _frameEventNames?: string[] | null; get frameEventNames(): string[]; /** * AnimationMixer事件的监听器 */ protected mixerListener: (event: any) => void; get mixer(): AnimationMixer; /** * 添加事件监听器 * @param type - 事件的类型 * @param listener - 监听器 * @returns */ addEventListener(type: T, listener: EventListener_2): boolean; /** * 移除事件监听器 * @param type * @param listener */ removeEventListener(type: T, listener: EventListener_2): void; protected _points: (Vector2 | Vector3)[]; /** * 组成折线的点 * @remarks * 用于 point 事件 */ get points(): (Vector3 | Vector2)[]; set points(value: (Vector3 | Vector2)[]); protected _polyline?: CurvePath | null; /** * 折线 * @remarks * 通过 points 生成 或 直接设置; * 用于 point 事件 */ get polyline(): CurvePath | null | undefined; set polyline(value: CurvePath | null | undefined); protected _polylineLengths: number[]; /** * 折线中每个点的长度 * @remarks * 通过 polyline 生成 或 直接设置; * 用于 point 事件 */ get polylineLengths(): number[]; set polylineLengths(value: number[]); /** * 折线的总长度 */ get polylineLength(): number; /** * 折线的进度长度 * @remarks * 当前进度下的长度 */ get polylineProgressLength(): number; protected _pointsProgress: number[]; /** * 各个点的进度列表 * @remarks * 以均速计算 */ get pointsProgress(): number[]; set pointsProgress(value: number[]); /** * 获取当前进度下点的索引 */ get pointIndex(): number; protected lastGetProgress: number; protected lastGetPointIndex: number; /** * 获取点的索引 * @param progress * @returns */ getPointIndex(progress: number): number; protected _enablePointEvent: boolean; /** * 是否开启 point 相关的事件 */ get enablePointEvent(): boolean; set enablePointEvent(value: boolean); /** * 是否允许 point 相关的事件 */ get pointEventEnabled(): boolean; protected _enableKeyframeEvent: boolean; /** * 是否开启 point 相关的事件 */ get enableKeyframeEvent(): boolean; set enableKeyframeEvent(value: boolean); /** * 允许帧事件 */ get enableFrameEvent(): boolean; /** * 最后一次的关键帧 */ protected lastKeyframes: KeyframeInfos | null; /** * 最后一次的点索引 */ protected lastPolylineKeyframe: PolylineKeyframe | null; /** * 帧回调函数 */ protected frameFun: () => void; /** * 停止监听函数 */ protected _stopListenFun?: null | (() => void); /** * 停止监听的函数 */ protected get stopListenFun(): (() => void) | null | undefined; protected set stopListenFun(value: (() => void) | null | undefined); /** * 开始监听 */ startListen(): void; /** * 停止监听 */ stopListen(): void; /** * 自动开始监听 */ protected autoStartListen(): void; /** * 获取所有的监听器 */ get listeners(): { [type: string]: EventListener_2[]; } | null; /** * 是否有监听者 */ get hasListeners(): boolean; /** * 获取指定类型的所有监听者 */ getListeners(type: AnimationEventType): EventListener_2[]; /** * 销毁 * @param keepAction - 是否保留 action * @returns */ destroy(keepAction: boolean): void; } /** * 丰富了对 AnimationAction 的操作 */ export declare class AnimationActionOperate extends AnimationActionKeyframe { readonly isAnimationActionOperate = true; /** * 前进 * @param scale - 比例因子 */ forward(scale?: number | null): void; /** * 后退 * @param scale - 比例因子 */ backward(scale?: number | null): void; } export declare class AnimationClipCreator { /** * 全局选项 */ static readonly options: AnimationCreatorOptions; /** * 全局选项 */ get globalOptions(): AnimationCreatorOptions; protected _options: AnimationCreatorOptions | null; /** * 实例级别的选项 */ get options(): any; /** * 动画模式 * @remarks * - NormalAnimationBlendMode:绝对动画 * - AdditiveAnimationBlendMode:相对动画 * 全局的配置 * * @defaultValue NormalAnimationBlendMode */ get blendMode(): any; set blendMode(value: any); /** * 是否自动清除原来的关键帧数据 * @remarks * 每次生成关键帧轨道后(比如:创建clip 或 action 后),要不要自动清除关键帧数据; * 如果清除的关键帧数据,则以后再创建的 clip 或 action 将不会包含之前的动画; */ get autoClear(): any; set autoClear(value: any); /** * 是否要对重复的帧进行去重 * @remarks * 重复的帧指的是时间一样的帧 */ get deduplication(): any; set deduplication(value: any); /** * 各个轨道的配置项 */ get tracksConfig(): any; set tracksConfig(value: any); /** * 动画的名字 */ name?: string | null; /** * 动画的持续时间 * @remarks * 如果设置为空,则会自动根据关键帧轨道自动进行计算 * @defaultValue 自动计算 */ duration?: number | null; /** * 轨道的数据 */ readonly tracksData: Map[]>; /** * 清除所有的关键帧 */ clearKeyframes(): void; tracksChanged(): void; clipChanged(): void; protected _tracks?: KeyframeTrack[] | null; /** * 关键帧轨道 */ get tracks(): KeyframeTrack[]; /** * 获取属性对应的轨道配置 * @param property * @returns */ getTrackConfig(property: string): any; /** * 创建关键帧轨道 * @returns */ createTracks(): KeyframeTrack[]; protected _clip?: AnimationClip | null; /** * 获取 clip */ get clip(): AnimationClip; /** * 创建 clip * @param name * @param duration * @returns */ createClip(name?: string | null, duration?: number | null): AnimationClip; /** * 更新 clip * @param clip - 如果不传,则默认使用 this.clip * @returns */ updateClip(clip?: AnimationClip | null): AnimationClip; /** * 添加关键帧 * @param property * @param time * @param value */ addKeyframe(property: string, time: number, value: any[]): void; /** * 添加一组关键帧 * @param targetPath * @param time * @param propValueMap */ addKeyframes(targetPath: string, time: number, propValueMap: Record): void; /** * 添加位置帧 * @param time * @param value * @param targetPath - 动画属性前缀 */ addPosition(time: number, value: IVector3, targetPath?: string | null): void; /** * 添加四元数帧 * @param time * @param value * @param targetPath - 动画属性前缀 */ addQuaternion(time: number, value: IVector4, targetPath?: string | null): void; /** * 添加旋转帧 * @param time * @param value * @param targetPath - 动画属性前缀 */ addRotation(time: number, value: IEuler, targetPath?: string | null): void; /** * 添加绕x轴旋转的帧 * @param time * @param angle * @param targetPath - 动画属性前缀 */ addRotationX(time: number, angle: number, targetPath?: string | null): void; /** * 添加绕y轴旋转的帧 * @param time * @param angle */ addRotationY(time: number, angle: number, targetPath?: string | null): void; /** * 添加绕z轴旋转的帧 * @param time * @param angle * @param targetPath - 动画属性前缀 */ addRotationZ(time: number, angle: number, targetPath?: string | null): void; /** * 添加缩放关键帧 * @param time * @param value */ addScale(time: number, value: IVector3, targetPath?: string | null): void; /** * 添加颜色关键帧 * @param time * @param value * @param targetPath - 动画属性前缀 */ addColor(time: number, value: IColor, targetPath?: string | null): void; /** * 添加透明度关键帧 * @param time * @param value * @param targetPath - 动画属性前缀 */ addOpacity(time: number, value: number, targetPath?: string | null): void; /** * 添加贴图平移关键帧 * @param time * @param value * @param targetPath */ addMapOffset(time: number, value: IVector2, targetPath?: string | null, mapName?: string | null): void; /** * 添加没 u 方向的贴图平移关键帧 * @param time * @param value * @param targetPath */ addMapOffsetX(time: number, value: number, targetPath?: string | null, mapName?: string | null): void; /** * 添加没 v 方向的贴图平移关键帧 * @param time * @param value * @param targetPath */ addMapOffsetY(time: number, value: number, targetPath?: string | null, mapName?: string | null): void; /** * 添加贴图旋转中心的关键帧 * @param time * @param value * @param targetPath */ addMapCenter(time: number, value: IVector2, targetPath?: string | null, mapName?: string | null): void; /** * 添加贴图旋转中心的x坐标的的关键帧 * @param time * @param value * @param targetPath */ addMapCenterX(time: number, value: number, targetPath?: string | null, mapName?: string | null): void; /** * 添加贴图旋转中心的y坐标的的关键帧 * @param time * @param value * @param targetPath */ addMapCenterY(time: number, value: number, targetPath?: string | null, mapName?: string | null): void; /** * 添加贴图旋转角度的关键帧 * @param time * @param angle * @param targetPath */ addMapRotation(time: number, angle: number, targetPath?: string | null, mapName?: string | null): void; /** * 添加显示隐藏关键帧 * @param time * @param value * @param targetPath - 动画属性前缀 */ addVisible(time: number, value: boolean, targetPath?: string | null): void; } /** * 获取 AnimationClip 的动画的关键帧信息 */ export declare class AnimationClipKeyframe { readonly clip: AnimationClip; readonly isAnimationClipKeyframe = true; constructor(clip: AnimationClip); protected _tracksTimes: Float32Array[] | null; /** * 关键帧时间列表 */ get tracksTimes(): Float32Array[]; protected lastGetTime: number; protected lastGetKeyframeIndexs: number[]; /** * 获取指定时间对应的关键帧索引; * @param time * @returns */ getTracksKeyframeIndexs(time: number): number[]; /** * 获取所有轨道的关键帧 * @param time * @returns */ getTracksKeyframes(time: number): { index: number; value: number[] | null; }[]; } export declare interface AnimationCreatorOptions { /** * 动画模式 * @remarks * - NormalAnimationBlendMode:绝对动画 * - AdditiveAnimationBlendMode:相对动画 * 全局的配置 */ blendMode?: AnimationBlendMode | null; /** * 是否要对重复的帧进行去重 */ deduplication?: boolean | null; /** * 是否自动清除关键帧 */ autoClear?: boolean | null; /** * 各个轨道的配置项 * @remarks * 全局的配置 */ tracks: Record; } /** * 动画事件 */ declare interface AnimationEvent_2 { type: T; preFrame: Frame; frame: Frame; } export { AnimationEvent_2 as AnimationEvent } /** * 动画事件的基本类型 */ export declare enum AnimationEventBaseType { /** * 关键帧 * @remarks * 到达任意关键帧时都触发 */ keyframe = "keyframe", /** * 位置关键帧 * @remarks * 到达位置关键帧时触发 */ position = ".position", /** * 四元数关键帧 * @remarks * 到达四元数关键帧时触发 */ quaternion = ".quaternion", /** * 旋转关键帧 * @remarks * 到达旋转关键帧时触发 */ rotation = ".rotation", /** * 缩放关键帧 * @remarks * 到达缩放关键帧时触发 */ scale = ".scale", /** * 当动画完成一次循环时触发 */ loop = "loop", /** * 当动画完成时触发 */ finished = "finished", /** * 折线的点事件 */ point = "point" } /** * 动画事件的类型映射 */ declare type AnimationEventMap_2 = { keyframe: AnimationEvent_2<"keyframe", KeyframeInfos>; point: AnimationEvent_2<"point", PolylineKeyframe>; loop: AnimationLoopEvent; finished: AnimationFinishedEvent; } & { [T: string]: KeyframeInfo; }; export { AnimationEventMap_2 as AnimationEventMap } /** * 动画事件的类型 */ export declare type AnimationEventType = AnimationEventBaseType | string; /** * finished 类型的事件对象 */ export declare interface AnimationFinishedEvent { type: "finished"; action: AnimationActionKeyframe; direction: number; } /** * loop 类型的事件对象 */ export declare interface AnimationLoopEvent { type: "loop"; action: AnimationActionKeyframe; loopDelta: number; } /** * 动画操作 * @remarks * 对 AnimationAction 类的扩充 */ export declare type AnimationOperate = AnimationAction & AnimationActionOperate; export declare type BindChainSkeletalForModelOptions = BindChainSkeletalForModelOptions_Base & Omit; export declare interface BindChainSkeletalForModelOptions_Base { parent?: Object3D | null; skeleton: Skeleton; /** * 路径动画的目标是否是根骨骼 * @remarks * 骨骼路径动画可由两部分组成: * - 贴合路径的变形动画 * - 沿路径的位置和旋转动画 * 其中贴合路径的变形动画的动画目标一定是骨骼 bone,而沿路径的位置和旋转动画的动画目标可以是根骨骼 bone,也可以是目标对象(模型对象) */ posOnBone?: boolean | null; } /** * createBonePathAnimation 返回的结果的汇总类型 * * @typeParam Action 表示 action 的必选情况,如果为 true,action 是 AnimationAction 类型的对象,如果为 false,action 是 undefined,如果为 null,则 action 是 AnimationAction|undefined 类型 */ export declare interface BonePathAnimationInfo extends SkeletalModelInfo { /** * 动画剪辑对象 */ clip: AnimationClip; /** * 动画的 action 对象 */ action: Action extends true ? AnimationAction : (Action extends false ? undefined : AnimationAction | undefined); } /** * createBonePathAnimation 的完整选项 */ export declare type BonePathAnimationOptions = CreateBonePathAnimationOptions & CreateBonePathAnimationOptions_Base; /** * 为链式骨骼配置几何体的顶点权重 * @param options - 选项 * @returns 原来的 geometry */ /** * createChainSkinnedMesh 的选项 */ export declare interface ChainSkinnedMeshOptions extends CreateChainBonesOptions, ConfigVertexWeightOptions_Base { /** * 材质 */ material?: Material[] | Material | null; } /** * 以等分链的方式配置几何体的顶点权重 * @param options - 选项 * @returns 原来的 geometry */ export declare function configVertexWeightByEquallyDivided(options: ConfigVertexWeightByEquallyDividedOptions): BufferGeometry; /** * configVertexWeightByEquallyDivided 的选项 */ export declare type ConfigVertexWeightByEquallyDividedOptions = ConfigVertexWeightOptions_Base & EqualChainBoneOptions; /** * 为链式骨骼配置几何体的顶点权重 * @param options - 选项 * @returns 原来的 geometry */ export declare function configVertexWeightForChainBones(options: ConfigVertexWeightForChainBonesOptions): BufferGeometry; export declare type ConfigVertexWeightForChainBonesOptions = ConfigVertexWeightForChainBonesOptions_Base & ConfigVertexWeightForEqualChainBonesOptions; export declare interface ConfigVertexWeightForChainBonesOptions_Base { /** * 几何体的顶点的坐标系矩阵 */ geometryFrame?: Matrix4 | null; } /** * 为等分链骨骼配置几何体的顶点权重 * @param options - 选项 * @returns 原来的 geometry */ export declare function configVertexWeightForEqualChainBones(options: ConfigVertexWeightForEqualChainBonesOptions): BufferGeometry; /** * configVertexWeightForEqualChainBones 的选项 */ export declare interface ConfigVertexWeightForEqualChainBonesOptions extends ConfigVertexWeightOptions_Base { /** * 链式骨架 */ skeleton: Skeleton; /** * 几何体的顶点的坐标系矩阵 */ geometryFrame?: Matrix4 | null; } /** * 配置权重的基础选项 */ export declare interface ConfigVertexWeightOptions_Base { /** * 几何体 * @remarks * 被配置的目标 */ geometry: BufferGeometry; /** * 柔性系数 * @remarks * 取值范围:0 - 1 * @defaultValue 1 */ flexible?: number; } /** * 创建 AnimationAction 的操作集 * @param action * @returns */ export declare function createAnimationOperate(action: AnimationAction): AnimationOperate; /** * 创建骨骼路径动画 * @remarks * - 会将 model 及其子孙 mesh 转为 蒙皮网格 SkinnedMesh 对象并返回; * * - 不会改变原始 model * * - 创建的骨骼动画 AnimationClip 会添加到转换后的蒙皮网格对象上 * * 骨骼路径动画可由两部分组成: * - 贴合路径的变形动画 * - 沿路径的位置和旋转动画 * 其中贴合路径的变形动画的动画目标一定是骨骼 bone,而沿路径的位置和旋转动画的动画目标可以是根骨骼 bone,也可以是目标对象(模型对象) * * @param options */ export declare function createBonePathAnimation(options: CreateBonePathAnimationOptions & { mixer?: undefined | null; }): SkeletalModelInfo & CreateCurveAnimationClipReturn; /** * 创建骨骼路径动画 * @remarks * - 会将 model 及其子孙 mesh 转为 蒙皮网格 SkinnedMesh 对象并返回; * * - 不会改变原始 model * * - 创建的骨骼动画 AnimationClip 会添加到转换后的蒙皮网格对象上 * * - 会生成 AnimationAction * * - 创建的动画是对转换后的 蒙皮网格 进行动画的 * * * 骨骼路径动画可由两部分组成: * - 贴合路径的变形动画 * - 沿路径的位置和旋转动画 * 其中贴合路径的变形动画的动画目标一定是骨骼 bone,而沿路径的位置和旋转动画的动画目标可以是根骨骼 bone,也可以是目标对象(模型对象) * * @param options */ export declare function createBonePathAnimation(options: CreateBonePathAnimationOptions & { mixer: AnimationMixer; }): SkeletalModelInfo & CreateCurveAnimationClipReturn & { action: AnimationAction; }; /** * 创建骨骼路径动画 * @remarks * - 会将 model 及其子孙 mesh 转为 蒙皮网格 SkinnedMesh 对象并返回; * * - 不会改变原始 model * * - 创建的骨骼动画 AnimationClip 会添加到转换后的蒙皮网格对象上 * * - 如果传递了 mixer ,就会生成 AnimationAction * * - 创建的动画是对转换后的 蒙皮网格 进行动画的 * * 骨骼路径动画可由两部分组成: * - 贴合路径的变形动画 * - 沿路径的位置和旋转动画 * 其中贴合路径的变形动画的动画目标一定是骨骼 bone,而沿路径的位置和旋转动画的动画目标可以是根骨骼 bone,也可以是目标对象(模型对象) * * @param options */ export declare function createBonePathAnimation(options: CreateBonePathAnimationOptions & CreateBonePathAnimationOptions_Base): SkeletalModelInfo & CreateCurveAnimationClipReturn & { action?: AnimationAction; }; export declare type CreateBonePathAnimationOptions = CreateChainSkeletalModelOptions & Omit; /** * createBonePathAnimation 的额外选项 */ export declare interface CreateBonePathAnimationOptions_Base { /** * 动画混合器 * @remarks * 如果传传递了 mixer ,则 {@link createBonePathAnimation} 返回值中会包含 action,否则,则 {@link createBonePathAnimation} 返回值中不会包含 action */ mixer?: AnimationMixer | null; } /** * 创建链式骨骼 * @param options * @returns */ export declare function createChainBones(options: CreateChainBonesOptions): Bone[]; /** * 创建链式骨骼 * @remarks * 一个轴连接两个 `Bone`,(即:关切),所以 `start` 对应一个 `Bone`,每个轴对应一个骨骼 * @param options - 选项 * @returns 返回一个具有 axials.length + 1 个 Bone 的 数组 */ export declare function createChainBonesByAxials(options: CreateChainBonesOptionsByAxials): Bone[]; /** * 通过关节位置列表来创建链式骨骼 * @param joints - 关节的位置列表 * @returns 骨骼数组 */ export declare function createChainBonesByJoints(joints: Vector3[]): Bone[]; /** * 创建链式骨格的选项 */ export declare type CreateChainBonesOptions = Partial & Partial & { /** * 关节位置列表 */ joints?: Vector3[] | null; }; /** * 创建链式骨骼的公共选项 */ export declare interface CreateChainBonesOptions_Base { /** * 根骨骼的起始点 */ start?: Vector3 | null; } /** * createChainBones 的选项 */ export declare interface CreateChainBonesOptionsByAxials extends CreateChainBonesOptions_Base { /** * 所有骨骼的轴向量列表 */ axials: Vector3[]; } /** * 为指定的 模型 创建其对应的链式骨骼模型 * @param options * @returns 返回新的模型对象 */ export declare function createChainSkeletalModel(options: CreateChainSkeletalModelOptions): { model: Object3D; skeleton: Skeleton; rootBone: Bone; }; export declare type CreateChainSkeletalModelOptions = CreateChainSkeletalModelOptions_Base & CreateChainBonesOptions & Omit & Pick; export declare interface CreateChainSkeletalModelOptions_Base { /** * 模型对象 * @remarks * 可以是任意的 Object3D 对象,会对 model 及其子孙节点进行递归的 Object3D 级别的拷贝(会复用 geometry 和 material 对象); * 并会将所有的 Mesh 对象转为 SkinnedMesh */ target: Object3D; /** * 要绑定的骨架对象 */ skeleton?: Skeleton | null; } /** * 创建带有链式骨骼的蒙皮网格对象 * @param options - 选项 * @returns */ export declare function createChainSkinnedMesh(options: ChainSkinnedMeshOptions): SkinnedMesh, Material | Material[]>; /** * 为指定的 mesh 对象创建其对应的蒙皮网格对象 * @param options * @returns */ export declare function createChainSkinnedMeshForMesh(options: CreateChainSkinnedMeshForMeshOptions): SkinnedMesh, Material | Material[]>; export declare type CreateChainSkinnedMeshForMeshOptions = CreateChainSkinnedMeshForMeshOptions_Base & Omit & Omit; export declare interface CreateChainSkinnedMeshForMeshOptions_Base { target: Mesh; skeleton: Skeleton; } export declare function createCurveAnimationClip(options: CreateCurveAnimationClipByCurveOptions): CreateCurveAnimationClipReturn; export declare function createCurveAnimationClip(options: CreateCurveAnimationClipByPolylineOptions): CreateCurveAnimationClipReturn; export declare function createCurveAnimationClip(options: CreateCurveAnimationClipOptions): CreateCurveAnimationClipReturn; /** * 创建路径动画的选项 */ export declare type CreateCurveAnimationClip_Base = PathAnimationTimeOptions & CurveOptions; /** * 创建曲线路径动画 * @param options * @returns */ export declare function createCurveAnimationClipByCurve(options: CreateCurveAnimationClipByCurveOptions): { clip: AnimationClip; curveLength: number | undefined; lengths: number[] | undefined; }; /** * 动画选项 */ export declare type CreateCurveAnimationClipByCurveOptions = CreateCurveAnimationClipOptions_Base & CreateKeyframeTrackOptions; /** * 创建折线路径动画 * @param options * @returns */ export declare function createCurveAnimationClipByPolyline(options: CreateCurveAnimationClipByPolylineOptions): CreateCurveAnimationClipReturn; /** * 动画选项 */ export declare type CreateCurveAnimationClipByPolylineOptions = CreateCurveAnimationClipOptions_Base & CreateKeyframeTrackByPolylineOptions & SampleOptions; /** * 创建骨骼沿曲线路径运动的动画 * @remarks * 纯 Bone 动画方案,不会在 target 上生成动画数据; * 沿曲线的位置和旋转动画是通过 bone 的动画来完成的 * * @param name * @param options * @returns */ export declare function createCurveAnimationClipForBones(options: CreateCurveAnimationClipForBonesOptions): { clip: AnimationClip; curveLength: number | undefined; lengths: number[] | undefined; }; export declare type CreateCurveAnimationClipForBonesOptions = CreateCurveAnimationClipByCurveOptions & GetSampleDataForBones; /** * 创建骨骼沿曲线路径运动的动画 * @remarks * 会在 target 上生成沿曲线的位置和旋转动画,而变形动画由 骨骼来完成 * @param name * @param options * @returns */ export declare function createCurveAnimationClipForBonesTarget(options: CreateCurveAnimationClipForBonesOptions): { clip: AnimationClip; curveLength: number | undefined; lengths: number[] | undefined; }; /** * createCurveAnimationClip 的类型 */ export declare type CreateCurveAnimationClipOptions = Partial & Partial; /** * 动画的基础选项 */ export declare interface CreateCurveAnimationClipOptions_Base { /** * 动画的名字 */ name: string; /** * 是否平滑旋转 * * @remarks * 当开启此功能后,当沿折线转弯时会平滑处理 * * @defaultValue true */ smooth?: boolean | null; } export declare interface CreateCurveAnimationClipReturn { clip: AnimationClip; curveLength: number | undefined; lengths: number[] | undefined; } /** * 创建等分链式骨骼 * @param boneOpts - 等分链式骨骼的选项 * @returns 骨骼数组 */ export declare function createEqualChainBones(boneOpts: EqualChainBoneOptions): Bone[]; /** * 创建 AnimationAction 的操作集 * @param action * @returns */ export declare function createGuiAnimationController(action: AnimationAction): GuiAnimationController; /** * createKeyframeTracksOfCurveAnimationByPolyline 的选项 */ export declare type CreateKeyframeTrackByPolylineOptions = CreateKeyframeTrackOptions_Base & PathAnimationTimeOptions & GetKeyframeTransformDatasByPolylineOptions; export declare type CreateKeyframeTrackOptions = CreateKeyframeTrackOptions_Base & CreateCurveAnimationClip_Base & SampleOptions & Omit; /** * createKeyframeTracksOfCurveAnimationByPolyline 新增的、所特有的选项 */ export declare interface CreateKeyframeTrackOptions_Base { /** * 应用动画的目标对象的访问路径 * @remarks * 相对于根对象 * * @defaultValue null */ targetPath?: string | null; /** * 观看点的距离 * @remarks * 表示看向前方多远处的位置 * * @defaultValue 0 */ lookDistance?: number | null; } /** * 创建骨骼动画的关键帧轨道 * @remarks * 纯 Bone 动画方案,不会在 target 上生成动画数据 * * @param options * @returns */ export declare function createKeyframeTracksForBones(options: GetSampleDataForBones): { boneTracks: KeyframeTrack[][]; duration: number; curveLength: number | undefined; lengths: number[] | undefined; }; /** * 创建骨骼动画的关键帧轨道 * @remarks * 也会在 target 上生成位置和旋转动画 * * @param options * @returns */ export declare function createKeyframeTracksForBonesTarget(options: GetSampleDataForBones): { boneTracks: KeyframeTrack[][]; targetTracks: (VectorKeyframeTrack | QuaternionKeyframeTrack)[]; duration: number; curveLength: number | undefined; lengths: number[] | undefined; }; /** * 创建关键帧轨道 * @param options - 选项 * @param targetPath - 轨道被应用的目标对象的路径 * @returns */ export declare function createKeyframeTracksOfCurveAnimation(options: CreateKeyframeTrackOptions): { keyframeTracks: KeyframeTrack[]; duration: number; curveLength: number | undefined; lengths: number[] | undefined; }; /** * 创建折线路径的关键帧轨道 * @param options - 选项 * @returns */ export declare function createKeyframeTracksOfCurveAnimationByPolyline(options: CreateKeyframeTrackByPolylineOptions): { keyframeTracks: KeyframeTrack[]; duration: number; lengths: number[]; curveLength: number; }; /** * 曲线选项 */ export declare interface CurveOptions { /** * 路径 * @remarks * 用来描述路径的曲线 */ curve: Curve; } /** * 等分链式骨骼选项 */ export declare interface EqualChainBoneOptions extends CreateChainBonesOptions_Base { /** * 单个骨骼的轴向量 * @remarks * 该向量的方向会作为骨骼的方向,向量的长度会作为骨骼的长度 */ axial: Vector3; /** * 骨骼的数量 */ number: number; } /** * 获取所有的根骨骼 * @param bones - 骨骼数组 * @returns */ export declare function getAllRootBones(bones: Bone[]): Bone[]; /** * 获取最近的连续索引 * @param closestIndexs - 按距离从近到远排序的索引列表 * @param count - 连续索引的个数 */ export declare function getClosestContinuousIndexes(closestIndexs: number[], options?: GetClosestContinuousIndexesOptions | null): number[]; export declare interface GetClosestContinuousIndexesOptions { /** * 连续索引的个数 */ count?: number; /** * 连续索引中允许的最小索引 */ min?: number; /** * 连续索引中允许的最大索引 */ max?: number; } /** * 获取所有的连续数列 * @param nums - 数字列表 * @param maxInterval - 最大间隔;当两个数之间的距离大于这个值时,就认为这两个数不连续 * @returns 所有的连续数列 */ export declare function getContinuousNumsList(nums: number[], maxInterval?: number): number[][]; /** * 获取曲线的分段数据的基本选项 */ export declare interface GetDivisionDataOptions_Base extends CurveOptions { /** * 动画的持续时间 * @remarks * `duration` 和 `speed` 只需要指定其一;优先 duration */ duration: number; } /** * 获取曲线的分段数据的选项 */ export declare interface GetDivisionsDataOptions extends GetDivisionDataOptions_Base { /** * 分隔的段数 * @remarks * 要将曲线划分为的分段数 */ division: number; } /** * 获取路径动画对象的持续时间 * @param options - 选项 * @returns */ export declare function getDurationOfPathAnimationOptions(options: PathAnimationTimeOptions, length?: number): number; /** * 获取第一个根骨骼 * @param bones - 骨骼数组 * @returns */ export declare function getFirstRootBone(bones: Bone[]): Bone | undefined; /** * 获取目标沿运行运行的关键帧变换数据 * @param options * @returns */ export declare function getKeyframeTransformDatas(options: GetKeyframeTransformDatasOptions): { rotates: Quaternion[]; points: Vector3[]; curveLength: number | undefined; lengths: number[] | undefined; }; /** * 获取目标沿运行运行的关键帧变换数据 * @param options * @param lines - 折线的线段列表,用于减少计算; * @returns */ export declare function getKeyframeTransformDatasByPolyline(options: GetKeyframeTransformDatasByPolylineOptions, lines?: Line3[]): { rotates: Quaternion[]; points: Vector3[]; rotateTimes: number[]; pointTimes: number[]; }; /** * getKeyframeTransformDatasByPolyline 的选项 */ export declare type GetKeyframeTransformDatasByPolylineOptions = GetKeyframeTransformDatasByPolylineOptions_Base & PolylineOptions; export declare interface GetKeyframeTransformDatasByPolylineOptions_Base extends Omit { /** * 时间列表 */ times: number[]; } /** * getKeyframeTransformDatas 的选项 */ export declare type GetKeyframeTransformDatasOptions = GetKeyframeTransformDatasOptionsByCurve_Base & CurveOptions; /** * getKeyframeTransformDatas 的基础选项 */ export declare interface GetKeyframeTransformDatasOptions_Base { /** * 目标对象 * @remarks * 需要让哪个目标沿着曲线路径运行 */ target?: Object3D | null; /** * 表示目标对象在运动时的前方方向的向量 * @remarks * 该向量是目标对象局部坐标系下向量 * * 需要旋转数据时才需要 * * @defaultValue 默认曲线起始处的切线方向 */ front?: Vector3 | null; /** * 是否需要获取位置信息 * @defaultValue true */ position?: boolean | null; /** * 是否需要获取旋转信息 * @defaultValue true */ rotate?: boolean | null; /** * 是否启用up * @remarks * 启用 up 后,旋转时会考虑 up 方向 */ enableUp?: boolean | null; /** * 是否固定 up 方向 * @remarks * 默认情况下,会优先 front 方向,然后在 front 方向的基础上再调整 up 方向; * 如果 fixUp 为 true,则会优先保证 up 方向,然后再调整 front 方向 */ fixUp?: boolean | null; /** * 局部坐标系下 up 方向的向量 * @remarks * target 的局部坐标系 */ up?: Vector3 | null; /** * 锚点 * @remarks * 目标对象上局部坐标系下的一个位置,该位置会始终在曲线上;即让目标对象上的哪个位置沿曲线路径进行动画 * * @defaultValue 局部坐标系的原点 */ anchor?: Vector3 | null; /** * 观看点相关的选项 * @remarks * 观看点表示看向前方多远处的位置;默认是 0 * * 需要旋转数据时才需要 */ lookPoint?: LookPointOptionsOfKeyframes; } export declare interface GetKeyframeTransformDatasOptionsByCurve_Base extends GetKeyframeTransformDatasOptions_Base { /** * t的列表 * @remarks * ts 和 us 只需要指定其一;优先 ts; */ ts?: number[]; /** * u的列表 * @remarks * ts 和 us 只需要指定其一;优先 ts; */ us?: number[]; } /** * 获取根骨骼 * @remarks * 与 {@link getFirstRootBone} 的区别是如果没有找到真正的根骨骼,它会返回 bones[0] 作为 骨骼的根骨骼 * @param bones - 骨骼数组 * @returns */ export declare function getRootBone(bones: Bone[]): Bone; /** * 获取骨骼的采样数据的基本选项 */ export declare interface GetSampleDataForBones extends Omit { skeleton: Skeleton; /** * 可伸缩的 */ stretch?: boolean | null; /** * 距离容差因子 * @remarks * 取值为范围为 [0-1] * 容差范围 = 距离容差因子 * 距离 * 在容差范围呢视为等距 * * @defaultValue 0.1 */ tolerance?: number; } /** * 获取骨骼动画的采样数据 * @remarks * 纯 Bone 动画方案,不会在 target 上生成动画数据 * * @param options */ export declare function getSampleDataForBones(options: GetSampleDataForBones): { times: number[]; boneSampleDatas: { points: Vector3[]; rotates: Quaternion[]; us: number[]; matrixs: Matrix4[]; }[]; duration: number; curveLength: number | undefined; lengths: number[] | undefined; }; /** * 获取骨骼动画的采样数据 * @remarks * 也会在 target 上生成位置和旋转动画 * * @param options */ export declare function getSampleDataForBonesTarget(options: GetSampleDataForBones): { times: number[]; boneSampleDatas: { points?: Vector3[] | undefined; rotates: Quaternion[]; us: number[]; matrixs: Matrix4[]; }[]; targetSampleDatas: { points: Vector3[]; rotates: Quaternion[]; matrixs: Matrix4[]; }; duration: number; curveLength: number | undefined; lengths: number[] | undefined; }; /** * 获取分段的时间列表 * @remarks * 假设沿曲线均速运动 * * @param options * @returns */ export declare function getTimes(options: GetDivisionsDataOptions): number[]; /** * 获取分段的 t 列表 * @param division - 分段 * @returns */ export declare function getTS(division: number): number[]; /** * 用于 Gui 的AnimationAction 的控制器 * @remarks * 会在 action 变换时重置gui */ export declare class GuiAnimationActionController extends AnimationActionController { guis: GUI[]; /** * 全局的 gui 更新回调 * @param gui */ static updateGUI: typeof updateGUI_default; protected _updateGUI?: UpdateGUI | null; /** * gui 的更新回调 * @defaultValue updateGUI_default */ get updateGUI(): typeof updateGUI_default; set updateGUI(value: typeof updateGUI_default); get action(): AnimationOperate | null | undefined; set action(value: AnimationOperate | null | undefined); protected updateAllGUI(): void; constructor(action?: AnimationAction | null, guis?: GUI[]); } export declare type GuiAnimationController = GuiAnimationActionController & AnimationOperate; declare interface IColor { r: number; g: number; b: number; } declare interface IEuler extends IVector3 { order?: EulerOrder; } /** * 关键帧 */ declare interface Keyframe_2 { time: number; value: V[]; } export { Keyframe_2 as Keyframe } /** * 关键帧 */ export declare type KeyframeInfo = ReturnType[number]; /** * 关键帧集合 */ export declare type KeyframeInfos = { [name: string]: KeyframeInfo; }; export declare interface LookPointOptions { /** * 观看点的距离 * @remarks * 表示看向前方多远处的位置 */ distance?: number | null; /** * 曲线总长度 */ curveLength?: number | null; } export declare interface LookPointOptionsOfKeyframes extends LookPointOptions { /** * 各个关键点位置片的长度 * @remarks * 只有需要计算 {@link GetKeyframeTransformDatasOptions.lookPoint} 时才需要,但也不是必须的; * * 在需要该选项时,传递该选项可以节约计算 */ lengths?: number[]; } /** * 路径动画时间选项 */ export declare interface PathAnimationTimeOptions { /** * 动画的持续时间 * @remarks * `duration` 和 `speed` 只需要指定其一;优先 duration */ duration?: number; /** * 动画的速度 * @remarks * `duration` 和 `speed` 只需要指定其一; */ speed?: number; } /** * 折线的关键帧 */ export declare interface PolylineKeyframe { index: number; value: Vector2 | Vector3; length: number; } /** * 折线选项 */ export declare interface PolylineOptions { /** * 描述拆线路径的顶点列表 */ points: Vector3[]; } /** * 渲染循环 * @param frameFun * @returns 返回一个函数,调用该函数会停止渲染循环 */ export declare function renderLoop(frameFun: (time: DOMHighResTimeStamp) => void): () => void; /** * createChainSkeletalModel 返回值的类型 */ export declare type SkeletalModelInfo = ReturnType; /** * 关键帧轨道的配置 */ export declare interface TrackConfig { /** * 关键帧轨道的值类型的名字 */ valueTypeName?: ValueTypeNames | null; /** * 关键帧轨道的值的数组类型 */ ValueBufferType?: ClassType | ArrayBufferLike> | null; /** * 插件类型 */ DefaultInterpolation?: InterpolationModes | null; } /** * 常用的轨道属性 */ export declare enum TrackProperty_Common { /** * 位置 */ position = ".position", /** * 四元数 */ quaternion = ".quaternion", /** * 绕x旋转 */ rotationX = ".rotation[x]", /** * 绕x旋转 */ rotationY = ".rotation[y]", /** * 绕x旋转 */ rotationZ = ".rotation[z]", /** * 缩放 */ scale = ".scale", /** * 颜色 */ color = ".material.color", /** * 纹理映射偏移 * @privateRemarks * .material[map].offset */ textureOffset = "].offset", /** * 纹理映射没u方向的偏移 * @privateRemarks * .material[map].offset[x] */ textureOffsetX = "].offset[x]", /** * 纹理映射没v方向的偏移 * @privateRemarks * .material[map].offset[y] */ textureOffsetY = "].offset[y]", /** * 纹理映射旋转中心 * @privateRemarks * .material[map].center */ textureCenter = "].center", /** * 纹理映射旋转中心的x坐标 * @privateRemarks * .material[map].center[x] */ textureCenterX = "].center[x]", /** * 纹理映射旋转中心的y坐标 * @privateRemarks * .material[map].center[y] */ textureCenterY = "].center[y]", /** * 纹理映射旋转 * @privateRemarks * .material[map].rotation */ textureRotation = "].rotation", /** * 透明度 */ opacity = ".material[opacity]", /** * 显示隐藏 */ visible = ".visible" } /** * TrackProperty_Common 的方法 */ export declare namespace TrackProperty_Common { /** * 获取材质的 map 成员的轨道属性 * @param mapPropName - 材质中 map 的属性名字 * @param targetPath * @param textureProp - TrackProperty_Common 中纹理贴图的属性常量 * @returns */ export function getMaterialMapTrackProperty(textureProp: TrackProperty_Common, targetPath?: string | null, mapPropName?: string | null): string; /** * 获取完整的轨道属性 * @param propCommon * @param targetPath * @param mapPropName * @returns */ export function getTrackProperty(propCommon: TrackProperty_Common, targetPath?: string | null, mapPropName?: string | null): string; } export declare type UpdateGUI = (gui: any) => void; /** * 默认的 gui更新回调 * @param gui */ declare function updateGUI_default(gui: any): void; /** * 值类型的名字 */ export declare enum ValueTypeNames { bool = "bool", number = "number", color = "color", quaternion = "quaternion", string = "string", vector = "vector" } export { }