跳到正文
Skillpedia
网站与界面(前端)7.2k · #13441

horizontal-scroll-scenes

它能做什么

这个技能指导 AI 智能体制作网页,让纵向滚动沿着横向舞台推进故事中的场景。适合制作分章节的产品故事、作品集或展示页面的设计师。

适用场景

  • ✓当你希望访客向下滚动时,各章节逐个场景横向推进时。
  • ✓当故事需要在每个章节有停留点,而不是连续流动时。
  • ✓当访客回滚、拖动滚动条或刷新页面后,仍需停在正确的场景上时。

技能链接

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

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

使用方法

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

可直接粘贴的消息

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

可以这样问 AI

“请帮我做一个四个章节的滚动故事,章节从左到右滑动,场景之间有擦除过渡,并带有章节索引。”

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

工作原理

智能体会使用一个函数读取滚动位置,计算当前场景以及访客在该场景中的进度。屏幕上的所有内容都由这一个数值绘制,因此不存在会出现不同步的状态。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Horizontal Scroll Scenes

The mechanism: scroll position is the only state. One pure function turns scrollY / (scrollHeight - innerHeight) into {scene, dwell 0→1, move 0→1} every frame, and everything on screen (camera, wipe line, craft clock, text, index) is written from that triple. Nothing remembers where you were, so every beat is a place on the page.

This is what Kibori does, and it is not a translateX slider. Verified by running it: the page is a 1742vh native-scroll track (15,678 px at 1440×900); a fixed stage holds one WebGL world whose camera travels 0 → 49.7 world units left to right through eight stations; between stations a ragged burn line wipes from a frozen frame of the scene being left to the live scene already framed on the next. There is no wheel handler, no snap, no stored "current chapter". Reload at depth, scrollbar drag and anchor jumps work because state is derived, not accumulated.

Reach for scroll-world-storytelling or build-threejs-scroll-worlds for the story and 3D-world side, gsap-scrolltrigger-storytelling for pinned sticky sections, scroll-progress-timeline for a progress line. Reach for this when the deliverable is discrete chapters with a resting beat each, laid along an X axis, and the hard part is making that state machine survive reverse, skip and refresh. The demo is Vanilla JavaScript + DOM/CSS + inline SVG; the source is three.js. The state machine is identical.

The pace: two weights and a track height

Every number lives in DWELL, MOVE and the track height. One unit is one screen of scrolling.

constant value meaning
DWELL 1.15 scroll spent inside a scene while its craft advances (about 1,030 px at 900 tall)
MOVE 0.85 scroll spent crossing to the next scene (about 760 px); the last scene has none
CYC 2.00 one scene per two screens
SPAN N*DWELL + (N-1)*MOVE 8 scenes: 15.15 plus a 1.35 footer = 16.5; demo, 5 scenes: 9.15
track (SPAN + 1) * 100vh so 1 unit ≈ 1 screen; Kibori is 1742vh for 16.5
function travel(sp){                              // sp = scrollY / (scrollHeight - innerHeight)
  const u  = Math.min(SPAN - 1e-5, sp*SPAN);
  const i  = Math.min(N - 1, Math.floor(u/CYC));
  const local = u - i*CYC;
  const dw = Math.min(1, local/DWELL);                        // the scene's own clock
  const f  = i >= N-1 ? 0 : clamp01((local - DWELL)/MOVE);    // the move
  const rc = clamp01((f - 0.01)/0.97);                        // the line's own clock
  return {i, u, dw, f, fe: sstep(0,1,f), L: -0.08 + 1.24*rc,  // L: line, off-frame at both ends
          live: Math.min(N-1, f < 0.39 ? i : i+1)};           // what the index shows
}

Normalise by scrollHeight - innerHeight, never a hard-coded pixel height: a phone's collapsing URL bar changes innerHeight mid-scroll and a px map drifts.

Rules, each with the failure it prevents

  1. Derive, do not accumulate. Never keep currentScene or add wheel deltas. Stored state desyncs on scrollbar drag, Home/End, anchor jumps, back-forward and refresh. Prove it: record a signature of every visible style at 20 u values going forward, then again in reverse, then by jumping straight to each, then after reload() at three depths. All must be equal (the demo run: 0 mismatches of 21, 0 skip, 0 reload).
  2. No wheel hijack, no scroll-snap. Hijacking breaks touch, trackpad momentum, Space/PageDown and find-in-page. Snap fights the dwell, which is already the resting plateau (1.15 screens where nothing moves but the craft). Native scrolling stays 1:1: 2,000 px of wheel gave exactly u = 2000/(scrollHeight - vh)*SPAN.
  3. Pin the craft clock outside its dwell. Scene k's progress is 1 if k < i, dw if k == i, 0 after. Then nothing snaps back behind you and reverse retraces exactly. Write it as --p{k} and eased --e{k} custom properties on the stage; both world copies read them, so it is one write per frame.
  4. A move with nothing moving is dead scroll. Start the line at the frame's edge almost at once (rc = (f-0.01)/0.97); starting it further off made the first eighth of every move do nothing.
  5. The wipe hides the camera. Freeze the outgoing frame ahead of the line and have the live world already standing on the destination behind it. A camera still travelling under the line reads as a double exposure. Demo: layer A at camera i clipped to the far side of the line, layer B at
常见问题

它会记住访客所在的位置吗?

不会。该技能从滚动位置推导出每个场景,因此刷新或跳转后都能落在正确的场景上。

它是一个简单的横向滑块吗?

不是。该技能不是基础滑块,场景之间使用的是擦除过渡。

它需要框架吗?

演示使用纯 JavaScript、DOM 和 CSS,并结合内联 SVG,不依赖任何框架。

详情

作者的原始描述

Build scene-by-scene chapters that advance left to right on one fixed stage while the user scrolls vertically, with native scroll as the only input. One pure function turns scrollY into scene, dwell and move, so forward, reverse, scrollbar drags, fast skips and reload at depth all land on the right frame. Covers dwell versus transition budgets, a burn-wipe or pan between scenes, chapter index and progress UI, glide-to-scene links that skip intermediate scenes, keyboard and reduced-motion behaviour. Use for horizontal scrollytelling, multi-scene product tours, "scroll down to travel sideways",

repo: MengTo/Skills

热度

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

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能