Scale (FCurve)

Introduced

6.0

Description

Scales the fcurve in time or value by a relative amount. The scaling amount is relative to the keyframe bounding box and the anchor point so that a value of 0.5 would scale the keys by 50%.

Note: If the FCurve is locked then the method raises an 'Access Denied' (E_ACCESSDENIED) error.

Scripting Syntax

    FCurve.Scale( [FrameFactor], [ValueFactor], [FrameAnchor], [ValueAnchor] )

C# Syntax

    FCurve.Scale( Double in_FrameFactor, Double in_ValueFactor, Object in_FrameAnchor, Object in_ValueAnchor );

Parameters

Parameter | Type | Description
FrameFactor | Double | The relative amount to scale the fcurve's time. Default Value: 1.0
ValueFactor | Double | The relative amount to scale the fcurve's value. Default Value: 1.0
FrameAnchor | Variant | The center point for frame scaling. Default Value: 0.0
ValueAnchor | Variant | The center point for value scaling. Default Value: 0.0

Examples

JScript Example

    //
    // This example illustrates how to scale an fcurve to 50% of the original fcurve.

    // 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 Scaling:', siInfo );
    for (var i = 0; i < oFCurve.Keys.Count; i++)
    {
       Application.LogMessage( 'Time: ' + oFCurve.Keys(i).Time + ', Value: ' + oFCurve.Keys(i).Value, siInfo );
    }

    oFCurve.Scale( 0.5, 0.5, 0.0, 7.5 );

    Application.LogMessage( 'After Scaling:', 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 Scaling:
    //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 Scaling:
    //INFO : Time: 0, Value: 6.25
    //INFO : Time: 0.5, Value: 6.75
    //INFO : Time: 1, Value: 7.25
    //INFO : Time: 1.5, Value: 7.75
    //INFO : Time: 2, Value: 8.25
    //INFO : Time: 2.5, Value: 8.75

See Also

FCurve.ScaleKeys | FCurve.Offset | FCurve.OffsetKeys

Autodesk Softimage v7.5