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:typescriptif (typeof visualLink !== "undefined") { const pm = visualLink.playStateManager; const getCanvasElement = visualLink.getCanvasElement; // Your custom code here }
Available Properties
visualLink.dataThe 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.
typescriptconsole.log(visualLink.data)
visualLink.canvas()Returns the main canvas DOM element for your visual in HTML.
typescriptconst 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
typescriptconst 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.playStateManagerControls 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.abortControllerAn 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