2.9. Keyframes

2.9.1. Synopsis

2.9.1.1. Functions

2.9.2. Detailed Description

Keyframe sequential 2D-container.

class mocha.project.Keyframes
Keyframes.__contains__()
Keyframes.__iter__()
Keyframes.__mgetitem__()

Queries the parameter keyframes. The key can be either a frame index or slice. Additionally it can be/include a View(s). If the View is not specified, it defaults to all views Examples:

>>> param.keyframes[5]  # keyframe 5 of all views
>>> param.keyframes[View(1)]  # keyframes of View(1)
>>> param.keyframes[:, View(1)]  # ditto
>>> param.keyframes[2:20, View(1)]  # keyframes [2:20) of View(1)
>>> param.keyframes[2:20, (View(0), View(1))]  # keyframes [2:20) of View(0) and View(1)

Note: the ranges consist of frame project indices, not keyframe indices in the Keyframes container.

Keyframes.__mlen__()

Returns the number of all keyframes.

Keyframes.__msetitem__()

Add new or modyfing the existing keyframes. There are 4 possible ways, e.g. if there are 2 views in your project: Case 1:

>>> param.keyframes[5, View(0)] = 200.0
# Basic keyframe assignment. The type being assigned must be convertible to the parameter's type.

Case 2:

>>> param.keyframes[5] = [200.0, 300.0]
# or
>>> param.keyframes[5, (View(0), View(1))] = [200.0, 300.0]
# Per-view keyframe assignment.
# The same as 2 basic assignments.
# `param.keyframes[5, View(0)] = 200.0`
# `param.keyframes[5, View(1)] = 300.0`

Case 3:

>>> param.keyframes[:3, View(0)] = [200.0, 300.0, 400.0]
# Keyframe range assignment
# The same as 3 basic assignments:
# `param.keyframes[0, View(0)] = 200.0`
# `param.keyframes[1, View(0)] = 300.0`
# `param.keyframes[2, View(0)] = 400.0`

Case 4:

>>> param.keyframes[:3] = [[200.0, 300.0, 400.0], [500.0, 600.0, 700.0]]
# or
>>> param.keyframes[:3, (View(0), (View(1)))] = [[200.0, 300.0, 400.0], [500.0, 600.0, 700.0]]
# Per-view keyframe range assignment
# The same as 2 keyframe range assignments:
# `param.keyframes[:3, View(0)] = [200.0, 300.0, 400.0]`
# `param.keyframes[:3, View(1)] = [500.0, 600.0, 700.0]`

Apart from assignment, the same protocol is compatible with the del operator.

Keyframes.assign(keyframes)

Add new or replace the existing keyframes from the Keyframes object. This method merges given keyframes into the existing keyframes sequence.

Keyframes.assign(keyframes)

Add new or replace the existing keyframes from a list of Keyframe objects. This method merges given keyframes into the existing keyframes sequence.