Scroll-triggered Animation new 滚动触发动画 Scroll-triggered web

01Scroll-triggeredenters → reveals
02In-view contentplays once
03Final state staysreadable after motion
IntersectionObserverin-view

标本可交互,可以直接操作。

Anatomy — every part, named解剖 —— 每个部件的名字

  1. 1 Visibility threshold可见阈值 IntersectionObserver

    The point at which an element counts as visible enough to reveal.

    元素达到足够可见程度、可以揭示的那个点。

    Prompt fragmentPrompt 片段

    an IntersectionObserver threshold and rootMargin that trigger the reveal shortly before the card reaches the viewport

    一个 IntersectionObserver threshold 和 rootMargin,让卡片在刚进入视口前后触发揭示

Prompt — paste into your agentPrompt —— 直接粘贴给你的代理

Add a scroll-triggered reveal to each card: use IntersectionObserver to add an in-view class when the card enters the viewport, animate opacity and translateY once, keep the final state visible, and provide a prefers-reduced-motion fallback that shows the card immediately.

给每张卡片加入滚动触发的揭示效果:用 IntersectionObserver 在卡片进入视口时添加 in-view 类,播放一次 opacity 和 translateY 动画并保留最终状态;在 prefers-reduced-motion 下直接显示卡片。

Debug prompt — when it misbehaves调试 Prompt —— 当它不听话时

Debug my scroll-triggered animation. Check that the observer uses a sensible threshold and rootMargin; the hidden initial state does not trap content when JavaScript fails; the animation is not retriggering on every scroll; cards remain visible after reveal; and prefers-reduced-motion skips the transform and opacity transition. The symptom:

调试我的滚动触发动画。检查 observer 的 threshold 和 rootMargin 是否合理;JavaScript 失败时隐藏初始状态不会把内容锁死;动画不会每次滚动都重播;揭示后卡片保持可见;prefers-reduced-motion 会跳过位移和透明度过渡。症状:

In code代码里叫什么

Framework框架Symbol符号Note说明
Web API IntersectionObserver detect viewport entry without polling scroll position无需轮询滚动位置,检测元素进入视口
CSS @keyframes + animation define the reveal motion and timing定义揭示动效和时间
CSS prefers-reduced-motion show content without motion when requested用户要求减少动态效果时直接显示内容

See also相关词条

我的参考集

组合知名网站、UI 元素、视觉风格和平面设计案例,导出给 AI。

你的下一份设计,从这里开始。

在任意案例旁点击「加入参考」,就能把品牌、组件、风格和平面设计案例组合成一份 AI 设计说明。

搜索参考库Search the library

输入关键词,搜索所有参考。