Skip to main content

Cheat Sheet

Use this Cheat Sheet to find the most common code snippets.

Pause animation

On the desired frame, create an action with the code:

Action code
this.pause();

Loop animation

On the last frame of the loop, create an action with the code:

Action code
this.goToAndPlay(FIRST_FRAME_OF_THE_LOOP);

Append text to dynamic Text element content

In Composition Action, add this middleware code:

Composition Action middleware
loopic.useOnUpdate("_key", (key, value, next) => {
const element = this.findElementByKey(key);
const TEXT_TO_APPEND = "APPENDED: ";
element.setContent(TEXT_TO_APPEND + value);
});

Bold the first word in the Text element

In Composition Action, add this middleware code:

Composition Action middleware
loopic.useOnUpdate("_name", (key, value, next) => {
const splitted = value.split(" ");
const firstName = splitted[0];
const lastName = splitted[1];
const element = this.findElementByKey(key);
element.setContent(`${firstName} <b>${lastName}</b>`);
});

Play in reverse on stop

In Composition Action, add this middleware code:

Composition Action middleware
loopic.useOnUpdate((next) => {
this.play({ reverse: true });
});