## PrevKey

### Description

Moves the current time to the previous key frame for the specified animated parameters.

### Scripting Syntax

    oDouble = PrevKey( [InputObjs], [Time], [Tolerance], [Layer] );

### Return Value

Returns the frame number of the previous key frame as a Double. If there is no key then the following is returned: -1.#INF for C++, "-1.#INF" for VBScript and Number.NEGATIVE_INFINITY for JScript.

### Parameters

Parameter | Type | Description
--- | --- | ---
InputObjs | String | List of animatable parameters (for example "cone*/kine.local.pos"). Default Value: Currently selected and marked parameters
Time | Number | Move to the key before this frame. Default Value: Current frame
Tolerance | Double | Frame tolerance Default Value: Nearest 0.5 frame (-1)
Possible Values: | Description:
>0 | Get key at Frame - Tolerance
0 | Key must be exactly at frame
-1 | Nearest 0.5 frame
Layer | Integer | Animation layer Default Value: Current animation layer (-1)

### Examples

#### VBScript Example

    ' create a null with some animation

    set o = getprim("null")

    Translate o, -10, 5, 0, siRelative, siView, siObj, siXYZ

    savekey o & "/kine.local.pos", 1

    Translate o, 10, -5, 0, siRelative, siView, siObj, siXYZ

    savekey o & "/kine.local.pos", 50

    Translate o, 10, 5, 0, siRelative, siView, siObj, siXYZ

    savekey o & "/kine.local.pos", 75

    ' Process all the keys prior to the current frame

    LastFrame

    PrevKeys ( o & "/kine.local.pos" )

    sub PrevKeys (params)

    	frame = PrevKey( params )

    	do while frame <> "-1.#INF"

    		LogMessage "There is a key at frame " & frame

    		frame = PrevKey( params )

    	loop

    end sub

    'INFO : "There is a key at frame 75"

    'INFO : "There is a key at frame 50"

    'INFO : "There is a key at frame 1"

### See Also

AddFCurve RemoveAnimation RemoveAllAnimation SaveKey RemoveKey NextKey FirstKey LastKey FCurve.Keys