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

Quick Start

Hello World Animation

Fade in a text layer when the visual appears:
Required Steps:
  1. Add custom JS to your visual
  2. Set layer ID to my-text-layer (bottom of layer properties)
  3. Turn off default transition on that layer

Core Concepts

visualLink connects your JavaScript to the visual lifecycle. Always check it exists:
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.

Getting Elements

Never use document.querySelector - visuals renderer places elements in different contexts on the page, there is no guarantee that the querySelector will query the element you expect it to return.
Always use visualLink.getCanvasElement():
Set IDs at bottom of layer properties panel.

The Play State Manager

visualLink.playStateManager controls when your visual appears and disappears. It fires events at key moments in the visual’s lifecycle.
You register handlers for these moments using pm.on().

Lifecycle Events

Visuals have 3 key moments:
Execution order: cueinenterleave

GSAP Basics

Three Animation Methods

Common Properties

GSAP Cheatsheet

Complete Examples

Example 1: Simple Fade In

What this does: Title fades in over 0.5s when visual enters.

Example 2: Slide In + Fade Out

What this does:
  • Enter: Slides in from left with fade
  • Leave: Fades out

Example 3: Multiple Layers

What this does: 3 layers appear one after another with 0.2s delay.

Example 4: Using Timelines

For complex multi-step animations:
What this does:
  1. Logo scales up
  2. Title fades in from top (slightly before logo finishes)
  3. Subtitle fades in

Example 5: Full In/Out with Reset

What this does:
  • cuein: Reset both animations
  • enter: Slide in from left
  • leave: Slide out to right
Important: Always reset animations in cuein to prevent state issues.

Transition Settings

Found in Visual settings below tag editor. Controls overall visual transition behavior.

Default

Layers transition independently. Each layer uses its own timing. Use when: Simple visuals with independent layer animations.

Layer Based

Visual waits for ALL layers to finish transitioning. Duration = sum of all layer transitions Use when: Coordinated multi-layer animations where all must complete.

Visual Based

Fixed duration for entire visual, layers animate within that time. Settings:
  • In Duration (ms): Time to show visual
  • Out Duration (ms): Time to hide visual
Use when: Consistent timing regardless of layer complexity.

Visual Fixed

Single fixed-length visual. No individual layer control. Settings:
  • In Duration (ms): Show time
  • Out Duration (ms): Hide time
  • Layer transitions disabled
Use when: Simple displays, no complex timing needed.

Common Patterns

Pattern: Layer That Only Animates In

Pattern: Continuous Animation

Pattern: Sequence Multiple Animations

Pattern: Overlap Animations


Troubleshooting

Animation doesn’t run

  • typeof visualLink !== "undefined" wrapper exists
  • Layer ID matches getCanvasElement("id")
  • Default transition disabled on animated layers
  • Console for errors

Animation runs but looks wrong

  • Using lifecycle events correctly (cuein/enter/leave)
  • Reset animations in cuein for repeatable playback
  • Transition Settings mode matches intent

Element not found

  • Layer ID set in properties (bottom of panel)
  • Using visualLink.getCanvasElement() not document.querySelector
  • ID has no # prefix in getCanvasElement("id")

Animation plays multiple times

Solution: Check if active before restarting:

Visual data not updating

Access visual data via visualLink.data:

Best Practices

  1. Always check visualLink exists before any code
  2. Always use visualLink.getCanvasElement() for DOM queries
  3. Reset animations in cuein for reliable repeated playback
  4. Disable default transitions on GSAP-animated layers
  5. Use timelines for multi-step animations
  6. Check isActive() before restarting animations
  7. Keep durations under 1s for snappy UI
  8. Test with repeated plays (cueinenterleave)

Reference

Lifecycle Events

GSAP Essentials

Full GSAP DocsGSAP Cheatsheet