motioncss-ui 0.1.5 → 0.1.6
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/README.md +286 -15
- package/dist/motioncss-ui.css +1 -0
- package/dist/motioncss-ui.js +1242 -0
- package/dist/motioncss-ui.umd.cjs +47 -0
- package/package.json +2 -2
- package/dist/assets/main-CDZvsgSJ.js +0 -44
- package/dist/assets/main-HYdGPJ4_.css +0 -1
- package/dist/index.html +0 -13
- package/dist/showcase.html +0 -15
package/README.md
CHANGED
|
@@ -8,6 +8,8 @@ Modern React motion and CSS effects.
|
|
|
8
8
|
npm install motioncss-ui
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
---
|
|
12
|
+
|
|
11
13
|
## Magnetic
|
|
12
14
|
|
|
13
15
|
A lightweight magnetic hover effect for React elements.
|
|
@@ -19,25 +21,13 @@ import { Magnetic } from "motioncss-ui";
|
|
|
19
21
|
|
|
20
22
|
function App() {
|
|
21
23
|
return (
|
|
22
|
-
<Magnetic>
|
|
23
|
-
<button>
|
|
24
|
+
<Magnetic strength={0.4} speed={0.2} scale={1.05}>
|
|
25
|
+
<button>Get Started</button>
|
|
24
26
|
</Magnetic>
|
|
25
27
|
);
|
|
26
28
|
}
|
|
27
29
|
```
|
|
28
30
|
|
|
29
|
-
### Options
|
|
30
|
-
|
|
31
|
-
```tsx
|
|
32
|
-
<Magnetic
|
|
33
|
-
strength={0.4}
|
|
34
|
-
speed={0.2}
|
|
35
|
-
scale={1.05}
|
|
36
|
-
>
|
|
37
|
-
<button>Get Started</button>
|
|
38
|
-
</Magnetic>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
31
|
### Props
|
|
42
32
|
|
|
43
33
|
| Prop | Type | Default | Description |
|
|
@@ -47,6 +37,287 @@ function App() {
|
|
|
47
37
|
| `scale` | number | `1` | Hover scale |
|
|
48
38
|
| `className` | string | `""` | Custom CSS class |
|
|
49
39
|
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## TiltCard
|
|
43
|
+
|
|
44
|
+
A 3D tilt hover effect with optional glare highlight for cards and elements.
|
|
45
|
+
|
|
46
|
+
### Usage
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
import { TiltCard } from "motioncss-ui";
|
|
50
|
+
|
|
51
|
+
function App() {
|
|
52
|
+
return (
|
|
53
|
+
<TiltCard tilt={15} scale={1.05} glare={true}>
|
|
54
|
+
<div className="card">Hover me for 3D effect</div>
|
|
55
|
+
</TiltCard>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Props
|
|
61
|
+
|
|
62
|
+
| Prop | Type | Default | Description |
|
|
63
|
+
| ------------- | ------- | ------: | ----------------------- |
|
|
64
|
+
| `tilt` | number | `15` | Max rotation in degrees |
|
|
65
|
+
| `scale` | number | `1.03` | Scale on hover |
|
|
66
|
+
| `glare` | boolean | `true` | Show a glare highlight |
|
|
67
|
+
| `perspective` | number | `1000` | Perspective in px |
|
|
68
|
+
| `className` | string | `""` | Custom CSS class |
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## ScrollReveal
|
|
73
|
+
|
|
74
|
+
Reveals elements with animations when they scroll into view.
|
|
75
|
+
|
|
76
|
+
### Usage
|
|
77
|
+
|
|
78
|
+
```tsx
|
|
79
|
+
import { ScrollReveal } from "motioncss-ui";
|
|
80
|
+
|
|
81
|
+
function App() {
|
|
82
|
+
return (
|
|
83
|
+
<ScrollReveal animation="fade-up" duration={800} delay={100} distance={40}>
|
|
84
|
+
<h2>Reveals on Scroll</h2>
|
|
85
|
+
</ScrollReveal>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Props
|
|
91
|
+
|
|
92
|
+
| Prop | Type | Default | Description |
|
|
93
|
+
| ----------- | ------------------------------------------------------------------------------ | ----------: | -------------------------------------------------- |
|
|
94
|
+
| `animation` | `"fade" \| "fade-up" \| "fade-down" \| "fade-left" \| "fade-right" \| "zoom"` | `"fade-up"` | Animation type |
|
|
95
|
+
| `duration` | number | `700` | Duration in ms |
|
|
96
|
+
| `delay` | number | `0` | Delay in ms |
|
|
97
|
+
| `distance` | number | `32` | Distance in px for directional animations |
|
|
98
|
+
| `threshold` | number | `0.2` | Visibility ratio that triggers the animation (0-1) |
|
|
99
|
+
| `once` | boolean | `true` | Only animate once |
|
|
100
|
+
| `className` | string | `""` | Custom CSS class |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
## Spotlight
|
|
105
|
+
|
|
106
|
+
A highly customizable spotlight hover effect that follows the mouse cursor.
|
|
107
|
+
|
|
108
|
+
### Usage
|
|
109
|
+
|
|
110
|
+
```tsx
|
|
111
|
+
import { Spotlight } from "motioncss-ui";
|
|
112
|
+
|
|
113
|
+
function App() {
|
|
114
|
+
return (
|
|
115
|
+
<Spotlight size={400} intensity={0.9} color="#6366f1" mode="glow">
|
|
116
|
+
<div className="card">Move your mouse</div>
|
|
117
|
+
</Spotlight>
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Props
|
|
123
|
+
|
|
124
|
+
| Prop | Type | Default | Description |
|
|
125
|
+
| ----------- | ---------------------------------------------------- | ----------: | ------------------------------- |
|
|
126
|
+
| `size` | number | `320` | Spotlight diameter in px |
|
|
127
|
+
| `intensity` | number | `0.85` | Brightness of the lit area, 0-1 |
|
|
128
|
+
| `color` | string | `"#ffffff"` | Spotlight color |
|
|
129
|
+
| `blur` | number | `60` | Blur/softness in px |
|
|
130
|
+
| `mode` | `"radial" \| "glow" \| "soft" \| "sharp" \| "neon"` | `"radial"` | Visual mode preset |
|
|
131
|
+
| `enabled` | boolean | `true` | Whether spotlight is active |
|
|
132
|
+
| `className` | string | `""` | Custom CSS class |
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## RevealText
|
|
137
|
+
|
|
138
|
+
Reveals text word-by-word with a staggered slide-up animation triggered on scroll.
|
|
139
|
+
|
|
140
|
+
### Usage
|
|
141
|
+
|
|
142
|
+
```tsx
|
|
143
|
+
import { RevealText } from "motioncss-ui";
|
|
144
|
+
|
|
145
|
+
function App() {
|
|
146
|
+
return (
|
|
147
|
+
<RevealText as="h1" stagger={80} duration={700} delay={100}>
|
|
148
|
+
Words slide in one by one
|
|
149
|
+
</RevealText>
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Props
|
|
155
|
+
|
|
156
|
+
| Prop | Type | Default | Description |
|
|
157
|
+
| ----------- | --------------------------- | ------: | ----------------------------------------- |
|
|
158
|
+
| `stagger` | number | `70` | Delay between words in ms |
|
|
159
|
+
| `duration` | number | `700` | Animation duration per word in ms |
|
|
160
|
+
| `delay` | number | `0` | Initial delay before animation starts, ms |
|
|
161
|
+
| `once` | boolean | `true` | Only animate the first time in viewport |
|
|
162
|
+
| `as` | keyof JSX.IntrinsicElements | `"div"` | HTML element to render as |
|
|
163
|
+
| `className` | string | `""` | Custom CSS class |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## GradientFlow
|
|
168
|
+
|
|
169
|
+
A continuously animated shifting gradient background. Can wrap children or be used standalone.
|
|
170
|
+
|
|
171
|
+
### Usage
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
import { GradientFlow } from "motioncss-ui";
|
|
175
|
+
|
|
176
|
+
function App() {
|
|
177
|
+
return (
|
|
178
|
+
<GradientFlow
|
|
179
|
+
colors={["#6366f1", "#ec4899", "#f59e0b", "#06b6d4"]}
|
|
180
|
+
angle={120}
|
|
181
|
+
duration={12}
|
|
182
|
+
style={{ padding: "60px", borderRadius: "16px" }}
|
|
183
|
+
>
|
|
184
|
+
<h2>Gradient content</h2>
|
|
185
|
+
</GradientFlow>
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
> **Note:** Add the `.mcss-gradient-flow` class to your global CSS to enable the shifting animation:
|
|
191
|
+
>
|
|
192
|
+
> ```css
|
|
193
|
+
> .mcss-gradient-flow {
|
|
194
|
+
> background-size: 300% 300%;
|
|
195
|
+
> animation: mcss-gradient-shift linear infinite;
|
|
196
|
+
> }
|
|
197
|
+
> @keyframes mcss-gradient-shift {
|
|
198
|
+
> 0% { background-position: 0% 50%; }
|
|
199
|
+
> 50% { background-position: 100% 50%; }
|
|
200
|
+
> 100% { background-position: 0% 50%; }
|
|
201
|
+
> }
|
|
202
|
+
> ```
|
|
203
|
+
|
|
204
|
+
### Props
|
|
205
|
+
|
|
206
|
+
| Prop | Type | Default | Description |
|
|
207
|
+
| ----------- | -------- | ------------------------------------------: | -------------------------- |
|
|
208
|
+
| `colors` | string[] | `["#6366f1","#ec4899","#f59e0b","#06b6d4"]` | Gradient color stops |
|
|
209
|
+
| `angle` | number | `120` | Gradient angle in degrees |
|
|
210
|
+
| `duration` | number | `12` | Seconds for one full cycle |
|
|
211
|
+
| `className` | string | `""` | Custom CSS class |
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
## EdgeWave / WaveReveal
|
|
216
|
+
|
|
217
|
+
Two components for cinematic wave transitions.
|
|
218
|
+
|
|
219
|
+
- **`EdgeWave`** - A full-screen wave that sweeps across the viewport and exits. Perfect for page route transitions.
|
|
220
|
+
- **`WaveReveal`** - A cover overlay that sweeps away on mount to reveal content underneath.
|
|
221
|
+
|
|
222
|
+
### Usage
|
|
223
|
+
|
|
224
|
+
```tsx
|
|
225
|
+
import { EdgeWave, WaveReveal } from "motioncss-ui";
|
|
226
|
+
|
|
227
|
+
// Full-screen page transition wave
|
|
228
|
+
function PageTransition() {
|
|
229
|
+
return (
|
|
230
|
+
<EdgeWave
|
|
231
|
+
origin="left"
|
|
232
|
+
duration={900}
|
|
233
|
+
color="#111111"
|
|
234
|
+
curve={8}
|
|
235
|
+
onComplete={() => console.log("Wave done")}
|
|
236
|
+
/>
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
// Reveal content on mount
|
|
241
|
+
function HeroSection() {
|
|
242
|
+
return (
|
|
243
|
+
<WaveReveal origin="left" duration={900} color="#0a0a0a">
|
|
244
|
+
<h1>Revealed!</h1>
|
|
245
|
+
</WaveReveal>
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
### EdgeWave Props
|
|
251
|
+
|
|
252
|
+
| Prop | Type | Default | Description |
|
|
253
|
+
| ------------ | ----------------------------------------- | ----------: | ------------------------------------- |
|
|
254
|
+
| `origin` | `"left" \| "right" \| "top" \| "bottom"` | `"left"` | Direction the wave travels |
|
|
255
|
+
| `duration` | number | `900` | Total animation duration in ms |
|
|
256
|
+
| `color` | string | `"#111111"` | Wave fill color |
|
|
257
|
+
| `curve` | number | `8` | Leading edge curve depth (0-100) |
|
|
258
|
+
| `blur` | number | `0` | Backdrop blur behind the wave, in px |
|
|
259
|
+
| `onComplete` | `() => void` | | Called once the wave exits the screen |
|
|
260
|
+
|
|
261
|
+
### WaveReveal Props
|
|
262
|
+
|
|
263
|
+
| Prop | Type | Default | Description |
|
|
264
|
+
| ---------- | ----------------------------------------- | ----------: | ------------------------------ |
|
|
265
|
+
| `origin` | `"left" \| "right" \| "top" \| "bottom"` | `"left"` | Direction the cover wave exits |
|
|
266
|
+
| `duration` | number | `900` | Duration in ms |
|
|
267
|
+
| `color` | string | `"#111111"` | Overlay fill color |
|
|
268
|
+
| `curve` | number | `8` | Curve depth |
|
|
269
|
+
| `blur` | number | `0` | Backdrop blur in px |
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## Scrollytelling
|
|
274
|
+
|
|
275
|
+
A scroll-progress context provider. Provides a `progress` value (0-1) to child components via the `useScrollytelling()` hook, letting you drive any animation based on scroll position.
|
|
276
|
+
|
|
277
|
+
### Usage
|
|
278
|
+
|
|
279
|
+
```tsx
|
|
280
|
+
import { Scrollytelling, useScrollytelling } from "motioncss-ui";
|
|
281
|
+
|
|
282
|
+
function AnimatedPanel() {
|
|
283
|
+
const { progress } = useScrollytelling();
|
|
284
|
+
return (
|
|
285
|
+
<div
|
|
286
|
+
style={{
|
|
287
|
+
opacity: progress,
|
|
288
|
+
transform: `scale(${0.8 + progress * 0.2})`,
|
|
289
|
+
}}
|
|
290
|
+
>
|
|
291
|
+
I animate on scroll
|
|
292
|
+
</div>
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function App() {
|
|
297
|
+
return (
|
|
298
|
+
<Scrollytelling height="400vh">
|
|
299
|
+
<AnimatedPanel />
|
|
300
|
+
</Scrollytelling>
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
### Props
|
|
306
|
+
|
|
307
|
+
| Prop | Type | Default | Description |
|
|
308
|
+
| ----------- | ---------------- | --------: | ----------------------------------------------- |
|
|
309
|
+
| `height` | string \| number | `"400vh"` | Total scrollable height of the sticky container |
|
|
310
|
+
| `className` | string | `""` | Custom CSS class |
|
|
311
|
+
|
|
312
|
+
### Hook
|
|
313
|
+
|
|
314
|
+
```tsx
|
|
315
|
+
const { progress } = useScrollytelling();
|
|
316
|
+
// progress: number � 0 at the top, 1 at the bottom
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
---
|
|
320
|
+
|
|
50
321
|
## License
|
|
51
322
|
|
|
52
|
-
MIT
|
|
323
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
.motioncss-scrollytelling{width:100%}.motioncss-scrollytelling__stage{isolation:isolate}.motioncss-scene{width:100%;height:100%}.motioncss-scroll-layer{transform-origin:center center}
|