Skip to content

Commit c4d2c47

Browse files
✨ Add animations to v4 features section
1 parent 8c53ef1 commit c4d2c47

File tree

2 files changed

+128
-8
lines changed

2 files changed

+128
-8
lines changed

resources/js/app.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,20 @@ import '../../docs/src/styles/docsearch.css'
1414
import 'swiper/css'
1515
import 'swiper/css/navigation'
1616
import 'swiper/css/pagination'
17-
import { animate, inView } from 'motion'
17+
import {
18+
animate,
19+
inView,
20+
easeIn,
21+
easeOut,
22+
easeInOut,
23+
backIn,
24+
backOut,
25+
backInOut,
26+
circIn,
27+
circOut,
28+
circInOut,
29+
anticipate,
30+
} from 'motion'
1831

1932
// Swiper
2033
Swiper.use([Navigation, Pagination])
@@ -44,6 +57,16 @@ window.MiniSearch = MiniSearch
4457
window.motion = {
4558
animate: animate,
4659
inView: inView,
60+
easeIn: easeIn,
61+
easeOut: easeOut,
62+
easeInOut: easeInOut,
63+
backOut: backOut,
64+
backIn: backIn,
65+
backInOut: backInOut,
66+
circIn: circIn,
67+
circOut: circOut,
68+
circInOut: circInOut,
69+
anticipate: anticipate,
4770
}
4871

4972
// Alpine

resources/views/components/home/v4-features.blade.php

Lines changed: 104 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
<section class="mx-auto w-full max-w-screen-lg px-5 pt-20">
2-
<div class="isolate grid place-items-center">
2+
<div
3+
x-init="
4+
() => {
5+
if (reducedMotion) return
6+
const timeline = gsap
7+
.timeline({
8+
paused: true,
9+
})
10+
.fromTo(
11+
$el,
12+
{
13+
autoAlpha: 0,
14+
y: -20,
15+
},
16+
{
17+
autoAlpha: 1,
18+
y: 0,
19+
duration: 0.7,
20+
ease: 'power2.out',
21+
},
22+
)
23+
motion.inView(
24+
$el,
25+
(element) => {
26+
timeline.play()
27+
},
28+
{
29+
amount: 1,
30+
},
31+
)
32+
}
33+
"
34+
class="isolate grid place-items-center"
35+
>
336
<div
437
class="isolate grid self-center justify-self-center [grid-area:1/-1]"
538
>
@@ -136,16 +169,79 @@ class="relative -z-50 -my-14 -ml-10 w-[28rem] self-center justify-self-center [g
136169
/>
137170
</div>
138171
<h3
172+
x-init="
173+
() => {
174+
if (reducedMotion) return
175+
const timeline = gsap
176+
.timeline({
177+
paused: true,
178+
})
179+
.fromTo(
180+
$el,
181+
{
182+
autoAlpha: 0,
183+
y: 20,
184+
},
185+
{
186+
autoAlpha: 1,
187+
y: 0,
188+
duration: 0.7,
189+
ease: 'power2.out',
190+
},
191+
)
192+
motion.inView(
193+
$el,
194+
(element) => {
195+
timeline.play()
196+
},
197+
{
198+
amount: 1,
199+
},
200+
)
201+
}
202+
"
139203
class="mx-auto max-w-3xl pt-3 text-center font-afacad text-2xl leading-normal text-gray-500"
140204
>
141205
Filament 4 brings powerful new tools and flexibility, simplifying
142206
development and enabling more dynamic, efficient, and customizable web
143207
applications.
144208
</h3>
145209
<div
210+
x-init="
211+
() => {
212+
if (reducedMotion) return
213+
const timeline = gsap
214+
.timeline({
215+
paused: true,
216+
})
217+
.fromTo(
218+
$refAll('slide-in-left'),
219+
{
220+
autoAlpha: 0,
221+
x: -20,
222+
},
223+
{
224+
autoAlpha: 1,
225+
x: 0,
226+
duration: 0.7,
227+
stagger: 0.1,
228+
ease: 'power2.out',
229+
},
230+
)
231+
motion.inView(
232+
$el,
233+
(element) => {
234+
timeline.play()
235+
},
236+
{
237+
amount: 0.25,
238+
},
239+
)
240+
}
241+
"
146242
class="grid grid-cols-[repeat(auto-fill,minmax(20rem,1fr))] items-center gap-5 pt-10 *:flex *:items-center *:gap-5 *:rounded-2xl *:bg-white *:px-5 *:py-7 *:ring-1 *:ring-black/5"
147243
>
148-
<div>
244+
<div x-ref="slide-in-left">
149245
{{-- Icon --}}
150246
<svg
151247
xmlns="http://www.w3.org/2000/svg"
@@ -240,13 +336,14 @@ class="size-12 shrink-0"
240336
Nested resources
241337
</h4>
242338
{{-- Description --}}
339+
243340
<p class="font-afacad text-lg leading-snug text-gray-500">
244341
Open modals and slide-overs from any button, even nest them
245342
with full state preservation.
246343
</p>
247344
</div>
248345
</div>
249-
<div>
346+
<div x-ref="slide-in-left">
250347
{{-- Icon --}}
251348
<svg
252349
xmlns="http://www.w3.org/2000/svg"
@@ -375,7 +472,7 @@ class="size-12 shrink-0"
375472
</p>
376473
</div>
377474
</div>
378-
<div>
475+
<div x-ref="slide-in-left">
379476
{{-- Icon --}}
380477
<svg
381478
xmlns="http://www.w3.org/2000/svg"
@@ -569,7 +666,7 @@ interface when changes occur.
569666
</p>
570667
</div>
571668
</div>
572-
<div>
669+
<div x-ref="slide-in-left">
573670
{{-- Icon --}}
574671
<svg
575672
xmlns="http://www.w3.org/2000/svg"
@@ -637,7 +734,7 @@ class="size-12 shrink-0"
637734
</p>
638735
</div>
639736
</div>
640-
<div>
737+
<div x-ref="slide-in-left">
641738
{{-- Icon --}}
642739
<svg
643740
xmlns="http://www.w3.org/2000/svg"
@@ -745,7 +842,7 @@ class="size-12 shrink-0"
745842
</p>
746843
</div>
747844
</div>
748-
<div>
845+
<div x-ref="slide-in-left">
749846
{{-- Icon --}}
750847
<svg
751848
xmlns="http://www.w3.org/2000/svg"

0 commit comments

Comments
 (0)