AddBridgeTransition

導入

v1.5

詳細

2 つの周期的なアニメーション クリップ間のブリッジを作成します。2 つのクリップには重複部分があります。 [From]クリップは[To]クリップより前に開始されている必要があります。 [To]クリップは[From]クリップを終了する前に開始されている必要があります。 両クリップの期間は、一方のクリップからもう一方のクリップまでの時間と想定できます(例: クリップアウトからクリップインまでの時間)。

スクリプト構文

oReturn = AddBridgeTransition( [From], [To], [Name] );

戻り値

トランジションを戻します。

パラメータ

パラメータ タイプ 説明
From 文字列 クリップのトランジション元となるソース クリップ。

デフォルト値: Current selection, if empty:pick session

To 文字列 クリップのトランジション先となるターゲット クリップ。

デフォルト値: Current selection, if empty:pick session

Name 文字列 トランジション名。 現在は使用されていません。

VBScript の例

' This example builds a couple of Actions, one which has

' the sphere moving slowly on a three-sided path, the other

' which has the sphere moving quickly on a four-sided path.

' It then uses a bridge transition to perform a correct

' transition between these two looped motions (which have

' different periods). 

slowPeriod = 30		' period of the slow looping Action

fastPeriod = 12		' period of the fast looping Action

preFade = 60		' approx time to cycle before starting transition

crossFade = 100		' approx desired duration of transition

posParams = "/kine.local.posx,kine.local.posy,kine.local.posz"

' Create an object for our example.

set oObj = CreatePrim( "Sphere", "MeshSurface" )

' Make an Action with it moving slowly in a wide (three-sided) loop.

BuildLoop oObj, slowPeriod, 15, false

set oSlowSource = StoreAction( , oObj & posParams, 2, "Slow", True, _

				0, slowPeriod - 1 )

' Make an Action with it moving quickly in a tight (four-sided) loop.

BuildLoop oObj, fastPeriod, 3, true

set oFastSource = StoreAction( , oObj & posParams, 2, "Fast", True, _

				0, fastPeriod - 1 )

' Instantiate the Actions on the mixer -- cycled,

' overlapped and ready for the Bridge Transition.

set oSlowClip = AddClip( "Scene_Root", oSlowSource, , , 1 )

set oFastClip = AddClip( "Scene_Root", oFastSource, , , _

				round( preFade / slowPeriod ) * slowPeriod + 1 )

overlapSlowCycles = round( ( crossFade + preFade - slowPeriod ) / slowPeriod )

SetValue oSlowClip & ".actionclip.timectrl.extrapaft_type", 2

SetValue oSlowClip & ".actionclip.timectrl.extrapaft_nbcycles", overlapSlowCycles

SetValue oFastClip & ".actionclip.timectrl.extrapaft_type", 2

SetValue oFastClip & ".actionclip.timectrl.extrapaft_nbcycles", _

				round( overlapSlowCycles * slowPeriod / fastPeriod ) + 1

' Apply the Bridge Transition, which will match the

' frequency of the periodic motions.  Compare it to

' a regular transition, where the motions tend to

' cancel each other out if they are at different frequencies.

AddBridgeTransition oSlowClip, oFastClip

' Set a suitable timeline start/end for playback of this example.

SetValue "PlayControl.In", 1

SetValue "PlayControl.Out", GetValue( oFastClip & ".actionclip.timectrl.resout" )

'==================================================

' Helper method to create the looping paths (three- or four-sided).

'==================================================

sub BuildLoop( in_oObj, in_period, in_size, in_bFourSided )

	SetPositionKey in_oObj, 0,				-0.5 * in_size, -0.5 * in_size, 0

	if in_bFourSided then

		SetPositionKey in_oObj, in_period / 4,	0.5 * in_size, -0.5 * in_size, 0

		SetPositionKey in_oObj, in_period / 2,	0.5 * in_size, 0.5 * in_size, 0

		SetPositionKey in_oObj, 3 * in_period / 4,	-0.5 * in_size, 0.5 * in_size, 0

	else

		SetPositionKey in_oObj, in_period / 3,	0.5 * in_size, -0.5 * in_size, 0

		SetPositionKey in_oObj, 2 * in_period / 3,	0, 0.5 * in_size, 0

	end if

	SetPositionKey in_oObj, in_period,			-0.5 * in_size, -0.5 * in_size, 0

end sub

'==================================================

' Helper method to key an object somewhere at a given frame.

'==================================================

sub SetPositionKey( in_oObj, in_frame, in_posX, in_posY, in_posZ )

	Translate in_oObj, in_posX, in_posY, in_posZ, siAbsolute, siParent, siObj, siXYZ

	SaveKey in_oObj & posParams, in_frame

end sub

関連項目

AddTransition