AnimCurve

- class AnimCurve
An animation curve abstraction, can animate any type of value, bool, int, float or other values.
Once a curve is modified, it has to be normalized by a call to AnimCurve::normalize() or Channel::set_animation_curve().
Methods
__getitem__operator[](i: int) -> Key
Constructor(s)
__iter____len__clip(frame_in, frame_out)Clip the curve in the frame range [frame_in, frame_out].
copy_keys(keys)Duplicate a subset of the curve.
Return an empty curve of the same type than this.
insert_value(frame, value, before)Insert a key and return its index.
interpolate(t, pre_cycle_mode, post_cycle_mode)This method is used by the curve editor to get a Y value.
key_index(t)Returns the key at t time or -1 if no such key.
keys(only_selected)Return an iteration on the keys.
next_key(t)Returns the key with the lowest but strictly higher than t time or -1 if no such key.
normalize(repeat)Normalize the curve once it has been modified to re-apply the tangents modes.
previous_key(t)Returns the key with the biggest but strictly lower than t time or -1 if no such key.
remove_key(i)Remove the i-th key.
Return a vector of the selected key indices.
set_value(frame, value)Add a key or replace the existing key at the same frame.
size()Returns the number of keys.
- class Key
A curve key.
- __init__(*args, **kwargs)
- as_float() float
Returns the key value as a float.
- Return type
float
- selected() bool
Returns true if the key is selected in the curve editor.
- Return type
bool
- set_selected(state: bool) None
Set the key selection state.
- set_time(t: float) None
Sets the key time (in frames)
- set_value(frame: float, value: maquina.Value) int
Add a key or replace the existing key at the same frame.
The value is used only for Int, Float and Bool curves
- Return type
int
set_value(frame: float,value: maquina.Value) -> int
Add a key or replace the existing key at the same frame.
The value is used only for Int, Float and Bool curves
- Return type
int
- time() float
Returns the key time (in frames)
- Return type
float
- __init__()
Constructor(s)
AnimCurve (v: Value)
Cast a Value object in AnimCurve.
If v has not the good type, a default value is constructed.
AnimCurve (key_type: unicode)
Create an empty animation curve where the key value is of type key_type.
Can be “Bool”, “Int”, “Float” or any other value type. If key_type is “Float”, it creates an AnimCurveFloat curve with tangents.
- clip(frame_in: float, frame_out: float) Optional[Value]
Clip the curve in the frame range [frame_in, frame_out].
Values and tangents at the range limits are preserved.
If the intersection between the curve and the range is empty, the returned curve has a single key corresponding to the curve value on the range, and the method returns the value of that key.
If the intersection between the curve and the range is not empty, the method returns nothing. {std::runtime_error,RuntimeError} if the curve has no key.
- Return type
Optional[Value]
- copy_keys(keys) AnimCurve
Duplicate a subset of the curve.
keys are the indices of the keys to include in the returned curve.
- Return type
- insert_value(frame: float, value: maquina.Value, before: bool) int
Insert a key and return its index. If the key is at the same time than another key, the key is inserted BEFORE the previous keys if before is true, AFTER if before is false.
- Return type
int
- interpolate(t: float, pre_cycle_mode: CycleMode, post_cycle_mode: CycleMode) Value
This method is used by the curve editor to get a Y value.
- Return type
- key_index(t: float) int
Returns the key at t time or -1 if no such key.
- Return type
int
- keys(only_selected: bool) Keys
Return an iteration on the keys.
- Parameters
only_selected (bool) – If true, iterate only on the keyframes selected in the curve editor
- Return type
- next_key(t: float) int
Returns the key with the lowest but strictly higher than t time or -1 if no such key.
- Return type
int
- normalize(repeat: bool) None
Normalize the curve once it has been modified to re-apply the tangents modes.
- previous_key(t: float) int
Returns the key with the biggest but strictly lower than t time or -1 if no such key.
- Return type
int
- remove_key(i: int) None
Remove the i-th key.
- selected_keys()
Return a vector of the selected key indices.
- Return type
list(int)
selected_keys() -> list(int)
Return a vector of the selected key indices.
- Return type
list(int)
- set_value(frame: float, value: maquina.Value) int
Add a key or replace the existing key at the same frame.
The value is used only for Int, Float and Bool curves
- Return type
int
- size() int
Returns the number of keys.
- Return type
int