@@ -4,7 +4,15 @@ import Heading from '../components/Heading'
44import Paragraph from '../components/Paragraph'
55import MultiRangeDemo from '../demos/MultiRangeDemo'
66import SupportsDemo from '../demos/SupportsDemo'
7- import { multiRange , multiRangeKeyframes , supports } from '../utils/demoExamples'
7+ import TimelineOverrideDemo from '../demos/TimelineOverrideDemo'
8+ import {
9+ keyframes101 ,
10+ keyframes102 ,
11+ keyframes103 ,
12+ multiRange ,
13+ multiRangeKeyframes ,
14+ supports ,
15+ } from '../utils/demoExamples'
816import DocsTable from './DocsTable'
917
1018const animationTimelineClasses = [
@@ -51,6 +59,25 @@ const Docs = () => {
5159 < Heading size = { 2 } id = "documentation" >
5260 Documentation
5361 </ Heading >
62+ < Heading size = { 3 } id = "documentation-101" >
63+ How to Make Your CSS Animation Scroll-driven
64+ </ Heading >
65+ < Paragraph >
66+ CSS animations consist of two components, a set of keyframes and a style describing the
67+ animation. Let's declare a simple < Code > @opacity</ Code > keyframe set and apply it to an
68+ element we want to control by a scroll timeline.
69+ </ Paragraph >
70+ < CodeBlock language = "css" > { keyframes101 } </ CodeBlock >
71+ < CodeBlock language = "html" > { keyframes102 } </ CodeBlock >
72+ < Paragraph >
73+ To effectively control the animation, make sure to declare the timeline in the code after
74+ the animation. By default, the shorthand < Code > animation</ Code > property sets the{ ' ' }
75+ < Code > animation-timeline: auto</ Code > unless set otherwise. However, using this plugin and
76+ Tailwind CSS animations ensures that the declaration order is correct.
77+ </ Paragraph >
78+ < CodeBlock language = "css" > { keyframes103 } </ CodeBlock >
79+ < Paragraph > Scroll the container.</ Paragraph >
80+ < TimelineOverrideDemo />
5481 < Heading size = { 3 } href = "#timeline" hrefType = "demo" id = "documentation-animation-timeline" >
5582 Animation Timeline
5683 </ Heading >
@@ -59,7 +86,6 @@ const Docs = () => {
5986 animation.
6087 </ Paragraph >
6188 < DocsTable items = { animationTimelineClasses } />
62-
6389 < Heading size = { 3 } href = "#range" hrefType = "demo" id = "documentation-scroll-timeline" >
6490 Scroll Timeline
6591 </ Heading >
@@ -68,7 +94,6 @@ const Docs = () => {
6894 element.
6995 </ Paragraph >
7096 < DocsTable items = { scrollTimelineClasses } />
71-
7297 < Heading size = { 3 } href = "#range" hrefType = "demo" id = "documentation-view-timeline" >
7398 View Timeline
7499 </ Heading >
@@ -85,7 +110,7 @@ const Docs = () => {
85110 on the animated element.
86111 </ Paragraph >
87112 < DocsTable items = { rangeClasses } />
88- < Paragraph size = "small" className = "pt-6" >
113+ < Paragraph className = "pt-6" >
89114 Scroll the container to see each how range utility class affects the animation.
90115 </ Paragraph >
91116 < MultiRangeDemo />
0 commit comments