ThingOrigin.js
    Preparing search index...

    Class TAnimate

    用于制作模型动画

    Index

    Methods

    • 将两个模型关联在一起(子随父)

      Parameters

      • parent: Object3D

        父模型

      • child: Object3D

        子模型

      Returns void

    • 将child模型关联至parent模型中(官网版)

      Parameters

      • child: Object3D

        子模型

      • parent: Object3D

        父模型

      • Optionalparent_parent: Object3D

        父模型的父模型(如果没有则传null)

      Returns void

    • 模型透明度动画效果

      Parameters

      • model: Object3D

        模型

      • startOpacity: number

        开始透明度(0-1),相对于原始透明度的比例

      • endOpacity: number

        结束透明度(0-1),相对于原始透明度的比例

      • time: number

        完成时间(毫秒)

      • OptionalonFinish: () => void

        完成回调

      Returns void

      // 淡入:从完全透明到完全不透明
      TO.animate.modelOpacity(model, 0, 1, 1000);
      // 淡出:从完全不透明到完全透明
      TO.animate.modelOpacity(model, 1, 0, 1000);
      // 从半透明到完全不透明
      TO.animate.modelOpacity(model, 0.5, 1, 1000);
    • 间补平移动画

      Parameters

      • model: Object3D

        模型

      • axis: Vector3 | xyz | "x" | "y" | "z"

        局部坐标轴:'x'|'y'|'z' 或 Vector3/xyz 方向

      • from: number

        从哪个位置开始

      • to: number

        到哪个位置停止

      • time: number

        完成时间(毫秒)

      • mode: string = 'linear'

        缓动模式

      • OptionalonFinish: () => void

        完成回调

      Returns Tween<any>

    • 解除关联模型

      Parameters

      • parent: Object3D

        父模型

      • child: Object3D

        子模型

      Returns void

    • Parameters

      • model: Object3D

        模型

      • axis: Vector3 | xyz | "x" | "y" | "z"

        旋转轴

      • from: number

        开始位置

      • to: number

        结束位置

      • time: number

        完成时间 (毫秒)

      • correct: number = 0

        纠正角度

      • unit: "rad" | "deg" = 'rad'

        角度单位 ('rad' | 'deg')

      • mode: string = 'linear'

        缓动模式(默认linear匀速运动)

      • OptionalonFinish: () => void

        完成回调

      Returns Tween<any>

      返回 Tween 对象

      绕着指定轴旋转(动画)

      2025/12/31

    • 绕指定中心点旋转模型

      Parameters

      • model: Object3D

        要旋转的模型

      • axis: Vector3 | xyz | "x" | "y" | "z"

        旋转轴 ('x' | 'y' | 'z') 或 Vector3(任意轴)

      • pivot: Vector3

        旋转中心点

      • from: number

        开始位置

      • to: number

        结束位置

      • time: number

        完成时间 (毫秒)

      • correct: number = 0

        纠正角度

      • unit: "rad" | "deg" = 'rad'

        角度单位 ('rad' | 'deg')

      • coordinateType: "world" | "local" = 'local'

        坐标类型:'local' 表示局部坐标,'world' 表示世界坐标,默认为 'local'

      • OptionalonFinish: () => void

        完成回调

      Returns void

    • 瞬时设定位移(setModel 用),axis 规则与 move 一致

      Parameters

      • model: Object3D
      • axis: Vector3 | xyz | "x" | "y" | "z"
      • value: number

      Returns void

    • 设置旋转姿态(无动画)

      Parameters

      • model: Object3D

        模型

      • axis: Vector3 | xyz | "x" | "y" | "z"

        旋转轴

      • value: number

        旋转角度

      • correct: number = 0

        纠正角度

      • unit: "rad" | "deg" = 'rad'

      Returns void

    • 瞬时绕 pivot 旋转(setModel 用),规则与 rotatePivot 一致

      Parameters

      • model: Object3D
      • axis: Vector3 | xyz | "x" | "y" | "z"
      • pivot: Vector3
      • value: number
      • unit: "rad" | "deg" = 'rad'
      • coordinateType: "world" | "local" = 'local'

      Returns void

    • 设置模型的旋转中心点

      Parameters

      • model: Object3D
      • OptionalpivotPoint: Vector3

        旋转中心点

      • coordinateType: "world" | "local" = 'local'

        坐标类型:'local' 局部坐标,'world' 世界坐标,默认为 'local'

      Returns Object3D

      返回包装后的 Group 对象,多次调用会更新旋转中心而不是重新创建

      // 使用局部坐标设置旋转中心(模型底部)
      animate.setRotationPivot(model, new Vector3(0, -10, 0), 'local')
      // 使用世界坐标设置旋转中心
      animate.setRotationPivot(model, new Vector3(100, 0, 200), 'world')
      // 多次调用更新旋转中心
      animate.setRotationPivot(model, new Vector3(200, 0, 300), 'world')

    Properties

    motionMap: Map<string, EasingFunction> = ...
    属性 说明
    运动模式列表 直线、跳动