Text reveal
ng-gsap + gsap/SplitText
SplitText shipped free in GSAP core after the Webflow acquisition — no separate club license needed anymore. Its mask: 'lines' option auto-wraps each line in an overflow-hidden mask, so words can slide up from underneath. injectGSAP reverts and rebuilds the split cleanly on every replay.
Animate anything, declaratively.
Signals in, GSAP out — nothing to declare, nothing to clean up.
private heading = viewChild.required<ElementRef>('heading');
protected replayCount = signal(0);
private split?: SplitText;
// SplitText is free now (it shipped in gsap core after the Webflow acquisition) —
// "mask: 'lines'" auto-wraps each line in overflow-hidden so words slide up cleanly
private anim = injectGSAP(() => {
this.replayCount(); // read so replay() re-runs this
this.split?.revert();
this.split = SplitText.create(this.heading().nativeElement, { type: 'words, lines', mask: 'lines' });
gsap.from(this.split.words, { yPercent: 110, opacity: 0, duration: 0.9, ease: 'power3.out', stagger: 0.04 });
}, { scope: this.heading });
// a plain signal write — no contextSafe needed
protected replay(): void {
this.replayCount.update((n) => n + 1);
}