@luna-park/plugin-motion 0.0.0-stage → 1.0.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/README.md +93 -2
- package/dist/index.js +4017 -0
- package/dist/runtime-BbYbqw-z.js +1992 -0
- package/dist/runtime.js +2 -0
- package/package.json +60 -3
package/README.md
CHANGED
|
@@ -1,3 +1,94 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🪄 Motion plugin for Luna Park
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**Animate any element of your app** (entrances, hover effects, scroll reveals, looping details) from a single **Motion** panel in the inspector, without writing a line of animation code.
|
|
4
|
+
|
|
5
|
+
Powered by [anime.js](https://animejs.com), and what you see in the editor preview is exactly what runs once deployed.
|
|
6
|
+
|
|
7
|
+
## ✨ What you get
|
|
8
|
+
|
|
9
|
+
| | |
|
|
10
|
+
|---|---|
|
|
11
|
+
| 🎬 **17 ready-made presets** | Enter, emphasis and ambient animations, one click away. |
|
|
12
|
+
| 🎛️ **Custom from/to** | Animate opacity, position, scale, rotation and blur between your own values. |
|
|
13
|
+
| 🎯 **7 triggers** | On mount, when visible, synced with scroll, on hover, on press, on focus, or driven by a state. |
|
|
14
|
+
| 🌊 **Stagger** | Cascade the animation over children, over sibling elements (lists!), from the first, last, center or at random. |
|
|
15
|
+
| 🔤 **Split text** | Animate a text letter by letter, word by word, or line by line. |
|
|
16
|
+
| ♿ **Reduced motion** | Respects the visitor's `prefers-reduced-motion` setting out of the box. |
|
|
17
|
+
|
|
18
|
+
## 🚀 Getting started
|
|
19
|
+
|
|
20
|
+
1. In Luna Park, open **Library → Install Plugins**, search for **Motion** and install it.
|
|
21
|
+
2. Select an element and open the **Motion** panel in the inspector.
|
|
22
|
+
3. Pick a **trigger**, an **animation** and an **easing**. Hit **Replay** (↺) in the panel header to watch it again.
|
|
23
|
+
|
|
24
|
+
## 🎬 Presets
|
|
25
|
+
|
|
26
|
+
| Category | Presets | Typical use |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| **Enter** | `fade`, `slide-up`, `slide-down`, `slide-left`, `slide-right`, `zoom`, `blur` | Make an element appear (on mount, when scrolled into view…). |
|
|
29
|
+
| **Emphasis** | `grow`, `shrink`, `lift`, `tilt` | Small feedback on interaction, best with hover, press, focus or state. |
|
|
30
|
+
| **Ambient** | `pulse`, `float`, `spin`, `shake`, `blink`, `wiggle` | Loop forever to draw attention. |
|
|
31
|
+
| **Custom** | `custom` | Animate from your **From** values to your **To** values (`opacity`, `x`, `y`, `scale`, `rotate`, `blur`). |
|
|
32
|
+
|
|
33
|
+
## 🎯 Triggers
|
|
34
|
+
|
|
35
|
+
| Trigger | Behavior |
|
|
36
|
+
|---|---|
|
|
37
|
+
| **On mount** | Plays as soon as the element appears. |
|
|
38
|
+
| **When visible** | Plays once, the first time the element scrolls into view. |
|
|
39
|
+
| **Synced with scroll** | Progress follows the scroll position while the element crosses the viewport. |
|
|
40
|
+
| **On hover** | Plays when the pointer enters, rewinds when it leaves. |
|
|
41
|
+
| **On press** | Plays while the element is pressed, rewinds on release. |
|
|
42
|
+
| **On focus** | Plays when the element (or one of its children) gets focus, rewinds when it loses it. |
|
|
43
|
+
| **From a state** | Bind **State** to a boolean: `true` plays the animation, `false` rewinds it. The initial value is applied without animating. |
|
|
44
|
+
|
|
45
|
+
## 🎛️ Options
|
|
46
|
+
|
|
47
|
+
| Option | What it does |
|
|
48
|
+
|---|---|
|
|
49
|
+
| **Duration** / **Delay** | In milliseconds. Duration falls back to the plugin default. |
|
|
50
|
+
| **Easing** | `linear`, `outQuad`, `outCubic`, `outExpo`, `inOutSine`, `outBack`, `outElastic`, `outBounce`. |
|
|
51
|
+
| **Loops** | Number of repetitions, `-1` for infinite. Ambient presets loop by default. |
|
|
52
|
+
| **Alternate** | Play back and forth instead of restarting each loop. |
|
|
53
|
+
| **Stagger** | Delay between each animated item, in milliseconds. |
|
|
54
|
+
| **Stagger from** | Where the cascade starts: `first`, `center`, `last` or `random`. |
|
|
55
|
+
| **Split text** | Split the element's text into `chars`, `words` or `lines` and animate each piece (with a 30 ms stagger by default). |
|
|
56
|
+
|
|
57
|
+
> [!TIP]
|
|
58
|
+
> **Stagger** adapts to what you put it on:
|
|
59
|
+
> - On a **single element**, its children are animated one after the other. Children added later are animated too.
|
|
60
|
+
> - On **repeated siblings** sharing the same motion (e.g. a list rendered from an array), the siblings cascade together. With **When visible**, they are revealed in order as they come into view.
|
|
61
|
+
|
|
62
|
+
## ⚙️ Settings
|
|
63
|
+
|
|
64
|
+
| Setting | Default | What it does |
|
|
65
|
+
|---|---|---|
|
|
66
|
+
| **Default duration (ms)** | `600` | Used by every animation without its own duration. |
|
|
67
|
+
| **Default easing** | `outExpo` | Used by every animation without its own easing (ambient presets have their own). |
|
|
68
|
+
| **Reduced motion** | `reduce` | With `reduce`, visitors who prefer reduced motion get instant transitions, no delays, and no looping or scroll-synced animations. Use `ignore` to always play everything. |
|
|
69
|
+
|
|
70
|
+
## 📦 In your deployed app
|
|
71
|
+
|
|
72
|
+
When you build your project:
|
|
73
|
+
|
|
74
|
+
- **Runtime**: the plugin and `animejs` are added to your frontend dependencies automatically.
|
|
75
|
+
- **Directive**: animated elements use the `v-motion` directive from `@luna-park/plugin-motion/runtime`.
|
|
76
|
+
- **Configuration**: the plugin settings are applied when the app starts.
|
|
77
|
+
|
|
78
|
+
## 🛠️ Development
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm install
|
|
82
|
+
pnpm build # build the plugin
|
|
83
|
+
pnpm dev # rebuild on change
|
|
84
|
+
pnpm preview # serve it to the Luna Park editor (http://127.0.0.1:2084)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The package ships two entries:
|
|
88
|
+
|
|
89
|
+
- `@luna-park/plugin-motion`: the editor plugin (settings and Motion panel).
|
|
90
|
+
- `@luna-park/plugin-motion/runtime`: the browser runtime used by the generated app (`vMotion`, `configureMotion`, `replayMotion`, `presets`).
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
Made with 💙 by [Luna Park](https://luna-park.app).
|