scroll-scrubbed-visual-sequence
它能做什么
这个技能把视觉变化(例如产品组装或物体旋转)与页面滚动位置相连。适合希望用滚动驱动故事、并有可靠备用方案的设计师和开发者。
适用场景
- ✓当你希望读者向下滚动时,产品逐步组装或旋转时。
- ✓当首屏的状态需要根据访客滚动的距离而改变时。
- ✓当你需要一个能随原生滚动双向播放的示意图或照片序列时。
技能链接
https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/scroll-scrubbed-visual-sequence/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“我希望页面上的产品视频在人们向下滚动时正向播放,向上滚动时倒退播放。”
每周 5 个新技能,1 分钟读完。
工作原理
智能体会根据滚动位置定义一个进度值,并用它驱动所选的渲染方式,可以是视频、图片、画布或 SVG。滚动精确控制当前帧,因此计时器和滚轮移动不会决定状态。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
Scroll-Scrubbed Visual Sequence
Turn one visual transformation into a responsive scroll instrument. Keep the page usable without motion and keep the renderer replaceable.
Define the sequence
Write the visual states before coding:
const sequence = {
scrollVh: 280,
frameCount: 96,
fit: "contain",
posterFrame: 0,
reducedMotionFrame: 95,
copyStops: [0, 0.42, 0.78]
};
Use one normalized value for every renderer:
const progress = Math.min(1, Math.max(0,
(viewportTop - sectionTop) / (sectionHeight - viewportHeight)
));
Never make wheel delta, elapsed time, or autoplay the source of truth. Native scroll position must determine the exact visual state in both directions.
Choose the renderer
- Use video when the sequence is continuous, photographic, or expensive to render live. Encode frequent keyframes, preload metadata, reserve the aspect ratio, and coalesce
currentTimewrites inrequestAnimationFrame. - Use an image sequence when exact art-directed frames matter. Preload the current frame first, then nearby frames; never block first paint on the whole set.
- Use canvas for procedural drawing or compositing. Cap device pixel ratio at 2 and redraw only when progress changes.
- Use SVG or DOM for diagrams, product cards, interface states, and accessible text. Drive transforms, opacity, clip paths, and CSS variables instead of layout-heavy properties.
- Use WebGL only when depth, lighting, or a real 3D camera materially strengthens the idea. Provide a static poster and dispose resources.
Build the scroll stage
- Keep the section in normal document flow and set its height from
scrollVh. - Put the visual in a
position: stickystage sized to the viewport. - Keep copy and controls in a separate layer. Do not bake essential text into frames.
- Map progress to the renderer with no implicit easing. Add optional smoothing after correctness is proven.
- Refresh measurements after fonts and intrinsic media sizes settle.
- Release the sticky stage cleanly before the next section and keep the footer reachable.
Use GSAP ScrollTrigger when the project already uses GSAP or needs exact pin, refresh, and timeline coordination:
ScrollTrigger.create({
trigger: section,
start: "top top",
end: () => `+=${innerHeight * 2.8}`,
pin: stage,
scrub: true,
invalidateOnRefresh: true,
onUpdate: ({ progress }) => render(progress)
});
For a dependency-free implementation, measure the section on scroll and resize, then schedule one render per animation frame.
Handle media safely
- Keep a poster visible until the first real frame paints.
- Clamp frame indexes to
0...frameCount - 1. - Cancel stale image requests and never queue every seek during fast scrolling.
- Use
object-fitand an explicit focal point so the subject survives mobile crops. - Pause decoding, rendering, and observation while the section is offscreen or the document is hidden.
- Clean up ScrollTriggers, observers, listeners, animation frames, Blob URLs, and renderer resources on route change or unmount.
Preserve access and control
- Keep headings, copy, captions, and the CTA in semantic HTML.
- Do not trap scrolling, block keyboard navigation, or require precise pointer input.
- Under
prefers-reduced-motion: reduce, remove pinning and scrubbing, render the selected static frame, and restore ordinary document flow. - If the sequence communicates ordered information, expose the same states as text or a list.
Tune deliberately
Expose scroll distance, renderer, frame count, poster frame, media fit, focal point, copy stops, overlay strength, smoothing, and reduced-motion state as configuration. Avoid magic numbers distributed across event handlers.
Verify
Check forward and reverse scrolling, fast flicks, resize while active, 390/768/1024/1440 widths, unloaded frames, blocked video, reduced motion, keyboard order, route cleanup, and console errors. The same scroll position must always reproduce the same state.
Use demo/index.html as the working reference and demo/PROMPT.md to recreate or remix it. Keep REFERENCES.md as the links-only implementation source list.
常见问题
应该选择哪种渲染方式?
该技能建议:平滑的摄影序列用视频,精确的帧用图片,绘图用画布,示意图和文字用 SVG 或 DOM。
它会劫持滚动吗?
不会。它使用原生页面滚动,因此页面在无动效时依然可用。
它会一次性加载所有帧吗?
不会。图片序列会先加载当前帧,再加载附近的帧。
详情
作者的原始描述
Build reversible scroll-controlled visual transformations with a pinned or sticky stage, normalized progress, and video, image-sequence, canvas, SVG, or DOM renderers. Use for hero transformations, product assembly, interface state walkthroughs, object rotation, diagrams, or photo sequences that must move forward and backward with native scrolling.
repo: MengTo/Skills
热度
- GitHub 星标
- 7.2k
- 排名
- #13463
- 许可证
- MIT
- 更新时间
- 2026/11/1
评论
- …
同一仓库的更多技能
3d-cloth-material
7.2k帮你的智能体在 Three.js 中制作逼真的编织织物,包括纱线编织纹理、柔和光泽、自然褶皱、下摆和缝线。
3d-falling-leaves
7.2k帮你的智能体在 3D 场景中添加逼真的飘落树叶,树叶会翻滚、随风飘动,并在镜头移动时循环利用。
3d-four-seasons
7.2k帮你的智能体为 3D 场景添加春夏秋冬四季效果,无需重建场景即可改变植被、光线、天空和积雪。
3d-high-poly-models
7.2k帮你的智能体构建形状平滑、边缘可信的精细 3D 模型,然后制作在网页上运行流畅的轻量版本。