Scroll Animations

dylantarre/animation-principles/skills/05-by-animation-type/scroll-animations

作者 dylantarre83597134ba8f無授權條款99 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫9 個月前更新

Use when triggering animations on scroll - reveal effects, parallax, sticky headers, progress indicators, or any scroll-linked motion.

AI 產生的概覽

運用迪士尼十二項動畫原則指導捲動觸發的網頁動畫,並提供時間參數表與 CSS/JS 實作模式。

功能
這項技能為捲動連動的網頁動效提供指引,例如揭示效果、視差、固定頁首和進度指示器。它把迪士尼十二項動畫原則對應到捲動行為上,並以參考表給出時長、觸發點與緩動建議。它也提供 CSS 與 JavaScript 實作模式,包括 Intersection Observer 和 CSS 捲動連動動畫範例,以及關於無障礙與效能的關鍵規則。
適用情境
在網頁上實作或檢視捲動觸發動畫時使用,例如揭示效果、視差、固定頁首或進度指示器。它適合用來決定捲動連動動效的時長、觸發門檻與緩動方式。
執行需求
不包含指令碼或相依套件,僅為說明性指示。套用其中的模式需要具備 CSS 與 JavaScript 的網頁前端環境,指南中涉及瀏覽器對 Intersection Observer 與 CSS 捲動連動動畫的支援。

Scroll Animations

Apply Disney's 12 principles to scroll-triggered motion.

Principle Application

Squash & Stretch: Elements can compress slightly while scrolling fast, settle when stopped.

Anticipation: Content should be slightly visible before full reveal. Start animations at 10-20% visibility.

Staging: Reveal content in reading order. Top-to-bottom, left-to-right progression.

Straight Ahead vs Pose-to-Pose: Define clear "hidden" and "revealed" poses. Scroll position interpolates between them.

Follow Through & Overlapping: Stagger reveals. First element triggers at 20% viewport, next at 25%, etc.

Slow In/Slow Out: Use ease-out for reveals triggered by scroll. Content settles into place.

Arcs: Parallax elements move on curves relative to scroll. Slight horizontal offset as vertical scroll occurs.

Secondary Action: Fade + slide + scale can combine for richer reveals.

Timing:

  • Reveal animation: 400-600ms (allows scroll to continue)
  • Parallax: real-time, 1:1 or fractional ratios
  • Sticky transitions: 200-300ms

Exaggeration: Subtle for scroll - users control the pace. Let scroll speed be the exaggeration.

Solid Drawing: Elements should never jump or teleport. Smooth interpolation at all scroll positions.

Appeal: Scroll animations should reward exploration, not obstruct it.

Timing Recommendations

Scroll AnimationDurationTrigger PointEasing
Fade In500ms20% visibleease-out
Slide Up600ms15% visibleease-out
Parallaxreal-timecontinuouslinear
Sticky Header200msthresholdease-out
Progress Barreal-timecontinuouslinear
Section Reveal600ms25% visibleease-out

Implementation Patterns

css
/* Scroll-triggered reveal */.reveal {  opacity: 0;  transform: translateY(30px);  transition: opacity 500ms ease-out, transform 600ms ease-out;}
.reveal.visible {  opacity: 1;  transform: translateY(0);}
/* CSS-only parallax */.parallax-container {  perspective: 1px;  overflow-y: auto;}
.parallax-slow {  transform: translateZ(-1px) scale(2);}

Intersection Observer Pattern

javascript
const observer = new IntersectionObserver(  (entries) => {    entries.forEach(entry => {      if (entry.isIntersecting) {        entry.target.classList.add('visible');      }    });  },  { threshold: 0.2, rootMargin: '0px 0px -10% 0px' });
document.querySelectorAll('.reveal').forEach(el => observer.observe(el));

Scroll-Linked Animation (CSS)

css
@keyframes reveal {  from { opacity: 0; transform: translateY(30px); }  to { opacity: 1; transform: translateY(0); }}
.scroll-reveal {  animation: reveal linear both;  animation-timeline: view();  animation-range: entry 0% entry 50%;}

Key Rules

  1. Never block scroll or hijack scroll behavior
  2. Animations should complete within viewport, not require precise scroll position
  3. Trigger early (10-20% visible) so animation completes before full view
  4. Provide prefers-reduced-motion alternative - instant reveals, no parallax
  5. Test on mobile - scroll animations must be smooth at 60fps

來源與署名

來源:dylantarre/animation-principles位於skills/05-by-animation-type/scroll-animations提交8359713

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架