|
10 | 10 | <section id="more-examples"> |
11 | 11 | <h2>More Examples</h2> |
12 | 12 |
|
13 | | - <h3>Staggered Animation</h3> |
| 13 | + <h3 id="staggered-animation">Staggered Animation</h3> |
14 | 14 |
|
15 | 15 | <blockquote> |
16 | 16 | <a href="https://motion.dev/docs/stagger" target="_blank" rel="nofollow noopener noreferrer" |
|
56 | 56 | </div>`} |
57 | 57 | /> |
58 | 58 |
|
59 | | - <h3 class="mt-8">Enable/Disable Animation</h3> |
| 59 | + <h3 id="timeline-sequences" class="mt-8">Timeline Sequences</h3> |
| 60 | + |
| 61 | + <blockquote> |
| 62 | + <a |
| 63 | + href="https://motion.dev/docs/animate#timeline-sequences" |
| 64 | + target="_blank" |
| 65 | + rel="nofollow noopener noreferrer">https://motion.dev/docs/animate#timeline-sequences</a |
| 66 | + > |
| 67 | + </blockquote> |
| 68 | + |
| 69 | + <div |
| 70 | + style="display:flex;gap:8px" |
| 71 | + use:inView={[ |
| 72 | + (el) => { |
| 73 | + const children = [...el.children]; |
| 74 | + |
| 75 | + animate([ |
| 76 | + [children[0], { y: [100, 0], opacity: [0, 100] }, { duration: 0.5, at: '-0.3' }], |
| 77 | + [children[1], { rotate: [90, 0], opacity: [0, 100] }, { duration: 0.5, at: '-0.3' }], |
| 78 | + [children[2], { x: [-100, 0], opacity: [0, 100] }, { duration: 0.5, at: '-0.3' }], |
| 79 | + [children[3], { scale: [0, 1], opacity: [0, 100] }, { duration: 0.5, at: '-0.3' }] |
| 80 | + ]); |
| 81 | + } |
| 82 | + ]} |
| 83 | + > |
| 84 | + <div style="height:64px;flex:1 1 0%;min-width:0;background:#FF4136"></div> |
| 85 | + <div style="height:64px;flex:1 1 0%;min-width:0;background:#FF851B"></div> |
| 86 | + <div style="height:64px;flex:1 1 0%;min-width:0;background:#FFDC00"></div> |
| 87 | + <div style="height:64px;flex:1 1 0%;min-width:0;background:#2ECC40"></div> |
| 88 | + </div> |
| 89 | + |
| 90 | + <Code |
| 91 | + code={`<div |
| 92 | + style="display:flex;gap:8px" |
| 93 | + use:inView={[ |
| 94 | + (el) => { |
| 95 | + const children = [...el.children]; |
| 96 | +
|
| 97 | + animate([ |
| 98 | + [children[0], { y: [100, 0], opacity: [0, 100] }, { duration: 0.5, at: '-0.3' }], |
| 99 | + [children[1], { rotate: [90, 0], opacity: [0, 100] }, { duration: 0.5, at: '-0.3' }], |
| 100 | + [children[2], { x: [-100, 0], opacity: [0, 100] }, { duration: 0.5, at: '-0.3' }], |
| 101 | + [children[3], { scale: [0, 1], opacity: [0, 100] }, { duration: 0.5, at: '-0.3' }] |
| 102 | + ]); |
| 103 | + } |
| 104 | + ]} |
| 105 | +> |
| 106 | + <div style="height:64px;flex:1 1 0%;min-width:0;background:#FF4136"></div> |
| 107 | + <div style="height:64px;flex:1 1 0%;min-width:0;background:#FF851B"></div> |
| 108 | + <div style="height:64px;flex:1 1 0%;min-width:0;background:#FFDC00"></div> |
| 109 | + <div style="height:64px;flex:1 1 0%;min-width:0;background:#2ECC40"></div> |
| 110 | +</div>`} |
| 111 | + /> |
| 112 | + |
| 113 | + <h3 id="enable-disable-animation" class="mt-8">Enable/Disable Animation</h3> |
60 | 114 |
|
61 | 115 | <label><input type="checkbox" bind:checked={enabled} /> Enable Animation</label> |
62 | 116 |
|
|
0 commit comments