Animation — Aspose.3D FOSS for Python API Reference

Example

Aspose.3D アニメーションシステムは、時間サンプリングされたデータをシーンプロパティにバインドするオブジェクトの階層で構成されています。.

  • Example AnimationClip は、名前付きの再生範囲(例:「Walk」「Run」)で、…が保持する Scene.
  • Example AnimationNode はクリップ内に存在し、アニメーションデータをシーンオブジェクトの特定のプロパティにバインドします。.
  • A BindPoint は…を接続します AnimationNode を名前付きの Property 上の A3DObject.
  • Example AnimationChannel は単一のスカラーを保持します KeyframeSequence バインドポイント内で。.
  • A KeyframeSequence は…の順序付けられたリストです KeyFrame 時間–値サンプルです。.

すべてのアニメーションクラスは aspose.threed.animation サブパッケージにありますが、直接からもアクセス可能です aspose.threed.

from aspose.threed.animation import (
    AnimationClip,
    AnimationNode,
    AnimationChannel,
    BindPoint,
    KeyFrame,
    KeyframeSequence,
    Interpolation,
    ExtrapolationType,
)

AnimationClip

1つの再生範囲用の名前付きコンテナ。A Scene 複数のクリップを保持できます。継承元は SceneObject.

Example

ExampleExample
AnimationClip(name=None)オプションの名前でクリップを作成します

Example

ExampleExampleExample
namestrクリップ名(例:. "Walk")
descriptionstrオプションの説明
startfloat開始時間(秒)
stopfloat終了時間(秒)
animationslist[AnimationNode]このクリップ内のアニメーションノードの読み取り専用リスト
propertiesPropertyCollectionカスタムプロパティ

Example

Example戻り値の型Example
create_animation_node(node_name)AnimationNode新しいものを作成し、登録します AnimationNode このクリップ内で

AnimationNode

バインドします AnimationClip 1つまたは複数の BindPoint シーンオブジェクトのプロパティを対象とするオブジェクト。継承元は A3DObject.

Example

ExampleExample
AnimationNode(name=None)オプションの名前でアニメーションノードを作成します

Example

ExampleExampleExample
namestrノード名
bind_pointslist[BindPoint]バインドポイントの読み取り専用リスト
sub_animationslist[AnimationNode]子アニメーションノードの読み取り専用リスト
propertiesPropertyCollectionカスタムプロパティ

Example

Example戻り値の型Example
find_bind_point(target, name)`BindPointNone`
get_bind_point(target, prop_name, create)`BindPointNone`
create_bind_point(obj, prop_name)`BindPointNone`
get_keyframe_sequence(target, prop_name, channel_name, create)`KeyframeSequenceNone`

BindPoint

接続します AnimationNode 単一の Property 上の A3DObject.。各 BindPoint 複数保持できる AnimationChannel オブジェクト(スカラーコンポーネントごとに1つ)。継承元は A3DObject.

Example

ExampleExampleExample
propertyPropertyこのバインドポイントが対象とするシーンオブジェクトのプロパティ
channels_countintこのバインドポイントにおけるアニメーションチャンネルの数

Example

Example戻り値の型Example
add_channel(name, value, type=None)boolデフォルト値を持つ名前付きチャンネルを追加する
get_channel(channel_name)`AnimationChannelNone`
get_keyframe_sequence(channel_name)`KeyframeSequenceNone`
create_keyframe_sequence(name)KeyframeSequence新しいものを作成する KeyframeSequence このバインドポイント用の
bind_keyframe_sequence(channel_name, sequence)None既存のものを関連付ける KeyframeSequence チャネル付き
reset_channels()Noneすべてのチャネルを削除します

AnimationChannel

単一のスカラーを保持します KeyframeSequence 1つのアニメーションコンポーネント用です。.

Example

ExampleExampleExample
namestrチャネル名(例:. "X", "Y", "Z")
default_valueAnyキーフレームデータが存在しない場合に使用される値
keyframe_sequence`KeyframeSequenceNone`

KeyframeSequence

順序付けられたリスト KeyFrame 単一スカラー チャネルのサンプル。継承元は A3DObject.

Example

ExampleExample
KeyframeSequence(name=None)空のキーフレームシーケンスを作成します

Example

ExampleExampleExample
namestrシーケンス名
key_frameslist[KeyFrame]時系列順のキーフレームの読み取り専用リスト
pre_behaviorExtrapolation最初のキーフレームの前の動作
post_behaviorExtrapolation最後のキーフレームの後の動作
bind_point`BindPointNone`

Example

Example戻り値の型Example
add(time, value, interpolation=Interpolation.LINEAR)Noneキーフレームを次の位置に追加 time (秒)で、指定された value および interpolation モード
reset()Noneすべてのキーフレームをクリアし、前後の動作をリセットします

KeyFrame

単一の時間‑値サンプル KeyframeSequence.

Example

KeyFrame オブジェクトは内部で作成されます KeyframeSequence.add(); 直接構築しないでください。.

Example

ExampleExampleExample
timefloat秒単位の時間位置
valuefloatこの時点のアニメーション値
interpolationInterpolationこのキーフレームと次のキーフレームの間に適用される補間モード
tangent_weight_modeWeightedMode接線ウェイトモード(ベジェ曲線)
step_modeStepModeステップ動作(PREVIOUS_VALUE または NEXT_VALUE)
next_in_tangent`Vector2None`
out_tangent`Vector2None`
out_weightfloat出力接線ウェイト
next_in_weightfloat入力接線の重み
tensionfloatテンションパラメータ(TCBスプライン)
continuityfloat連続性パラメータ(TCBスプライン)
biasfloatバイアスパラメータ(TCBスプライン)
independent_tangentboolExample True, インとアウトの接線は独立しています
flatboolExample True, 接線はフラットにクランプされます
time_independent_tangentboolExample True, 接線方向は時間スケーリングに依存しません

Example

連続するキーフレーム間で値がどのように補間されるかを制御します。.

ExampleExample
CONSTANTExample
LINEAR値間の線形補間
BEZIERイン/アウト接線を使用したキュービックベジェ
B_SPLINE均一Bスプライン
CARDINAL_SPLINEカーディナルスプライン
TCB_SPLINEテンション–コンティニュイティ–バイアス スプライン

Example

最初と最後のキーフレーム以降のアニメーションの挙動を制御します。.

ExampleExample
CONSTANT境界値を保持
GRADIENT境界キーフレームの接線勾配で外挿する
CYCLEキーフレーム範囲を繰り返す(ループ)
CYCLE_RELATIVE累積オフセットで繰り返す(終了値に対して相対)
OSCILLATEピンポン(前後交互に繰り返す)

Example

from aspose.threed import Scene
from aspose.threed.animation import AnimationClip, Interpolation
from aspose.threed.utilities import Vector3

scene = Scene()
node = scene.root_node.create_child_node("animated_box")
node.transform.translation = Vector3(0.0, 0.0, 0.0)

# Create an animation clip
clip = AnimationClip("Move")
clip.start = 0.0
clip.stop  = 2.0

# Create an animation node inside the clip
anim_node = clip.create_animation_node("box_anim")

# Get keyframe sequences for the X and Y translation channels
seq_x = anim_node.get_keyframe_sequence(node.transform, "Translation", "X", True)
seq_y = anim_node.get_keyframe_sequence(node.transform, "Translation", "Y", True)

if seq_x:
    seq_x.add(0.0,  0.0,  Interpolation.LINEAR)
    seq_x.add(1.0, 10.0,  Interpolation.LINEAR)
    seq_x.add(2.0,  0.0,  Interpolation.LINEAR)

if seq_y:
    seq_y.add(0.0,  0.0, Interpolation.BEZIER)
    seq_y.add(1.0,  5.0, Interpolation.BEZIER)
    seq_y.add(2.0,  0.0, Interpolation.BEZIER)

# Export to FBX to preserve animation data
scene.save("animated.fbx")

参照

 日本語