import type { AnimationAction, AnimationMixer, Skeleton } from "three"; import { KeyframeTrack, AnimationClip, Matrix4, Quaternion, QuaternionKeyframeTrack, Vector3, VectorKeyframeTrack } from "three"; import type { CreateCurveAnimationClipByCurveOptions, CreateKeyframeTrackOptions, CreateCurveAnimationClipReturn } from "./path-animation"; import type { CreateChainSkeletalModelOptions, SkeletalModelInfo } from "./chain-bone"; /** * createBonePathAnimation 的额外选项 */ export interface CreateBonePathAnimationOptions_Base { /** * 动画混合器 * @remarks * 如果传传递了 mixer ,则 {@link createBonePathAnimation} 返回值中会包含 action,否则,则 {@link createBonePathAnimation} 返回值中不会包含 action */ mixer?: AnimationMixer | null; } export type CreateBonePathAnimationOptions = CreateChainSkeletalModelOptions & Omit; /** * createBonePathAnimation 的完整选项 */ export type BonePathAnimationOptions = CreateBonePathAnimationOptions & CreateBonePathAnimationOptions_Base; /** * createBonePathAnimation 返回的结果的汇总类型 * * @typeParam Action 表示 action 的必选情况,如果为 true,action 是 AnimationAction 类型的对象,如果为 false,action 是 undefined,如果为 null,则 action 是 AnimationAction|undefined 类型 */ export interface BonePathAnimationInfo extends SkeletalModelInfo { /** * 动画剪辑对象 */ clip: AnimationClip; /** * 动画的 action 对象 */ action: Action extends true ? AnimationAction : (Action extends false ? undefined : AnimationAction | undefined); } /** * 创建骨骼路径动画 * @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 type CreateCurveAnimationClipForBonesOptions = CreateCurveAnimationClipByCurveOptions & GetSampleDataForBones; /** * 创建骨骼沿曲线路径运动的动画 * @remarks * 纯 Bone 动画方案,不会在 target 上生成动画数据; * 沿曲线的位置和旋转动画是通过 bone 的动画来完成的 * * @param name * @param options * @returns */ export declare function createCurveAnimationClipForBones(options: CreateCurveAnimationClipForBonesOptions): { clip: AnimationClip; curveLength: number | undefined; lengths: number[] | undefined; }; /** * 创建骨骼动画的关键帧轨道 * @remarks * 纯 Bone 动画方案,不会在 target 上生成动画数据 * * @param options * @returns */ export declare function createKeyframeTracksForBones(options: GetSampleDataForBones): { boneTracks: KeyframeTrack[][]; duration: number; curveLength: number | undefined; lengths: number[] | undefined; }; /** * 获取骨骼的采样数据的基本选项 */ export 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 name * @param options * @returns */ export declare function createCurveAnimationClipForBonesTarget(options: CreateCurveAnimationClipForBonesOptions): { clip: AnimationClip; 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; }; /** * 获取骨骼动画的采样数据 * @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; }; //# sourceMappingURL=bone-animation.d.ts.map