
Masked Reveal
Skill用 GSAP ScrollTrigger 让标题与短文案在进入视口时逐词从遮罩下方升起,提供不依赖付费 SplitText 插件的拆词代码、默认时长与错峰、React 清理写法,保留 aria-label 并支持减少动态效果。
name: masked-reveal
description: Create masked staggered word reveals on scroll with GSAP ScrollTrigger. Use when headings, hero copy, section titles, or editorial text should reveal word-by-word through an overflow mask as they enter the viewport.
Masked Reveal
Use When
- A headline or short text block needs a premium reveal on scroll.
- Words should rise through an invisible mask with a staggered sequence.
- The project already uses GSAP or needs ScrollTrigger-based motion.
Motion Defaults
- Trigger: start when the text top reaches
82%of the viewport. - Duration:
0.7sto0.9s. - Stagger:
0.025sto0.045sper word. - Offset:
yPercent: 110to0. - Ease:
power3.outorexpo.out. - Replay: reveal once by default.
HTML
<h1 class="masked-reveal" data-masked-reveal>
Design systems that feel alive from the first scroll.
</h1>
CSS Mask
.masked-reveal {
visibility: visible;
}
html.js .masked-reveal[data-masked-reveal] {
visibility: hidden;
}
html.js .masked-reveal.is-split {
visibility: visible;
}
.masked-reveal .word-mask {
display: inline-block;
overflow: hidden;
vertical-align: top;
}
.masked-reveal .word {
display: inline-block;
transform: translateY(110%);
will-change: transform;
}
@media (prefers-reduced-motion: reduce) {
html.js .masked-reveal[data-masked-reveal] {
visibility: visible;
}
.masked-reveal .word {
transform: none;
}
}
GSAP ScrollTrigger
This helper avoids the paid SplitText plugin and keeps spaces intact.
document.documentElement.classList.add("js");
gsap.registerPlugin(ScrollTrigger);
function escapeHTML(value) {
return value
.replace(/&/g, "&")
.replace(/</g, "<")
.replace(/>/g, ">")
.replace(/"/g, """)
.replace(/'/g, "'");
}
function splitMaskedReveal(element) {
if (element.dataset.maskedRevealReady === "true") return;
const text = element.textContent.trim();
element.setAttribute("aria-label", text);
element.innerHTML = text
.split(/(\s+)/)
.map((part) => {
if (!part.trim()) return part;
return `<span class="word-mask" aria-hidden="true"><span class="word">${escapeHTML(part)}</span></span>`;
})
.join("");
element.dataset.maskedRevealReady = "true";
element.classList.add("is-split");
}
function initMaskedReveals(selector = "[data-masked-reveal]") {
if (window.matchMedia("(prefers-reduced-motion: reduce)").matches) return;
document.querySelectorAll(selector).forEach((element) => {
splitMaskedReveal(element);
const words = element.querySelectorAll(".word");
gsap.set(element, { autoAlpha: 1 });
gsap.fromTo(
words,
{ yPercent: 110 },
{
yPercent: 0,
duration: 0.8,
ease: "power3.out",
stagger: 0.035,
scrollTrigger: {
trigger: element,
start: "top 82%",
once: true,
},
}
);
});
}
initMaskedReveals();
React Cleanup Pattern
useLayoutEffect(() => {
const ctx = gsap.context(() => {
initMaskedReveals("[data-masked-reveal]");
}, rootRef);
return () => ctx.revert();
}, []);
Taste Rules
- Use on short headlines, labels, and section intros; avoid long paragraphs.
- Keep the vertical offset clean. Do not combine with blur unless the style explicitly calls for it.
- Stagger by word, not letter, for a calmer editorial feel.
- Initialize after fonts are loaded if line wrapping is critical.
- Use
ScrollTrigger.refresh()after late-loading images or layout shifts. - Do not split text that contains links, buttons, or meaningful inline markup.
Quick Checks
- Text is hidden before GSAP initializes, then becomes visible with
autoAlpha: 1. - Screen readers get the original full text through
aria-label. - Spaces between words are preserved.
- Reduced-motion users see static text.
- ScrollTrigger is cleaned up in SPA routes.
相關資源

GSAP
Skill用 GSAP 编写或调试网页动画:补间、时间线与位置参数、缓动、错峰,以及 ScrollTrigger 的固定与滚动联动;说明优先动 transform、在 React 中用 gsap.context() 清理、图片加载后刷新等常见问题。
MengTo/Skills6.8k
GSAP ScrollTrigger Storytelling
Skill用 GSAP ScrollTrigger 搭建滚动叙事式产品页:固定主画面,随滚动逐步揭示界面状态、功能层与数据视图,区块之间用缩放、遮罩或模糊过渡;要求及时清理触发器、小屏简化编排、不遮挡文字与按钮。
MengTo/Skills6.8k
Compact Landing
Skill构建紧凑、精致的落地页与产品页骨架:动手前先定好构图、配色、字体、圆角、表面与动效等「设计指纹」,每次换一种视觉方向,突出一个产品本身的演示件,首屏放主要操作;动效只用 transform、opacity 与 filter,保证零布局偏移,兼顾移动端、键盘焦点与减少动态效果设置。
danielwh2/compact-landing-skill37
Accessible Animation
Skill让网页动画尊重系统的「减少动态效果」设置:把动画分为直接移除(视差、大范围位移、接管滚动)、减弱缩短、始终保留三档,而不是一刀切全部关掉;给出 CSS 媒体查询与 JS matchMedia 的写法,覆盖 GSAP、Framer Motion、Lenis 等库,对应 WCAG 2.3.3。
iart-ai/web-animation-skills45
GSAP Web
Skill用 GSAP 做代码驱动的网页动效:时间线编排、ScrollTrigger 滚动触发、固定与横向滚动、SplitText 文字拆分动画、Flip 布局过渡,以及与 Lenis、Locomotive 平滑滚动同步时常见的抖动与固定错位问题。
iart-ai/web-animation-skills43
GSAP AI Skills
SkillGSAP 官方动画技能合集:教 agent 正确使用核心 API、时间轴、ScrollTrigger 与各类插件,涵盖 React/Vue/Svelte 集成和动画性能优化。GreenSock 官方维护,所有插件均免费。
greensock/gsap-skills16.6k