Skip to main content

Composition API

The composition represents exported Loopic composition with all its properties. It should not be mixed with the Composition Element, which represents the composition element as the element of the layer.

There can be multiple Composition elements in one template, but there must be at least one which is considered as main. The main Composition object is the object that contains all other objects and the one that is responsible for the playback of the template. play or stop commands sent to the template will first be read by the loopic object, and then those commands, after going through all middlewares, will end up by calling play or stop commands (in case if the default middleware was not omitted by custom middleware).

Composition diagram


id Read-Only

  • Type: string

ID of the composition.

domNode Read-Only

  • Type: HTML DOM element

Reference to DOM element representing composition.


  • Type: number

Duration of the composition in frames.

activeFrame Read-Only

  • Type: number

Frame that is currently active.


  • Type: number

Composition framerate setting (eg. 50, 60).


  • Type: number

Number of the frame which will be used as outro frame.


  • Type: number

Frame from which the composition playback should start from. Defined by the workspace duration in Loopic.


In the current version of Loopic, startFrame property is always 0 because workspace duration can not be shifted in time.

isPlaying Read-Only

  • Type: boolean

Flag signalizing if the composition is playing.

isComputed Read-Only

  • Type: boolean

Flag signalizing if all properties contained by all elements used in the composition (and including all nested compositions as well) are computed, which means those changes will be visible in the animation.



  • key String
  • Returns Element object or undefined

Finds Loopic element with the specified key argument.

Returns Loopic element object.

Action example


  • arg Object (optional)
    • reverse boolean (optional) - whether to play the animation in reverse

Plays the template from current active frame.

Action example;


Pauses the template playback.

Action example


  • frame number

Sets current active composition frame to the frame argument.

Action example

goToAndPlay(frame[, arg])

  • frame number
  • arg Object (optional)
    • reverse boolean (optional) - whether to play the animation in reverse

Sets current active composition frame to the frame argument and plays the composition.

Action example


Computes animations of all properties of all elements contained in composition (including all nested compositions and their elements as well). If composition is paused, the result of computation won't be visible in the current frame unless refreshRender() method is called.

Action example


Refreshes the render with all latest animation computations. This method will refresh the render of only the composition on which this method is called and will not refresh nested compositions.

Action example


Executes composition action. By default, this method will be called automatically just before composition is played for the first time.

Action example


Executes frame actions on the current active frame.

Action example