FCurve.ExtendCycle

Introduced

v6.0

Description

Extends the fcurve to include the given number of cycles before/after.

The cycle length is defined by the start/end keys and the current extrapolation for the fcurve (FCurve.Extrapolation) is taken into account when generating the new cycles. Therefore, the method will fail if the fcurve has less than two keys.

C# Syntax

FCurve.ExtendCycle( Int32 in_CyclesBefore, Int32 in_CyclesAfter );

Scripting Syntax

FCurve.ExtendCycle( [CyclesBefore], [CyclesAfter] );

Parameters

Parameter Type Description
CyclesBefore Long The number of cycles to extend before the fcurve.

Default Value: 0

CyclesAfter Long The number of cycles to extend after the fcurve.

Default Value: 0

Examples

JScript Example

// 
// This example illustrates how to extend an fcurve to include cycles before/after
// Create a new scene
NewScene(null, false);
// Create a null
oNull = Application.GetPrim("Null");
// Get the posx parameter of the null
oPosX = oNull.posx
// Create array of time-value pairs
aKeys = new Array( 0.00, 5.00,
				1.00, 6.00,
				2.00, 7.00,
				3.00, 8.00,
				4.00, 9.00,
				5.00, 10.00 );
// Create an empty FCurve
oFCurve = oPosX.AddFCurve2( null, siStandardFCurve );
// Set the fcurve keys
oFCurve.SetKeys( aKeys );
// Set the extrapolation for this fcurve
oFCurve.Extrapolation = siPeriodicRelativeExtrapolation;
Application.LogMessage( 'Before ExtendCycle:', siInfo );
for (var i = 0; i < oFCurve.Keys.Count; i++) 
{
	Application.LogMessage( 'Time: ' + oFCurve.Keys(i).Time + ', Value: ' + oFCurve.Keys(i).Value, siInfo );
}
// Extend one cycle before and after
oFCurve.ExtendCycle( 1, 1 );
Application.LogMessage( 'After ExtendCycle:', siInfo );
for (var i = 0; i < oFCurve.Keys.Count; i++) 
{
	Application.LogMessage( 'Time: ' + oFCurve.Keys(i).Time + ', Value: ' + oFCurve.Keys(i).Value, siInfo );
}
// Produces the following output:
//
//INFO : Before ExtendCycle:
//INFO : Time: 0, Value: 5
//INFO : Time: 1, Value: 6
//INFO : Time: 2, Value: 7
//INFO : Time: 3, Value: 8
//INFO : Time: 4, Value: 9
//INFO : Time: 5, Value: 10
//INFO : After ExtendCycle:
//INFO : Time: -5, Value: 0
//INFO : Time: -4, Value: 1
//INFO : Time: -3, Value: 2
//INFO : Time: -2, Value: 3
//INFO : Time: -1, Value: 4
//INFO : Time: 0, Value: 5
//INFO : Time: 1, Value: 6
//INFO : Time: 2, Value: 7
//INFO : Time: 3, Value: 8
//INFO : Time: 4, Value: 9
//INFO : Time: 5, Value: 10
//INFO : Time: 6, Value: 11
//INFO : Time: 7, Value: 12
//INFO : Time: 8, Value: 13
//INFO : Time: 9, Value: 14
//INFO : Time: 10, Value: 15

See Also

FCurve.Extrapolation