GSAP Animations with Visual Radio Graphics

To add GSAP animations to your Visuals in Visual Radio Assist, you can make use of the custom JS in the Designer.

VRA Graphic Foundations: the Visual Link Object

When writing custom JavaScript for visuals, you have access to the visualLink object that provides methods to interact with your visual canvas. It's the link between the code and the visual lifecycle and data. Every layer is accessible via the visualLink.
Always wrap your custom JavaScript code in a type check to ensure visualLink is available:
typescript
if (typeof visualLink !== "undefined") { const pm = visualLink.playStateManager; const getCanvasElement = visualLink.getCanvasElement; // Your custom code here }

Available Properties

visualLink.data
The complete visual content data object containing all visual properties and settings, like variables and tags. Try logging the object to see which properties are available.
typescript
console.log(visualLink.data)
visualLink.canvas()
Returns the main canvas DOM element for your visual in HTML.
typescript
const canvas = visualLink.canvas();
visualLink.getCanvasElement(query)
Due to the versitaile way Visuals can be rendered (in Compositions, direct URLs, single Output Players, etc.) it is not stable to get DOM elements directly by using document.queryElement for example.
Query DOM elements within your visual canvas via the getCanvasElement method available on the visualLink. Supports three query types:
  • ID query: getCanvasElement('elementId') - finds #visual_canvas #elementId
  • Class query: getCanvasElement('.className') - finds all elements with class (returns NodeList)
  • Selector query: getCanvasElement('#customId') - finds #visual_canvas #customId
typescript
const element = visualLink.getCanvasElement('myElement'); const elements = visualLink.getCanvasElement('.myClass');
You can override those IDs on the bottom of the properties of every Visual Layer
visualLink.playStateManager
Controls the playback lifecycle state of your visual. Use this to manage play/pause states and timing.
Available play state events (in order of execution):
.on("cuein")
.on(”enter”)
.on("leave")
visualLink.abortController
An AbortController instance for handling cleanup when the visual is removed or updated.

Transition Settings

In the settings of the Visual, below the tag editor, you'll find the Transition Settings. These settings control how your Visual transitions in and out when displayed on an output. Each mode determines how individual layer transitions combine to create the overall Visual transition behavior.

Default

Layer Based

Visual Based

Visual Fixed

GSAP Foundations

GSAP is a JavaScript library used for building animations for the web. You can use it to animate HTML elements, CSS properties, SVGs and JavaScript objects. If you want to add animations to your Visuals, you can do that with GSAP.

The GSAP Object

GSAP Timeline

Examples

Make sure to replace the #layer-id with your own layer ID’s. Cheatsheet: https://gsap.com/cheatsheet

Basic Setup

GSAP IN + OUT Fade Transition