跳到正文
Skillpedia
动效与动画7.2k · #13462

scroll-progress-timeline

它能做什么

这个技能制作一条进度线,把有先后顺序的步骤连接起来,并在读者滚动时突出显示每一步。适合展示入门流程、路线图、案例研究或流程的设计师和开发者。

适用场景

  • ✓当你有一个有先后顺序的流程,例如入门或结账流程,需要在滚动时显示进度时。
  • ✓当路线图或历史页面需要一条随读者浏览而逐渐填满的线时。
  • ✓当步骤在手机上以及关闭动效时仍需清楚可读时。

技能链接

https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/scroll-progress-timeline/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/MengTo/Skills/blob/main/agent-skills/web-design/scroll-progress-timeline/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我希望把我们的五个入门步骤展示为一条时间线,人们向下滚动时,连接线会逐渐填满。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会构建一个真实的有序列表,绘制底线和其上的进度线,并根据第一步和最后一步计算进度。当进度线到达某一步时,该步骤就会高亮显示。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Scroll Progress Timeline

Use one progress line to connect ordered information. The sequence must remain complete, readable, and navigable before animation is added.

Model the steps

Keep the content data-driven:

const steps = [
  { id: "brief", number: "01", title: "Set the direction", body: "..." },
  { id: "build", number: "02", title: "Make the system", body: "..." },
  { id: "ship", number: "03", title: "Release and learn", body: "..." }
];

Render it as an ordered list with real headings. The line, dots, media, and active state enhance that structure; they do not replace it.

Build the line

  1. Render a quiet base line behind every point.
  2. Place one progress line on top with transform-origin: top for vertical or left for horizontal.
  3. Measure the first and last point centers, not arbitrary section edges.
  4. Normalize scroll position between those centers.
  5. Apply scaleY(progress) or scaleX(progress) so updates stay on the compositor.
  6. Mark a step active when the progress head crosses its center.
const progress = Math.min(1, Math.max(0,
  (viewportAnchor - lineStart) / (lineEnd - lineStart)
));
line.style.transform = `scaleY(${progress})`;

Schedule DOM writes in one animation frame. Recalculate geometry after font and image loading, resize, orientation changes, and content mutation.

Choose the layout

  • Use a centered alternating timeline only when both sides have enough width and similar content weight.
  • Use a left rail for long copy, compact steps, or mixed card heights.
  • Use a horizontal line for short sequences with concise labels and explicit keyboard-safe overflow.
  • Use pinned full-screen chapters only when each step carries a distinct visual state. Keep the pin finite and release before the next section.
  • Collapse to a simple left rail on small screens. Do not preserve alternation at the expense of reading order.

Animate step state

Use small opacity, translate, scale, blur, color, or media transitions. Keep every step readable while inactive. Expose active index with aria-current="step" only when that state is meaningful and current; do not announce every scroll update with a live region.

Use IntersectionObserver for simple active-state entry. Use a normalized scroll measurement or GSAP ScrollTrigger when the line must fill continuously or coordinate pinned media.

Handle navigation

  • Make step links real anchors when users can jump within the process.
  • Add scroll-margin for sticky headers.
  • Preserve focus and do not move it during passive scrolling.
  • Keep URLs and browser history stable unless the user explicitly selects a step.
  • If steps are interactive, use buttons or links with visible focus; never make a decorative dot the only control.

Reduce motion

Under prefers-reduced-motion: reduce, show the complete line or discrete reached states without scrubbed interpolation, blur, pinning, or large transforms. Keep ordinary document flow and all step content.

Verify

Test variable step counts, uneven card heights, missing media, long translations, 390/768/1024/1440 widths, 200% zoom, fast forward and reverse scrolling, direct anchor navigation, keyboard order, reduced motion, late font/image layout, route cleanup, and console errors. The active step and line head must agree at every boundary.

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.

常见问题

动画会隐藏内容吗?

不会。该技能强调,在添加动画之前,整个序列必须保持完整、清晰可读。

它在手机上能用吗?

该技能涵盖响应式折叠,因此在窄屏上布局可以变化。

支持减少动效吗?

支持。该技能包含减少动态效果时的表现方式。

详情

作者的原始描述

Turn any ordered process into a data-driven vertical or horizontal scroll story with a base line, progress fill, active step states, responsive collapse, semantic fallback, and reduced-motion behavior. Use for onboarding, checkout, roadmaps, recipes, case studies, service processes, histories, or narratives where progress through the sequence should become visible while scrolling.

repo: MengTo/Skills

热度

GitHub 星标
7.2k
排名
#13462
许可证
MIT
更新时间
2026/11/1

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能