# AnimatedParam¶

Inherits Param

## Synopsis¶

This is the base class for all parameters which have the property canAnimate set to True. See the detailed description below

## Detailed Description¶

Animating parameters have values that may change throughout the time. To enable animation the parameter should have at least 1 keyframe. Keyframes can be added in the derived class (since function signature is type specific) with the setValueAtTime function. Once 2 keyframes are active on the parameter, the value of the parameter will be interpolated automatically by Natron for a given time. You can control keyframes by adding,removing, changing their values and their KeyFrameTypeEnum type.

Note that by default new keyframes are always with a Smooth interpolation.

Moreover parameters can have Python expressions set on them to control their value. In that case, the expression takes precedence over any animation that the parameter may have, meaning that the value of the parameter would be computed using the expression provided.

### Member functions description¶

NatronEngine.AnimatedParam.deleteValueAtTime(time[, dimension=0])
Parameters: time – float dimension – int

Removes a keyframe at the given time and dimension for this parameter, if such keyframe exists.

NatronEngine.AnimatedParam.getCurrentTime()
Return type: int

Convenience function: returns the current time on the timeline

NatronEngine.AnimatedParam.getDerivativeAtTime(time[, dimension=0])
Parameters: time – float dimension – int double

Returns the derivative of the parameter at the given time and for the given dimension. The derivative is computed on the animation curve of the parameter. This function is irrelevant for parameters that have an expression.

NatronEngine.AnimatedParam.getExpression(dimension)
Parameters: dimension – int str

Returns the Python expression set on the parameter at the given dimension. When no expression is set, this function returns an empty string.

NatronEngine.AnimatedParam.getIntegrateFromTimeToTime(time1, time2[, dimension=0])
Parameters: time1 – float time2 – float dimension – int float

Integrates the value of the parameter over the range [time1 - time2]. This is done using the animation curve of the parameter of the given dimension. Note that if this parameter has an expression, the return value is irrelevant.

NatronEngine.AnimatedParam.getIsAnimated([dimension=0])
Parameters: dimension – int bool

Returns whether the given dimension has an animation or not. This returns true if the underlying animation curve has 1 or more keyframes.

NatronEngine.AnimatedParam.getKeyIndex(time[, dimension=0])
Parameters: time – float dimension – int int

Returns the index of the keyframe at the given time for the animation curve at the given dimension, or -1 if no such keyframe could be found.

NatronEngine.AnimatedParam.getKeyTime(index, dimension)
Parameters: index – int dimension – int tuple

Returns a tuple [bool,float] where the first member is True if a keyframe exists at the given index for the animation curve at the given dimension. The second float member is the keyframe exact time.

NatronEngine.AnimatedParam.getNumKeys([dimension=0])
Parameters: dimension – int int

Returns the number of keyframes for the animation curve at the given dimension.

NatronEngine.AnimatedParam.removeAnimation([dimension=0])
Parameters: dimension – int

Removes all animation for the animation curve at the given dimension. Note that this will not remove any expression set.

NatronEngine.AnimatedParam.setExpression(expr, hasRetVariable[, dimension=0])
Parameters: expr – str hasRetVariable – bool dimension – int bool

Set the Python expression expr on the parameter at the given dimension If hasRetVariable is True, then expr is assumed to have a variable ret declared. Otherwise, Natron will declare the ret variable itself.

NatronEngine.AnimatedParam.setInterpolationAtTime(time, interpolation[, dimension=0])
Parameters: time – float interpolation – KeyFrameTypeEnum dimension – int bool

Set the interpolation of the animation curve of the given dimension at the given keyframe. If no such keyframe could be found, this method returns False. Upon success, this method returns True.

Example:

app1.Blur2.size.setInterpolationAtTime(56,NatronEngine.Natron.KeyframeTypeEnum.eKeyframeTypeConstant,0)