FCurveKey.Time
 
 
 

FCurveKey.Time

Description

Sets or returns the time (in frames) of the fcurve key. The fcurve key time in frames is returned as a double (VT_R8) (see Variant).

Setting the key time results in the key being moved in time. If the fcurve is a standard fcurve then the tangents are automatically adjusted.

C# Syntax

// get accessor
Object rtn = FCurveKey.Time;
// set accessor
FCurveKey.Time = Object;

Examples

1. JScript Example

/*
        This example illustrates how to set a fcurve key's time by creating a null with 
        its local.posx parameter driven by an fcurve 
*/
NewScene( null, false );
// Create a null
var n = Application.ActiveSceneRoot.AddNull();
// Get the posx parameter
var posx = n.posx;
// Create an fcurve on posx
var fc = posx.AddFCurve();
// Define some keys
var keyvalues = new Array( 0,0, 50,25, 100,50 );
// Set the keys
fc.SetKeys( keyvalues );
// Get 2nd key and set the key time
var fckey = fc.Keys(1);
Application.LogMessage( "fckey.Time before = " + fckey.Time );
fckey.Time = 51;
Application.LogMessage( "fckey.Time after = " + fckey.Time );
// Expected results:
//INFO : fckey.Time before = 50
//INFO : fckey.Time after = 51

2. VBScript Example

'
' This example illustrates how to set a fcurve key's time by creating a null with 
' its local.posx parameter driven by an fcurve 
'
NewScene , false 
' Create a null
set n = Application.ActiveSceneRoot.AddNull()
' Get the posx parameter
set posx = n.posx
' Create an fcurve on posx
set fc = posx.AddFCurve()
' Define some keys
keyvalues = array( 0,0, 50,25, 100,50 )
' Set the keys
fc.SetKeys keyvalues 
' Get 2nd key and set the key time
set fckey = fc.Keys(1)
Application.LogMessage "fckey.Time before = " & fckey.Time 
fckey.Time = 51
Application.LogMessage "fckey.Time after = " & fckey.Time 
' Expected results:
'INFO : fckey.Time before = 50
'INFO : fckey.Time after = 51

3. Python Example

#
# This example illustrates how to set a fcurve key's time by creating a null with 
# its local.posx parameter driven by an fcurve 
#
Application.NewScene( "", 0 )
# Create a null
n = Application.ActiveSceneRoot.AddNull()
# Get the posx parameter
posx = n.posx
# Create an fcurve on posx
fc = posx.AddFCurve()
# Define some keys
keyvalues = [ 0,0, 50,25, 100,50 ]
# Set the keys
fc.SetKeys( keyvalues )
# Get 2nd key and set the key time
fckey = fc.Keys(1)
Application.LogMessage( "fckey.Time before = " + str(fckey.Time) )
fckey.Time = 51
Application.LogMessage( "fckey.Time after = " + str(fckey.Time) )
# Expected results:
#INFO : fckey.Time before = 50.0
#INFO : fckey.Time after = 51.0