@lovince/motion 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/styles/presets.css +160 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lovince/motion",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "A framework-agnostic motion system: native CSS reveals, managed GSAP timelines and scroll scenes, and Lenis smooth scrolling — with mandatory cleanup and reduced-motion handling.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
package/styles/presets.css
CHANGED
|
@@ -56,3 +56,163 @@
|
|
|
56
56
|
clip-path: none;
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* Stage carousel for `CarouselRoot mode="stage"`: slides stacked in the
|
|
62
|
+
* viewport, one in front and its neighbours peeking out dimmed behind it.
|
|
63
|
+
* Mark an image with `data-carousel-media` and a caption with
|
|
64
|
+
* `data-carousel-copy` to get their motion too.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
[data-mode='stage'][data-carousel-viewport] {
|
|
68
|
+
--lovince-carousel-duration: calc(var(--motion-duration-scene) * 1.5);
|
|
69
|
+
--lovince-carousel-ease: var(--motion-ease-emphasized);
|
|
70
|
+
--lovince-carousel-peek: 22.5%;
|
|
71
|
+
--lovince-carousel-active-size: 60%;
|
|
72
|
+
--lovince-carousel-side-size: 91.5%;
|
|
73
|
+
--lovince-carousel-side-height: 72%;
|
|
74
|
+
--lovince-carousel-side-opacity: 0.7;
|
|
75
|
+
--lovince-carousel-side-dim: 0.62;
|
|
76
|
+
position: relative;
|
|
77
|
+
isolation: isolate;
|
|
78
|
+
aspect-ratio: var(--lovince-carousel-ratio, 2.7);
|
|
79
|
+
overflow: hidden;
|
|
80
|
+
outline-offset: var(--lovince-space-1);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
[data-mode='stage'][data-carousel-viewport] > [data-carousel-slide] {
|
|
84
|
+
position: absolute;
|
|
85
|
+
top: 50%;
|
|
86
|
+
left: 50%;
|
|
87
|
+
width: var(--lovince-carousel-active-size);
|
|
88
|
+
height: 81%;
|
|
89
|
+
overflow: hidden;
|
|
90
|
+
border-radius: var(--lovince-radius-md);
|
|
91
|
+
transform: translate(-50%, -50%);
|
|
92
|
+
opacity: 0;
|
|
93
|
+
pointer-events: none;
|
|
94
|
+
z-index: 0;
|
|
95
|
+
transition:
|
|
96
|
+
transform var(--lovince-carousel-duration) var(--lovince-carousel-ease),
|
|
97
|
+
width var(--lovince-carousel-duration) var(--lovince-carousel-ease),
|
|
98
|
+
height var(--lovince-carousel-duration) var(--lovince-carousel-ease),
|
|
99
|
+
opacity calc(var(--lovince-carousel-duration) * 0.82) var(--lovince-carousel-ease),
|
|
100
|
+
filter var(--lovince-carousel-duration) var(--lovince-carousel-ease),
|
|
101
|
+
box-shadow var(--lovince-carousel-duration) var(--lovince-carousel-ease);
|
|
102
|
+
will-change: transform, opacity;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='active'] {
|
|
106
|
+
height: 100%;
|
|
107
|
+
opacity: 1;
|
|
108
|
+
z-index: 3;
|
|
109
|
+
pointer-events: auto;
|
|
110
|
+
box-shadow: var(--lovince-shadow-lg);
|
|
111
|
+
transform: translate(calc(-50% + var(--lovince-carousel-drag, 0px)), -50%);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='previous'],
|
|
115
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='next'] {
|
|
116
|
+
width: var(--lovince-carousel-side-size);
|
|
117
|
+
height: var(--lovince-carousel-side-height);
|
|
118
|
+
opacity: var(--lovince-carousel-side-opacity);
|
|
119
|
+
z-index: 2;
|
|
120
|
+
filter: brightness(var(--lovince-carousel-side-dim));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='previous'] {
|
|
124
|
+
transform: translate(calc(-50% - var(--lovince-carousel-peek) + var(--lovince-carousel-drag, 0px)), -50%);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='next'] {
|
|
128
|
+
transform: translate(calc(-50% + var(--lovince-carousel-peek) + var(--lovince-carousel-drag, 0px)), -50%);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='far'] {
|
|
132
|
+
transform: translate(-50%, -45%) scale(0.94);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
[data-mode='stage'][data-swiping] > [data-carousel-slide] {
|
|
136
|
+
transition: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
[data-mode='stage'][data-orientation='vertical'] {
|
|
140
|
+
aspect-ratio: var(--lovince-carousel-ratio, 0.75);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-carousel-slide] {
|
|
144
|
+
width: 81%;
|
|
145
|
+
height: var(--lovince-carousel-active-size);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='active'] {
|
|
149
|
+
width: 100%;
|
|
150
|
+
transform: translate(-50%, calc(-50% + var(--lovince-carousel-drag, 0px)));
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='previous'],
|
|
154
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='next'] {
|
|
155
|
+
width: var(--lovince-carousel-side-height);
|
|
156
|
+
height: var(--lovince-carousel-side-size);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='previous'] {
|
|
160
|
+
transform: translate(-50%, calc(-50% - var(--lovince-carousel-peek) + var(--lovince-carousel-drag, 0px)));
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='next'] {
|
|
164
|
+
transform: translate(-50%, calc(-50% + var(--lovince-carousel-peek) + var(--lovince-carousel-drag, 0px)));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
[data-mode='stage'][data-orientation='vertical'] > [data-position='far'] {
|
|
168
|
+
transform: translate(-45%, -50%) scale(0.94);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
[data-mode='stage'] [data-carousel-media] {
|
|
172
|
+
display: block;
|
|
173
|
+
width: 100%;
|
|
174
|
+
height: 100%;
|
|
175
|
+
object-fit: cover;
|
|
176
|
+
pointer-events: none;
|
|
177
|
+
transition: transform calc(var(--lovince-carousel-duration) * 1.64) var(--lovince-carousel-ease);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='active'] [data-carousel-media] {
|
|
181
|
+
transform: scale(1.015);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
[data-mode='stage'] [data-carousel-copy] {
|
|
185
|
+
opacity: 0;
|
|
186
|
+
transform: translate3d(0, var(--motion-distance-sm), 0);
|
|
187
|
+
transition:
|
|
188
|
+
opacity calc(var(--lovince-carousel-duration) * 0.6) var(--lovince-carousel-ease),
|
|
189
|
+
transform calc(var(--lovince-carousel-duration) * 0.72) var(--lovince-carousel-ease);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='active'] [data-carousel-copy] {
|
|
193
|
+
opacity: 1;
|
|
194
|
+
transform: none;
|
|
195
|
+
transition-delay: var(--motion-duration-normal);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
@media (max-width: 43.75rem) {
|
|
199
|
+
[data-mode='stage'][data-carousel-viewport]:not([data-orientation='vertical']) {
|
|
200
|
+
--lovince-carousel-peek: 31%;
|
|
201
|
+
--lovince-carousel-active-size: 76%;
|
|
202
|
+
--lovince-carousel-side-opacity: 0.55;
|
|
203
|
+
aspect-ratio: var(--lovince-carousel-ratio, 1.47);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
@media (prefers-reduced-motion: reduce) {
|
|
208
|
+
[data-mode='stage'][data-carousel-viewport] > [data-carousel-slide],
|
|
209
|
+
[data-mode='stage'] [data-carousel-media],
|
|
210
|
+
[data-mode='stage'] [data-carousel-copy] {
|
|
211
|
+
transition-duration: 0s;
|
|
212
|
+
transition-delay: 0s;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
[data-mode='stage'][data-carousel-viewport] > [data-position='active'] [data-carousel-media] {
|
|
216
|
+
transform: none;
|
|
217
|
+
}
|
|
218
|
+
}
|