Edit a Composition
Accessing a Composition
A Composition can be retrieved from a ProjectItem with ProjectItem.getMainEffectInstance()
Change Composition parameters
Since the Composition class inherits Effect , all its Param can be accessed with Autograph.Effect.param(uniqueName)() or Autograph.Effect.getParams() .
However, some commonly used Params have a dedicated API to make it easier:
comp.setFormat(width, height, pixelAspectRatio)
comp.framerate = 60.0
# 300 frames at 60fps is 5 seconds
comp.duration = 300
Manage layers
Composition contains is a list-like API for managing layers:
comp.addLayer(Autograph.Layer2D())
allLayers = comp.getLayers()
for i in range(len(allLayers)):
print("Layer %i is %r" % (i, allLayers[i]))
To create a layer with a project item as source, use the dedicated constructor:
project=Autograph.app.getActiveProject()
myFootage=project.importFootage('/media/myfiles/video.mov')
...
comp.addLayer(Autograph.Layer2D(myFootage))
Under the hood, this constructor assigns an Effect returned from Autograph.ProjectItem.createEffectSharedInstance() to the generator slot of the source param of the layer. Here is the equivalent:
project=Autograph.app.getActiveProject()
myFootage=project.importFootage('/media/myfiles/video.mov')
layer=Autograph.Layer2D()
# Note that we create a shared copy of the effect so that the user can unshare parameters if needed
layer.source.setGeneratorEffect(myFootage.createEffectSharedInstance())
comp.addLayer(layer)
Setting the layer transform
The layer transform parameters can be accessed with the Layer2D.transform attribute or with the generic Effect.param() accessor.
layer.transform.position.setValues([300.,0.])