Skip to main content

AnimationCurve.MoveKey(number index, Keyframe key)

Removes the keyframe at index and inserts key.

Parameters:

NameTypeDescription
indexnumberThe index of the key to move.
keyKeyframeThe key (with its new time) to insert.

Returns:

typeDescription
numberThe index of the keyframe after moving it.

Usage

---@type AnimationCurve
local animationcurve;

---@type number
local index;

---@type Keyframe
local key;


local val0 = animationcurve.MoveKey(index, key)

Extra Detail

If a keyframe already exists at key.time, then the time of the old keyframe's position key[index].time will be used instead. This is the desired behaviour for dragging keyframes in a curve editor. Returns the index of the keyframe after moving it.