Capítulo 174 de 411
A helper that kills every currently active tween whose target is a DOM descendant of a given ancestor element, without needing a reference to each individual tween.
gsap.globalTimeline.getChildren() (every active tween/timeline) and, for each tween's targets, checks ancestor.contains(target) before killing that specific target on that tween.e.nodeType check), leaving non-DOM tweened objects untouched.function killChildTweensOf(ancestor) {
ancestor = gsap.utils.toArray(ancestor)[0];
gsap.globalTimeline
.getChildren(true, true, false)
.forEach((tween) =>
tween.targets().forEach((e) => e.nodeType && ancestor.contains(e) && tween.kill(e))
);
}
gsap.globalTimeline as a registry of every running animation to selectively kill by DOM containment.