Scroll-linked Animation new 滚动联动动画 Scroll-linked web
Motion whose progress is continuously mapped to scroll position
动画进度与滚动位置持续同步的动效
标本可交互,可以直接操作。
Anatomy — every part, named解剖 —— 每个部件的名字
-
1 Scroll progress滚动进度
animation-timeline: scroll()The normalized 0–1 value that connects scroll offset to animation progress.
把滚动偏移连接到动画进度的 0–1 归一化数值。
Prompt fragmentPrompt 片段a clamped scroll progress value that drives transform or opacity without changing layout
一个限制在 0–1 的滚动进度值,用来驱动 transform 或 opacity 而不改变布局
Prompt — paste into your agentPrompt —— 直接粘贴给你的代理
Build a scroll-linked animation whose progress follows the readable scroll range. Prefer animation-timeline: scroll() where supported, otherwise map scrollTop to a 0–1 progress value with a passive listener and requestAnimationFrame; use transforms, clamp the range, and honor prefers-reduced-motion.
构建一个进度跟随可读滚动范围的滚动联动动画。支持时优先使用 animation-timeline: scroll();否则用 passive 监听器和 requestAnimationFrame 将 scrollTop 映射为 0–1 进度;使用 transform、限制范围,并尊重 prefers-reduced-motion。
Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时
Debug my scroll-linked animation. Verify that progress is based on the intended scroll container, the denominator is not zero, values are clamped between 0 and 1, updates are passive and frame-scheduled, nested scrollers are handled intentionally, and reduced motion removes smoothing without hiding the state cue. The symptom:
调试我的滚动联动动画。确认进度来自正确的滚动容器;分母不为零;数值限制在 0 到 1;更新使用 passive 和帧调度;嵌套滚动容器有明确处理;减少动态效果时只去掉平滑过渡,不隐藏状态提示。症状:
In code代码里叫什么
| Framework框架 | Symbol符号 | Note说明 |
|---|---|---|
| CSS | animation-timeline: scroll() | native scroll-driven timeline where supported浏览器支持时使用原生滚动驱动时间线 |
| Web API | scrollTop / scrollY | fallback mapping from scroll offset to progress根据滚动偏移映射进度 |
| CSS | transform: scaleX() | animate without layout reflow用变换动画避免布局重排 |