Skip to content

Commit 7834805

Browse files
author
Adam Plesnik
committed
Tune How To anim
1 parent 00eb2db commit 7834805

File tree

5 files changed

+13
-26
lines changed

5 files changed

+13
-26
lines changed

docs/src/css/keyframes.css

-9
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,3 @@
6262
transform: translateY(-60%);
6363
}
6464
}
65-
66-
@keyframes opacity {
67-
from {
68-
opacity: 0;
69-
}
70-
to {
71-
opacity: 1;
72-
}
73-
}

docs/src/demos/TimelineOverrideDemo.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ const TimelineOverrideDemo = () => {
99
<DemoWrapper className="" actionButton>
1010
<div className="sticky top-0 flex flex-col gap-4 p-8 sm:flex-row">
1111
<div className="flex items-center">
12-
<span className="animate-opacity rounded-lg bg-sky-500/40 p-4 dark:bg-fuchsia-300/60">
12+
<span className="-translate-y-20 animate-translate-down rounded-lg bg-sky-500/40 p-4 [animation-duration:3s] dark:bg-fuchsia-300/60">
1313
<Code>timeline</Code> <span className="text-sm font-medium">before</span>{' '}
14-
<Code>animate-opacity</Code>
14+
<Code>animate-translate-down</Code>
1515
</span>
1616
</div>
1717
<div className="flex items-center">
18-
<span className="animate-opacity rounded-lg bg-sky-500/40 p-4 timeline dark:bg-fuchsia-300/60">
19-
<Code>animate-opacity</Code> <span className="text-sm font-medium">before</span>{' '}
18+
<span className="-translate-y-20 animate-translate-down rounded-lg bg-sky-500/40 p-4 timeline dark:bg-fuchsia-300/60">
19+
<Code>animate-translate-down</Code> <span className="text-sm font-medium">before</span>{' '}
2020
<Code>timeline</Code>
2121
</span>
2222
</div>

docs/src/utils/demoExamples.ts

+5-8
Original file line numberDiff line numberDiff line change
@@ -83,16 +83,13 @@ export const supports = `<div>
8383
...
8484
</div>`
8585

86-
export const keyframes101 = `@keyframes opacity {
87-
from {
88-
opacity: 0;
89-
}
86+
export const keyframes101 = `@keyframes translate-down {
9087
to {
91-
opacity: 1;
88+
transform: translateY(0);
9289
}
9390
}`
9491

95-
export const keyframes102 = `<div class="animate-opacity timeline">
92+
export const keyframes102 = `<div class="animate-translate-down timeline">
9693
<!-- The animation should be controlled by the timeline. -->
9794
</div>`
9895

@@ -101,8 +98,8 @@ export const keyframes103 = `
10198
animation-timeline: scroll(y);
10299
}
103100
104-
.animate-opacity {
105-
animation: opacity 8s ease-in-out both;
101+
.animate-translate-down {
102+
animation: translate-down 3s cubic-bezier(0.65, 0.05, 0.17, 0.99) forwards;
106103
}
107104
108105
.timeline { /* This is the correct order */

docs/src/views/HowToView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ const HowToView = () => {
2222
</Heading>
2323
<Paragraph>
2424
CSS animations consist of two components, a set of keyframes and a style describing the
25-
animation. Let's declare a simple <Code>@opacity</Code> keyframe set and apply it to an
26-
element we want to control by a scroll timeline.
25+
animation. Let's declare a simple <Code>translate-down</Code> keyframe set and apply it to
26+
an element we want to control by a scroll timeline.
2727
</Paragraph>
2828
<CodeBlock language="css">{keyframes101}</CodeBlock>
2929
<CodeBlock language="html">{keyframes102}</CodeBlock>

docs/tailwind.config.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ module.exports = {
1515

1616
/* Scroll-driven animations */
1717
appear: 'appear auto cubic-bezier(0.65, 0.05, 0.17, 0.99) forwards',
18-
down: 'translate-down auto ease-in-out forwards',
19-
opacity: 'opacity 8s ease-in-out forwards',
18+
opacity: 'opacity 2s cubic-bezier(0.65, 0.05, 0.17, 0.99) forwards',
2019
'scale-to-right': 'scale-to-right auto linear forwards',
21-
'translate-down': 'translate-down auto cubic-bezier(0.65, 0.05, 0.17, 0.99) forwards',
20+
'translate-down': 'translate-down 3s cubic-bezier(0.65, 0.05, 0.17, 0.99) forwards',
2221
'translate-up': 'translate-up auto ease-in-out forwards',
2322
},
2423
transitionTimingFunction: {

0 commit comments

Comments
 (0)