Animate Multiple Elements with One Trigger across your Storyline 360 Project using Javascript
May 5, 2024
Learn how to apply animations across your eLearning project with just one Execute Javascript trigger!
No Format Painter! No going back to tediously apply animations or states manually.
In this video tutorial, I’ll guide you through the steps to apply hover animations to multiple elements in your Storyline projects using a single master slide trigger.
This method is perfect for large projects with varied interactive components, ensuring uniformity and saving you tons of time. We’ll cover how to use JavaScript and GSAP to create engaging, responsive animations that enhance user interactions.
document.querySelectorAll("[data-acc-text='interactable']").forEach(element => {
// Create a new timeline for each element, paused initially
lettl=gsap.timeline({ paused:true });
// Define the animation for this specific element
tl.to(element, { yPercent:-10, duration:0.3 });
// Set up event listeners for this element
element.addEventListener('mouseenter', () => {
tl.play();
});
element.addEventListener('mouseleave', () => {
tl.reverse();
});
});