Returns : Tween | Timeline | undefined
The Tween or Timeline associated with the ScrollTrigger (if any)
Details
[read-only] The Tween or Timeline associated with the ScrollTrigger instance (if any). ScrollTriggers don't have to have any animation associated with them, of course, in which case animation
will be undefined.
Embedded example
let tween = gsap.to(".class", {
x: 100,
id: "example",
scrollTrigger: ".trigger",
});
console.log(ScrollTrigger.getById("example").animation); // tween
Standalone example
let tween = gsap.to(".class", { x: 100 }),
st = ScrollTrigger.create({
trigger: ".trigger",
start: "top center",
end: "+=500",
animation: tween,
});
console.log(st.animation); // tween