Example
Aspose.3D 动画系统围绕一层层对象层级组织,这些对象将时间采样数据绑定到场景属性上。.
- Example
AnimationClip 是一个具名的播放范围(例如“Walk”,“Run”),由 a Scene. - Example
AnimationNode 存在于剪辑内部,并将动画数据绑定到场景对象的特定属性上。. - 一个
BindPoint 连接一个 AnimationNode 到一个具名的 Property 在一个 A3DObject. - Example
AnimationChannel 保存一个标量 KeyframeSequence 在绑定点内。. - 一个
KeyframeSequence 是一个有序列表,包含 KeyFrame 时间‑数值样本。.
所有动画类都位于 aspose.threed.animation 子包中,尽管它们也可以直接从 aspose.threed.
AnimationClip
一个用于单个播放范围的具名容器。一个 Scene 可以容纳多个剪辑。继承自 SceneObject.
Example
| Example | Example |
|---|
AnimationClip(name=None) | 创建一个带可选名称的剪辑 |
Example
| Example | Example | Example |
|---|
name | str | 剪辑名称(例如. "Walk") |
description | str | 可选描述 |
start | float | 开始时间(秒) |
stop | float | 结束时间(秒) |
animations | list[AnimationNode] | 此剪辑中动画节点的只读列表 |
properties | PropertyCollection | 自定义属性 |
Example
| Example | 返回类型 | Example |
|---|
create_animation_node(node_name) | AnimationNode | 创建并注册一个新的 AnimationNode 在此剪辑中 |
AnimationNode
绑定一个 AnimationClip 到一个或多个 BindPoint 对象,目标为场景对象属性。继承自 A3DObject.
Example
| Example | Example |
|---|
AnimationNode(name=None) | 创建一个带可选名称的动画节点 |
Example
| Example | Example | Example |
|---|
name | str | 节点名称 |
bind_points | list[BindPoint] | 绑定点的只读列表 |
sub_animations | list[AnimationNode] | 子动画节点的只读列表 |
properties | PropertyCollection | 自定义属性 |
Example
| Example | 返回类型 | Example |
|---|
find_bind_point(target, name) | `BindPoint | None` |
get_bind_point(target, prop_name, create) | `BindPoint | None` |
create_bind_point(obj, prop_name) | `BindPoint | None` |
get_keyframe_sequence(target, prop_name, channel_name, create) | `KeyframeSequence | None` |
BindPoint
连接一个 AnimationNode 到单个 Property 在一个 A3DObject.。每个 BindPoint 可以容纳多个 AnimationChannel 对象(每个标量组件一个)。 A3DObject.
Example
| Example | Example | Example |
|---|
property | Property | 继承自 |
channels_count | int | 此绑定点所针对的场景对象属性 |
Example
| Example | 此绑定点中的动画通道数量 | Example |
|---|
add_channel(name, value, type=None) | bool | 返回类型 |
get_channel(channel_name) | `AnimationChannel | None` |
get_keyframe_sequence(channel_name) | `KeyframeSequence | None` |
create_keyframe_sequence(name) | KeyframeSequence | 返回指定通道的关键帧序列 KeyframeSequence 创建一个新的 |
bind_keyframe_sequence(channel_name, sequence) | None | 关联一个已有的 KeyframeSequence 与通道 |
reset_channels() | None | 移除所有通道 |
AnimationChannel
保存单个标量 KeyframeSequence 用于一个动画组件。.
Example
| Example | Example | Example |
|---|
name | str | 通道名称(例如. "X", "Y", "Z") |
default_value | Any | 当不存在关键帧数据时使用的值 |
keyframe_sequence | `KeyframeSequence | None` |
KeyframeSequence
有序列表 KeyFrame 单一标量通道的样本。继承自 A3DObject.
Example
| Example | Example |
|---|
KeyframeSequence(name=None) | 创建一个空的关键帧序列 |
Example
| Example | Example | Example |
|---|
name | str | 序列名称 |
key_frames | list[KeyFrame] | 按时间顺序的只读关键帧列表 |
pre_behavior | Extrapolation | 第一个关键帧之前的行为 |
post_behavior | Extrapolation | 最后一个关键帧之后的行为 |
bind_point | `BindPoint | None` |
Example
| Example | 返回类型 | Example |
|---|
add(time, value, interpolation=Interpolation.LINEAR) | None | 在…处追加关键帧 time (秒),使用给定的 value 和 interpolation 模式 |
reset() | None | 清除所有关键帧并重置前后行为 |
KeyFrame
在 a 中的单个时间值样本 KeyframeSequence.
Example
KeyFrame 对象由内部创建 KeyframeSequence.add(); 请勿直接构造它们。.
Example
| Example | Example | Example |
|---|
time | float | 时间位置(秒) |
value | float | 此时的动画值 |
interpolation | Interpolation | 在此关键帧与下一个关键帧之间应用的插值模式 |
tangent_weight_mode | WeightedMode | 切线权重模式(贝塞尔曲线) |
step_mode | StepMode | 步进行为 (PREVIOUS_VALUE 或 NEXT_VALUE) |
next_in_tangent | `Vector2 | None` |
out_tangent | `Vector2 | None` |
out_weight | float | 出射切线权重 |
next_in_weight | float | 入射切线权重 |
tension | float | 张力参数(TCB 样条) |
continuity | float | 连续性参数(TCB 样条) |
bias | float | 偏置参数(TCB 样条) |
independent_tangent | bool | Example True, 入射和出射切线相互独立 |
flat | bool | Example True, 切线被限制为平坦 |
time_independent_tangent | bool | Example True, 切线方向独立于时间缩放 |
Example
控制在连续关键帧之间的数值插值方式。.
| Example | Example |
|---|
CONSTANT | Example |
LINEAR | 数值之间的线性插值 |
BEZIER | 使用进/出切线的三次贝塞尔 |
B_SPLINE | 均匀 B 样条 |
CARDINAL_SPLINE | Cardinal 样条 |
TCB_SPLINE | 张力–连续性–偏置样条 |
Example
控制在首帧和尾帧之外的动画行为。.
| Example | Example |
|---|
CONSTANT | 保持边界值 |
GRADIENT | 在边界关键帧的切线梯度处外推 |
CYCLE | 重复关键帧范围(循环) |
CYCLE_RELATIVE | 以累计偏移重复(相对于结束值) |
OSCILLATE | 乒乓(交替正向和反向重复) |
Example
另见