## AddTransition

### Introduced

v1.0

### Description

Creates a transition between two clips. A transition curve is associated with this transition (the default curve is linear, but this can be edited after creation).

### Scripting Syntax

    oReturn = AddTransition( [From], [To], [Type], [Name] );

### Return Value

Returns the transition (a Transition object).

### Parameters

Parameter | Type | Description
--- | --- | ---
From | String | The source clip from which to transition. Default Value: Current selection, if empty: pick session
To | String | The target clip to which to transition. Default Value: Current selection, if empty: pick session
Type | Integer | The type of transition to create. Default Value: 0
Possible Values: | Description:
0 | Standard transition.
1 | Cardinal transition.
2 | Bridge transition.
Name | String | Name of the transition.

### Examples

#### VBScript Example

    ' This example creates a simple 2-bone skeleton and puts it in a model.

    ' Then it duplicates the model so we can compare Standard versus Cardinal

    ' transitions.  Next it makes three poses for the first model.  Finally,

    ' it applies these source clips onto both models and uses Standard

    ' transitions for the first model and Cardinals for the second.  Cardinal

    ' transitions require at least four consecutive clips in a row, and they

    ' give a smoother interpolation than Standard.  It ends by plotting the

    ' effector position to a curve, to illustrate the difference.

    ' Create the skeleton for our example.

    set oSkelRoot = Create2DSkeleton( 0, 4, 0, 0, 0, 0, , , , , oBone1, oEff )

    oBone2 = AppendBone( oEff, 4, 0, 0 )

    ' Put the skeleton in its own model, pretend it's a "character".

    CreateModel oSkelRoot, "Standard", , oModel

    ' Because AppendBone just returns a string, not the object,

    ' we prepend the model name onto the front (now that it's inside one).

    oBone2 = oModel & "." & oBone2

    ' Duplicate the model in Branch mode ("B:" indicates branch), rename

    ' the new model "Cardinal" (the first model is called "Standard").

    set oOtherModel = Duplicate( "B:" & oModel, 1 )

    SetValue oOtherModel & ".name", "Cardinal"

    ' The model is the first member of the collection returned by Duplicate.

    oOtherModel = oOtherModel(0)

    ' Take a few "snapshot" poses.  For this example, we translate the

    ' effector (IK), but capture the values of the bone rotations (FK)

    ' for later use in the mixer.

    rotParams = "/kine.local.rotx,kine.local.roty,kine.local.rotz"

    paramStr = oBone1 & "," & oBone2 & rotParams

    dim oPoses(5)

    posCoords = Array( Array(4,0,0), Array(0,2,0), Array(-1,-3,0), _

    			Array(0,-3.5,0), Array(1,-1,0), Array(4,0,0) )

    for i = 0 to 5

    	SnapshotPose oModel, oEff, oPoses(i), _

    			posCoords(i)(0), posCoords(i)(1), posCoords(i)(2), paramStr

    next

    ' Create tracks for the clips (one track in each model).

    dim oTracks(1), oClips(5,1)

    set oTracks(0) = AddTrack( oModel, , 0 )

    set oTracks(1) = AddTrack( oOtherModel, , 0 )

    ' Now go through and instantiate the sources into single-frame clips on

    ' the two mixers.  For the first mixer we will add standard transitions

    ' between each pair of consecutive clips.  For the second one, we

    ' will add Cardinal transitions.

    for i = 0 to 5

    	set oClips(i,0) = AddClip( oModel, oPoses((i)), , oTracks(0), i * 19 + 1 )

    	set oClips(i,1) = AddClip( oOtherModel, oPoses((i)), , oTracks(1), i * 19 + 1 )

    	if i > 0 then

    		AddTransition oClips(i-1,0), oClips(i,0), 0	' Standard

    		AddTransition oClips(i-1,1), oClips(i,1), 1	' Cardinal

    	end if

    next

    ' Just offset the two models so we can see them separately.

    SetValue oModel & ".kine.local.posx", -5

    SetValue oOtherModel & ".kine.local.posx", 5

    ' Get the second effector's full name by prepending the

    ' second model's name to the first effector's "simple" name.

    oEff1 = oOtherModel & "." & oEff.name

    ' Finally, plot the effector positions to compare the paths.

    PlotCurve oEff & "," & oEff1, , 1, 96, 1

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

    ' Helper method to create a snapshot Action for the chain.

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

    sub SnapshotPose( in_oModel, in_oEff, io_oPose, in_X, in_Y,in_Z, in_paramStr )

    	Translate in_oEff, in_X, in_Y, in_Z, siAbsolute, siView, siObj, siXYZ

    	Refresh ' needed because StoreAction just looks at current values.

    	set io_oPose = StoreAction( in_oModel, in_paramStr, 1, , True, 1, 1 )

    end sub

### See Also

AddBridgeTransition Transition