-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathanimation-test.stx
More file actions
80 lines (71 loc) · 1.85 KB
/
animation-test.stx
File metadata and controls
80 lines (71 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<script server>
import { defineProps, withDefaults } from 'stx'
interface AnimationTestProps {
title?: string
items?: string[]
}
const { title, items } = withDefaults(
defineProps<AnimationTestProps>(),
{
title: 'stx Animation Test',
items: ['Fade', 'Slide', 'Scale', 'Flip', 'Rotate']
}
)
</script>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>stx Animation Test</title>
<style>
body {
font-family: system-ui, -apple-system, sans-serif;
line-height: 1.6;
max-width: 800px;
margin: 0 auto;
padding: 2rem;
}
.card {
padding: 1rem;
margin: 1rem 0;
border-radius: 0.5rem;
background-color: #f5f5f5;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
</style>
</head>
<body>
<h1>{{ title }}</h1>
<!-- Using transition directive -->
@transition(fade, 500, ease-out)
<div class="card">
<h2>Fade Transition</h2>
<p>This element uses the @transition directive with fade.</p>
</div>
@endtransition
<!-- Using scroll animation -->
@scrollAnimate(slide, 400, ease-in-out, 0.2)
<div class="card">
<h2>Scroll Animation</h2>
<p>This element will animate when scrolled into view.</p>
</div>
@endscrollAnimate
<!-- Animation group example -->
<div id="animation-group">
@foreach (items as item)
<div id="item-{{ loop.index }}" class="card">
<h2>{{ item }}</h2>
<p>Item {{ loop.index + 1 }} in animation group.</p>
</div>
@endforeach
</div>
@animationGroup(staggered, #item-0, #item-1, #item-2, #item-3, #item-4)
<div class="stx-transition stx-scale">
<div class="card">
<h2>Manual Class Usage</h2>
<p>This element uses stx animation classes directly.</p>
</div>
</div>
</body>
</html>