v6.0
Offsets the fcurve in time or value by a relative amount.
Note: If the FCurve is locked then the method raises
an 'Access Denied' (E_ACCESSDENIED) error.
FCurve.Offset( Object in_FrameOffset, Object in_ValueOffset ); |
FCurve.Offset( [FrameOffset], [ValueOffset] ); |
Parameter | Type | Description |
---|---|---|
FrameOffset | Double |
The relative amount to offset the fcurve's time. Can be positive or negative. Default Value: 0 |
ValueOffset | Double |
The relative amount to offset the fcurve's values. Can be positive or negative. Default Value: 0 |
// // This example illustrates how to shift an fcurve in both time and value. // 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 ); Application.LogMessage( 'Before Offset:', siInfo ); for (var i = 0; i < oFCurve.Keys.Count; i++) { Application.LogMessage( 'Time: ' + oFCurve.Keys(i).Time + ', Value: ' + oFCurve.Keys(i).Value, siInfo ); } oFCurve.Offset( 5, -5 ); Application.LogMessage( 'After Offset:', 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 Offset: //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 Offset: //INFO : Time: 5, Value: 0 //INFO : Time: 6, Value: 1 //INFO : Time: 7, Value: 2 //INFO : Time: 8, Value: 3 //INFO : Time: 9, Value: 4 //INFO : Time: 10, Value: 5 |