跳到正文
UIGrammer
EN 中文

动画 · 滚动触发 · 12

视差背景

视差背景 = 滚动时各图层以不同速度移动,在不离开合成层的前提下制造纵深。

直达修改 Prompt

尊重 prefers-reduced-motion:动画关闭,仅保留终态。

视差背景是什么?

视差伪造纵深:后层慢移、前层快移,场景显得立体。速度差要小——视差过强让文字难读,还可能引发晕动。原生 CSS 滚动驱动动画免去滚动监听。

动画 标本

触发
scroll
技术
scroll-driven
时长
3s
缓动
ease-in-out
性能
transform

什么时候用

  • Hero backgrounds, product storytelling, landing pages
  • Any scene that benefits from a sense of depth

什么时候别用

  • Text-heavy sections — parallax fights reading
  • Users prone to motion sickness (keep it minimal or off)

Small speed gap. Heavy parallax hurts readability and can cause nausea; offer a reduced-motion lock.

Build a two-layer parallax: back drifts slowly, front faster, both transform-only and scroll-linked via animation-timeline: view().