@wix/interact 2.0.0-rc.8 → 2.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/dist/cjs/index.js +1 -1
- package/dist/cjs/react.js +1 -1
- package/dist/cjs/web.js +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/react.js +2 -2
- package/dist/es/web.js +2 -2
- package/dist/{index-Bs9cjD_x.js → index-muYJHOYV.js} +3 -3
- package/dist/{index-Bs9cjD_x.js.map → index-muYJHOYV.js.map} +1 -1
- package/dist/{index-DsvFkLS4.mjs → index-wDdpOvzw.mjs} +5 -5
- package/dist/{index-DsvFkLS4.mjs.map → index-wDdpOvzw.mjs.map} +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/docs/README.md +39 -73
- package/docs/api/README.md +1 -1
- package/docs/api/functions.md +22 -37
- package/docs/api/interact-class.md +31 -20
- package/docs/api/interaction-controller.md +18 -54
- package/docs/api/types.md +29 -142
- package/docs/guides/effects-and-animations.md +9 -9
- package/docs/guides/understanding-triggers.md +11 -9
- package/docs/integration/react.md +15 -12
- package/package.json +3 -4
- package/rules/click.md +6 -6
- package/rules/full-lean.md +15 -17
- package/rules/hover.md +2 -2
- package/rules/integration.md +11 -9
- package/rules/pointermove.md +22 -22
- package/rules/scroll-list.md +12 -12
- package/rules/viewenter.md +24 -30
- package/rules/viewprogress.md +29 -29
package/rules/full-lean.md
CHANGED
|
@@ -34,7 +34,7 @@ Interact.create(config);
|
|
|
34
34
|
|
|
35
35
|
```html
|
|
36
36
|
<script type="module">
|
|
37
|
-
import { Interact } from 'https://esm.sh/@wix/interact
|
|
37
|
+
import { Interact } from 'https://esm.sh/@wix/interact';
|
|
38
38
|
|
|
39
39
|
const config = {
|
|
40
40
|
// config-props
|
|
@@ -48,7 +48,7 @@ Interact.create(config);
|
|
|
48
48
|
|
|
49
49
|
- Use `generate(config)` to create critical CSS that hides elements until their `viewEnter` entrance animation plays.
|
|
50
50
|
- Add `data-interact-initial="true"` to the `<interact-element>` that should have its first child hidden initially.
|
|
51
|
-
- Only use `data-interact-initial="true"` for `<interact-element>` with `viewEnter` trigger.
|
|
51
|
+
- Only use `data-interact-initial="true"` for `<interact-element>` with `viewEnter` trigger and `type: 'once'`, where the source and target elements are the same.
|
|
52
52
|
- Do NOT use for `hover` or `click` interactions.
|
|
53
53
|
|
|
54
54
|
**Usage:**
|
|
@@ -115,9 +115,10 @@ This configuration declares what user/system triggers occur on which source elem
|
|
|
115
115
|
- **Purpose**: Named predicates that gate interactions/effects by runtime context.
|
|
116
116
|
- **Key (string)**: The condition id. MUST be unique across the registry.
|
|
117
117
|
- **Value (Condition)**:
|
|
118
|
-
- **type**: `'media' | 'container'`
|
|
118
|
+
- **type**: `'media' | 'container' | 'selector'`
|
|
119
119
|
- `'media'`: The predicate MUST be a valid CSS media query expression without the outer `@media` keyword (e.g., `'(min-width: 768px)'`).
|
|
120
120
|
- `'container'`: The predicate SHOULD be a valid CSS container query condition string relative to the relevant container context.
|
|
121
|
+
- `'selector'`: The predicate is a CSS selector pattern. If it contains `&`, the `&` is replaced with the base element selector; otherwise the predicate is appended to the base selector. Used for conditional styling (e.g., `:nth-of-type(odd)`, `.active`).
|
|
121
122
|
- **predicate?**: OPTIONAL textual predicate for the given type. If omitted, the condition is treated as always-true (i.e., a no-op guard).
|
|
122
123
|
|
|
123
124
|
- **interactions: Interaction[]**
|
|
@@ -131,13 +132,13 @@ This configuration declares what user/system triggers occur on which source elem
|
|
|
131
132
|
- OPTIONAL. A CSS selector used to select items within `listContainer`.
|
|
132
133
|
- **trigger: TriggerType**
|
|
133
134
|
- REQUIRED. One of:
|
|
134
|
-
- `'hover' | 'click'`: Pointer interactions.
|
|
135
|
+
- `'hover' | 'click' | 'activate' | 'interest'`: Pointer interactions (`activate` = click with keyboard Space/Enter; `interest` = hover with focus).
|
|
135
136
|
- `'viewEnter' | 'pageVisible' | 'viewProgress'`: Viewport visibility/progress triggers.
|
|
136
137
|
- `'animationEnd'`: Fires when a specific effect completes on the source element.
|
|
137
138
|
- `'pointerMove'`: Continuous pointer motion over an area.
|
|
138
139
|
- **params?: TriggerParams**
|
|
139
140
|
- OPTIONAL. Parameter object that MUST match the trigger:
|
|
140
|
-
- hover/click: `StateParams | PointerTriggerParams`
|
|
141
|
+
- hover/click/activate/interest: `StateParams | PointerTriggerParams` (activate uses same params as click; interest uses same params as hover).
|
|
141
142
|
- `StateParams.method`: `'add' | 'remove' | 'toggle' | 'clear'`
|
|
142
143
|
- `PointerTriggerParams.type?`: `'once' | 'repeat' | 'alternate' | 'state'`
|
|
143
144
|
- Usage:
|
|
@@ -153,13 +154,14 @@ This configuration declares what user/system triggers occur on which source elem
|
|
|
153
154
|
- `'once'`: Play once and remove the listener (hover attaches only the enter listener; no leave).
|
|
154
155
|
- `'state'`: Hover — play on enter if idle/paused, pause on leave if running. Click — toggle play/pause on successive clicks until finished.
|
|
155
156
|
- viewEnter/pageVisible/viewProgress: `ViewEnterParams`
|
|
156
|
-
- `type?`: `'once' | 'repeat' | 'alternate'`
|
|
157
|
+
- `type?`: `'once' | 'repeat' | 'alternate' | 'state'`
|
|
157
158
|
- `threshold?`: number in [0,1] describing intersection threshold
|
|
158
159
|
- `inset?`: string CSS-style inset for rootMargin/observer geometry
|
|
159
160
|
- Usage:
|
|
160
161
|
- `'once'`: Play on first visibility and unobserve the element.
|
|
161
162
|
- `'repeat'`: Play each time the element re‑enters visibility according to `threshold`/`inset`.
|
|
162
163
|
- `'alternate'`: Triggers on re‑entries; if you need alternating direction, set it on the effect (e.g., `alternate: true`) rather than relying on the trigger.
|
|
164
|
+
- `'state'`: Play on entry, pause on exit (for looping/continuous animations).
|
|
163
165
|
- `threshold`: Passed to `IntersectionObserver.threshold` — typical values are 0.1–0.6 for entrances.
|
|
164
166
|
- `inset`: Applied as vertical `rootMargin` (`top/bottom`), e.g., `'-100px'` to trigger earlier/later; left/right remain 0.
|
|
165
167
|
- Note: For `viewProgress`, `threshold` and `inset` are ignored; progress is driven by ViewTimeline/scroll scenes. Control the range via `ScrubEffect.rangeStart/rangeEnd` and `namedEffect.range`.
|
|
@@ -168,10 +170,11 @@ This configuration declares what user/system triggers occur on which source elem
|
|
|
168
170
|
- Usage: Fire when the specified effect (by `effectId`) on the source element finishes, useful for chaining sequences.
|
|
169
171
|
- pointerMove: `PointerMoveParams`
|
|
170
172
|
- `hitArea?`: `'root' | 'self'` (default `'self'`)
|
|
173
|
+
- `axis?`: `'x' | 'y'` - when using `keyframeEffect` with `pointerMove`, selects which pointer coordinate maps to linear 0-1 progress; defaults to `'y'`. Ignored for `namedEffect` and `customEffect`.
|
|
171
174
|
- Usage:
|
|
172
175
|
- `'self'`: Track pointer within the source element’s bounds.
|
|
173
176
|
- `'root'`: Track pointer anywhere in the viewport (document root).
|
|
174
|
-
- Only use with `ScrubEffect` mouse presets (`namedEffect`) or `customEffect` that consumes pointer progress; avoid `keyframeEffect` with `pointerMove`.
|
|
177
|
+
- Only use with `ScrubEffect` mouse presets (`namedEffect`) or `customEffect` that consumes pointer progress; avoid `keyframeEffect` with `pointerMove` unless mapping a single axis via `axis`.
|
|
175
178
|
- When using `customEffect` with `pointerMove`, the progress parameter is an object:
|
|
176
179
|
- ```typescript
|
|
177
180
|
type Progress = {
|
|
@@ -343,7 +346,7 @@ The config remains the same for both integrations—only the HTML/JSX setup diff
|
|
|
343
346
|
- `delay?`: number (ms)
|
|
344
347
|
- One of:
|
|
345
348
|
- `keyframeEffect`: `{ name: string; keyframes: Keyframe[] }`
|
|
346
|
-
- `namedEffect`: `NamedEffect` (from `@wix/motion`)
|
|
349
|
+
- `namedEffect`: `NamedEffect` (from `@wix/motion-presets`)
|
|
347
350
|
- `customEffect`: `(element: Element, progress: any) => void`
|
|
348
351
|
|
|
349
352
|
2. **ScrubEffect** (animation driven by scroll/progress)
|
|
@@ -391,15 +394,10 @@ The config remains the same for both integrations—only the HTML/JSX setup diff
|
|
|
391
394
|
|
|
392
395
|
### Authoring rules for animation payloads (`namedEffect`, `keyframeEffect`, `customEffect`):
|
|
393
396
|
|
|
394
|
-
- **namedEffect (Preferred)**: Use first for best performance. These are pre-built presets from `@wix/motion` that are GPU-friendly and tuned.
|
|
395
|
-
- Structure: `namedEffect: { type: '<PresetName>', /* optional preset options like direction (bottom|top|left|right),
|
|
396
|
-
- Short list of common preset names:
|
|
397
|
-
|
|
398
|
-
- Ongoing: `Pulse`, `Spin`, `Wiggle`, `Bounce`
|
|
399
|
-
- Scroll: `ParallaxScroll`, `FadeScroll`, `RevealScroll`, `TiltScroll`
|
|
400
|
-
- For scroll-effects used with the `viewProgress` trigger, the `namedEffect` options MUST include `range: 'in' | 'out' | 'continuous'`. Prefer `range: 'continuous'` for simplicity.
|
|
401
|
-
- Mouse: For `pointerMove` (mouse-effects), prefer `namedEffect` presets (e.g., `TrackMouse`, `Tilt3DMouse`, `ScaleMouse`, `BlurMouse`); avoid `keyframeEffect` with `pointerMove` since progress is two‑dimensional.
|
|
402
|
-
- Mouse: `TrackMouse`, `Tilt3DMouse`, `ScaleMouse`, `BlurMouse`
|
|
397
|
+
- **namedEffect (Preferred)**: Use first for best performance. These are pre-built presets from `@wix/motion-presets` that are GPU-friendly and tuned.
|
|
398
|
+
- Structure: `namedEffect: { type: '<PresetName>', /* optional preset options like direction (bottom|top|left|right), etc. do not use those without having proper documentation of which options exist and of what types. */ }`
|
|
399
|
+
- Short list of common preset names: - Entrance: `FadeIn`, `BounceIn`, `SlideIn`, `F
|
|
400
|
+
lipIn`, `ArcIn` - Ongoing: `Pulse`, `Spin`, `Wiggle`, `Bounce` - Scroll: `ParallaxScroll`, `FadeScroll`, `RevealScroll`, `TiltScroll` - For scroll-effects used with the `viewProgress` trigger, the `namedEffect` options MUST include `range: 'in' | 'out' | 'continuous'`. Prefer `range: 'continuous'` for simplicity. - Mouse: For `pointerMove` (mouse-effects), prefer `namedEffect` presets (e.g., `TrackMouse`, `Tilt3DMouse`, `ScaleMouse`, `BlurMouse`); avoid `keyframeEffect` with `pointerMove` since progress is two‑dimensional. - Mouse: `TrackMouse`, `Tilt3DMouse`, `ScaleMouse`, `BlurMouse`
|
|
403
401
|
- **keyframeEffect (Default for custom animations)**: Prefer this when you need a custom-made animation.
|
|
404
402
|
- Structure: `keyframeEffect: { name: string; keyframes: Keyframe[] }` (keyframes use standard CSS/WAAPI properties).
|
|
405
403
|
- Not compatible with `pointerMove` (mouse-effects) because pointer progress is two‑dimensional; use `customEffect` for custom pointer‑driven animations.
|
package/rules/hover.md
CHANGED
|
@@ -95,7 +95,7 @@ This document contains rules for generating hover trigger interactions in `@wix/
|
|
|
95
95
|
|
|
96
96
|
## Rule 2: Hover Enter/Leave Animations with Named Effects
|
|
97
97
|
|
|
98
|
-
**Purpose**: Generate hover interactions using pre-built named effects from @wix/motion
|
|
98
|
+
**Purpose**: Generate hover interactions using pre-built named effects from @wix/motion-presets
|
|
99
99
|
|
|
100
100
|
**Pattern**:
|
|
101
101
|
|
|
@@ -125,7 +125,7 @@ This document contains rules for generating hover trigger interactions in `@wix/
|
|
|
125
125
|
**Variables**:
|
|
126
126
|
|
|
127
127
|
- `[REVERSED_BOOL]`: Optional boolean value indicating whether the mouse enter animation is reversed (and mouse leave is forwards).
|
|
128
|
-
- `[NAMED_EFFECT_TYPE]`: Name of the pre-built named effect from @wix/motion to use.
|
|
128
|
+
- `[NAMED_EFFECT_TYPE]`: Name of the pre-built named effect from @wix/motion-presets to use.
|
|
129
129
|
- `[EFFECT_PROPERTIES]`: Named effect specific properties (distance, angle, perspective, etc.)
|
|
130
130
|
- Other variables same as Rule 1
|
|
131
131
|
|
package/rules/integration.md
CHANGED
|
@@ -169,20 +169,22 @@ const html = `
|
|
|
169
169
|
|
|
170
170
|
**When to Use:**
|
|
171
171
|
|
|
172
|
-
- For elements with an entrance
|
|
172
|
+
- For elements with an entrance effect that is triggered with `viewEnter`
|
|
173
173
|
- To prevent elements from being visible before their entrance animation plays
|
|
174
174
|
- For server-side rendering (SSR) or static site generation (SSG) scenarios
|
|
175
175
|
|
|
176
176
|
## 5. Triggers & Behaviors
|
|
177
177
|
|
|
178
|
-
| Trigger | Description
|
|
179
|
-
| :------------- |
|
|
180
|
-
| `hover` | Mouse enter/leave
|
|
181
|
-
| `click` | Mouse click
|
|
182
|
-
| `
|
|
183
|
-
| `
|
|
184
|
-
| `
|
|
185
|
-
| `
|
|
178
|
+
| Trigger | Description | Key Parameters | Rules File |
|
|
179
|
+
| :------------- | :---------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------ | :------------------ |
|
|
180
|
+
| `hover` | Mouse enter/leave | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states | `./hover.md` |
|
|
181
|
+
| `click` | Mouse click | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states | `./click.md` |
|
|
182
|
+
| `activate` | Accessible click (click + keyboard Space/Enter) | Same as `click` with keyboard support | `./click.md` |
|
|
183
|
+
| `interest` | Accessible hover (hover + focus) | Same as `hover` with focus support | `./hover.md` |
|
|
184
|
+
| `viewEnter` | Element enters viewport | `type`: 'once', 'alternate', 'repeat', 'state'; `threshold` (0-1) | `./viewenter.md` |
|
|
185
|
+
| `viewProgress` | Scroll-driven using ViewTimeline | (No specific params, uses effect ranges) | `./viewprogress.md` |
|
|
186
|
+
| `pointerMove` | Mouse movement | `hitArea`: 'self' (default) or 'root'; `axis`: 'x' or 'y' for keyframeEffect | `./pointermove.md` |
|
|
187
|
+
| `animationEnd` | Chaining animations | `effectId`: ID of the previous effect | -- |
|
|
186
188
|
|
|
187
189
|
## 6. Effects & Animations
|
|
188
190
|
|
package/rules/pointermove.md
CHANGED
|
@@ -8,7 +8,7 @@ These rules help generate pointer-driven interactions using the `@wix/interact`
|
|
|
8
8
|
|
|
9
9
|
The `pointerMove` trigger provides 2D progress (x and y coordinates). You can use:
|
|
10
10
|
|
|
11
|
-
1. **`namedEffect`** (Preferred): Pre-built mouse presets from `@wix/motion` that handle 2D progress internally
|
|
11
|
+
1. **`namedEffect`** (Preferred): Pre-built mouse presets from `@wix/motion-presets` that handle 2D progress internally
|
|
12
12
|
2. **`customEffect`** (Advanced): Custom function receiving the 2D progress object for full control
|
|
13
13
|
3. **`keyframeEffect`** (Single-axis): The pointer position on a single axis is mapped to linear 0-1 progress for keyframe animations. Use `axis: 'x'` or `axis: 'y'` (defaults to `'y'`)
|
|
14
14
|
|
|
@@ -141,7 +141,7 @@ Controls how the progress range is calculated:
|
|
|
141
141
|
key: '[TARGET_KEY]',
|
|
142
142
|
namedEffect: {
|
|
143
143
|
type: '[MOVEMENT_EFFECT_TYPE]',
|
|
144
|
-
distance: { value: [DISTANCE_VALUE],
|
|
144
|
+
distance: { value: [DISTANCE_VALUE], unit: '[DISTANCE_UNIT]' },
|
|
145
145
|
axis: '[AXIS_CONSTRAINT]',
|
|
146
146
|
power: '[POWER_LEVEL]'
|
|
147
147
|
},
|
|
@@ -174,7 +174,7 @@ Controls how the progress range is calculated:
|
|
|
174
174
|
{
|
|
175
175
|
namedEffect: {
|
|
176
176
|
type: 'TrackMouse',
|
|
177
|
-
distance: { value: 50,
|
|
177
|
+
distance: { value: 50, unit: 'percentage' },
|
|
178
178
|
axis: 'both',
|
|
179
179
|
power: 'medium'
|
|
180
180
|
},
|
|
@@ -198,7 +198,7 @@ Controls how the progress range is calculated:
|
|
|
198
198
|
key: 'floating-element',
|
|
199
199
|
namedEffect: {
|
|
200
200
|
type: 'AiryMouse',
|
|
201
|
-
distance: { value: 30,
|
|
201
|
+
distance: { value: 30, unit: 'px' },
|
|
202
202
|
axis: 'both',
|
|
203
203
|
power: 'soft'
|
|
204
204
|
},
|
|
@@ -266,7 +266,7 @@ Controls how the progress range is calculated:
|
|
|
266
266
|
namedEffect: {
|
|
267
267
|
type: 'ScaleMouse',
|
|
268
268
|
scale: 1.1,
|
|
269
|
-
distance: { value: 100,
|
|
269
|
+
distance: { value: 100, unit: 'px' },
|
|
270
270
|
axis: 'both',
|
|
271
271
|
power: 'medium'
|
|
272
272
|
},
|
|
@@ -418,7 +418,7 @@ Controls how the progress range is calculated:
|
|
|
418
418
|
key: '[BACKGROUND_LAYER_KEY]',
|
|
419
419
|
namedEffect: {
|
|
420
420
|
type: '[BACKGROUND_EFFECT_TYPE]',
|
|
421
|
-
distance: { value: [BACKGROUND_DISTANCE],
|
|
421
|
+
distance: { value: [BACKGROUND_DISTANCE], unit: '[DISTANCE_UNIT]' },
|
|
422
422
|
power: '[BACKGROUND_POWER]'
|
|
423
423
|
},
|
|
424
424
|
centeredToTarget: [CENTERED_TO_TARGET]
|
|
@@ -427,7 +427,7 @@ Controls how the progress range is calculated:
|
|
|
427
427
|
key: '[MIDGROUND_LAYER_KEY]',
|
|
428
428
|
namedEffect: {
|
|
429
429
|
type: '[MIDGROUND_EFFECT_TYPE]',
|
|
430
|
-
distance: { value: [MIDGROUND_DISTANCE],
|
|
430
|
+
distance: { value: [MIDGROUND_DISTANCE], unit: '[DISTANCE_UNIT]' },
|
|
431
431
|
power: '[MIDGROUND_POWER]'
|
|
432
432
|
},
|
|
433
433
|
centeredToTarget: [CENTERED_TO_TARGET]
|
|
@@ -436,7 +436,7 @@ Controls how the progress range is calculated:
|
|
|
436
436
|
key: '[FOREGROUND_LAYER_KEY]',
|
|
437
437
|
namedEffect: {
|
|
438
438
|
type: '[FOREGROUND_EFFECT_TYPE]',
|
|
439
|
-
distance: { value: [FOREGROUND_DISTANCE],
|
|
439
|
+
distance: { value: [FOREGROUND_DISTANCE], unit: '[DISTANCE_UNIT]' },
|
|
440
440
|
power: '[FOREGROUND_POWER]'
|
|
441
441
|
},
|
|
442
442
|
centeredToTarget: [CENTERED_TO_TARGET]
|
|
@@ -468,7 +468,7 @@ Controls how the progress range is calculated:
|
|
|
468
468
|
key: 'bg-layer',
|
|
469
469
|
namedEffect: {
|
|
470
470
|
type: 'AiryMouse',
|
|
471
|
-
distance: { value: 15,
|
|
471
|
+
distance: { value: 15, unit: 'px' },
|
|
472
472
|
axis: 'both',
|
|
473
473
|
power: 'soft'
|
|
474
474
|
},
|
|
@@ -478,7 +478,7 @@ Controls how the progress range is calculated:
|
|
|
478
478
|
key: 'mid-layer',
|
|
479
479
|
namedEffect: {
|
|
480
480
|
type: 'TrackMouse',
|
|
481
|
-
distance: { value: 25,
|
|
481
|
+
distance: { value: 25, unit: 'px' },
|
|
482
482
|
axis: 'both',
|
|
483
483
|
power: 'medium'
|
|
484
484
|
},
|
|
@@ -488,7 +488,7 @@ Controls how the progress range is calculated:
|
|
|
488
488
|
key: 'fg-layer',
|
|
489
489
|
namedEffect: {
|
|
490
490
|
type: 'BounceMouse',
|
|
491
|
-
distance: { value: 35,
|
|
491
|
+
distance: { value: 35, unit: 'px' },
|
|
492
492
|
axis: 'both',
|
|
493
493
|
power: 'medium'
|
|
494
494
|
},
|
|
@@ -512,7 +512,7 @@ Controls how the progress range is calculated:
|
|
|
512
512
|
key: 'hero-bg',
|
|
513
513
|
namedEffect: {
|
|
514
514
|
type: 'AiryMouse',
|
|
515
|
-
distance: { value: 20,
|
|
515
|
+
distance: { value: 20, unit: 'px' },
|
|
516
516
|
axis: 'both',
|
|
517
517
|
power: 'soft'
|
|
518
518
|
},
|
|
@@ -522,7 +522,7 @@ Controls how the progress range is calculated:
|
|
|
522
522
|
key: 'hero-content',
|
|
523
523
|
namedEffect: {
|
|
524
524
|
type: 'TrackMouse',
|
|
525
|
-
distance: { value: 40,
|
|
525
|
+
distance: { value: 40, unit: 'px' },
|
|
526
526
|
axis: 'horizontal',
|
|
527
527
|
power: 'medium'
|
|
528
528
|
},
|
|
@@ -533,7 +533,7 @@ Controls how the progress range is calculated:
|
|
|
533
533
|
namedEffect: {
|
|
534
534
|
type: 'ScaleMouse',
|
|
535
535
|
scale: 1.05,
|
|
536
|
-
distance: { value: 60,
|
|
536
|
+
distance: { value: 60, unit: 'px' },
|
|
537
537
|
power: 'medium'
|
|
538
538
|
},
|
|
539
539
|
centeredToTarget: true
|
|
@@ -619,7 +619,7 @@ Controls how the progress range is calculated:
|
|
|
619
619
|
key: 'card-shadow',
|
|
620
620
|
namedEffect: {
|
|
621
621
|
type: 'AiryMouse',
|
|
622
|
-
distance: { value: 20,
|
|
622
|
+
distance: { value: 20, unit: 'px' },
|
|
623
623
|
axis: 'both',
|
|
624
624
|
power: 'soft'
|
|
625
625
|
},
|
|
@@ -644,7 +644,7 @@ Controls how the progress range is calculated:
|
|
|
644
644
|
namedEffect: {
|
|
645
645
|
type: 'ScaleMouse',
|
|
646
646
|
scale: 1.05,
|
|
647
|
-
distance: { value: 80,
|
|
647
|
+
distance: { value: 80, unit: 'px' },
|
|
648
648
|
power: 'medium'
|
|
649
649
|
},
|
|
650
650
|
centeredToTarget: true
|
|
@@ -653,7 +653,7 @@ Controls how the progress range is calculated:
|
|
|
653
653
|
key: 'nav-indicator',
|
|
654
654
|
namedEffect: {
|
|
655
655
|
type: 'TrackMouse',
|
|
656
|
-
distance: { value: 15,
|
|
656
|
+
distance: { value: 15, unit: 'px' },
|
|
657
657
|
axis: 'horizontal',
|
|
658
658
|
power: 'hard'
|
|
659
659
|
},
|
|
@@ -689,7 +689,7 @@ Controls how the progress range is calculated:
|
|
|
689
689
|
{
|
|
690
690
|
namedEffect: {
|
|
691
691
|
type: '[FOLLOWER_EFFECT_TYPE]',
|
|
692
|
-
distance: { value: [FOLLOWER_DISTANCE],
|
|
692
|
+
distance: { value: [FOLLOWER_DISTANCE], unit: '[DISTANCE_UNIT]' },
|
|
693
693
|
[FOLLOWER_PROPERTIES]
|
|
694
694
|
},
|
|
695
695
|
centeredToTarget: false,
|
|
@@ -721,7 +721,7 @@ Controls how the progress range is calculated:
|
|
|
721
721
|
{
|
|
722
722
|
namedEffect: {
|
|
723
723
|
type: 'TrackMouse',
|
|
724
|
-
distance: { value: 0,
|
|
724
|
+
distance: { value: 0, unit: 'px' },
|
|
725
725
|
axis: 'both',
|
|
726
726
|
power: 'hard'
|
|
727
727
|
},
|
|
@@ -1329,7 +1329,7 @@ Different hit areas for different interaction contexts:
|
|
|
1329
1329
|
key: 'ambient-element',
|
|
1330
1330
|
namedEffect: {
|
|
1331
1331
|
type: 'AiryMouse',
|
|
1332
|
-
distance: { value: 30,
|
|
1332
|
+
distance: { value: 30, unit: 'px' },
|
|
1333
1333
|
power: 'soft'
|
|
1334
1334
|
},
|
|
1335
1335
|
centeredToTarget: false
|
|
@@ -1354,7 +1354,7 @@ Controlling movement direction for specific design needs:
|
|
|
1354
1354
|
key: 'horizontal-slider',
|
|
1355
1355
|
namedEffect: {
|
|
1356
1356
|
type: 'TrackMouse',
|
|
1357
|
-
distance: { value: 100,
|
|
1357
|
+
distance: { value: 100, unit: 'px' },
|
|
1358
1358
|
axis: 'horizontal',
|
|
1359
1359
|
power: 'medium'
|
|
1360
1360
|
},
|
|
@@ -1365,7 +1365,7 @@ Controlling movement direction for specific design needs:
|
|
|
1365
1365
|
namedEffect: {
|
|
1366
1366
|
type: 'ScaleMouse',
|
|
1367
1367
|
scale: 1.2,
|
|
1368
|
-
distance: { value: 150,
|
|
1368
|
+
distance: { value: 150, unit: 'px' },
|
|
1369
1369
|
axis: 'vertical',
|
|
1370
1370
|
power: 'medium'
|
|
1371
1371
|
},
|
package/rules/scroll-list.md
CHANGED
|
@@ -17,7 +17,7 @@ These rules help generate scroll-driven list animations using the `@wix/interact
|
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
19
|
{
|
|
20
|
-
key: '[
|
|
20
|
+
key: '[CONTAINER_KEY]',
|
|
21
21
|
trigger: 'viewProgress',
|
|
22
22
|
effects: [
|
|
23
23
|
{
|
|
@@ -121,7 +121,7 @@ These rules help generate scroll-driven list animations using the `@wix/interact
|
|
|
121
121
|
**Variables**:
|
|
122
122
|
|
|
123
123
|
- `[ITEM_KEY]`: Unique identifier for individual list items
|
|
124
|
-
- `[ITEM_NAMED_EFFECT]`: Item-level scroll effects from @wix/motion scroll animations:
|
|
124
|
+
- `[ITEM_NAMED_EFFECT]`: Item-level scroll effects from @wix/motion-presets scroll animations:
|
|
125
125
|
- **Reveal/Fade**: 'FadeScroll', 'BlurScroll', 'RevealScroll', 'ShapeScroll', 'ShuttersScroll'
|
|
126
126
|
- **Movement**: 'MoveScroll', 'SlideScroll', 'PanScroll', 'SkewPanScroll'
|
|
127
127
|
- **Scale**: 'GrowScroll', 'ShrinkScroll', 'StretchScroll'
|
|
@@ -192,11 +192,11 @@ These rules help generate scroll-driven list animations using the `@wix/interact
|
|
|
192
192
|
|
|
193
193
|
```typescript
|
|
194
194
|
{
|
|
195
|
-
key: '[
|
|
195
|
+
key: '[ITEM_CONTAINER_KEY]',
|
|
196
196
|
trigger: 'viewProgress',
|
|
197
197
|
effects: [
|
|
198
198
|
{
|
|
199
|
-
key: '[
|
|
199
|
+
key: '[CONTENT_KEY]',
|
|
200
200
|
namedEffect: {
|
|
201
201
|
type: '[CONTENT_NAMED_EFFECT]'
|
|
202
202
|
},
|
|
@@ -211,9 +211,9 @@ These rules help generate scroll-driven list animations using the `@wix/interact
|
|
|
211
211
|
|
|
212
212
|
**Variables**:
|
|
213
213
|
|
|
214
|
-
- `[
|
|
215
|
-
- `[
|
|
216
|
-
- `[CONTENT_NAMED_EFFECT]`: Content-level scroll effects from @wix/motion:
|
|
214
|
+
- `[ITEM_CONTAINER_KEY]`: Unique identifier for the containing list item
|
|
215
|
+
- `[CONTENT_KEY]`: Unique identifier for content within the item (or use `selector` for CSS selector)
|
|
216
|
+
- `[CONTENT_NAMED_EFFECT]`: Content-level scroll effects from @wix/motion-presets:
|
|
217
217
|
- **Opacity/Visibility**: 'FadeScroll', 'BlurScroll'
|
|
218
218
|
- **Reveal**: 'RevealScroll', 'ShapeScroll', 'ShuttersScroll'
|
|
219
219
|
- **3D Transforms**: 'TiltScroll', 'FlipScroll', 'ArcScroll', 'TurnScroll', 'Spin3dScroll'
|
|
@@ -299,7 +299,7 @@ These rules help generate scroll-driven list animations using the `@wix/interact
|
|
|
299
299
|
|
|
300
300
|
```typescript
|
|
301
301
|
{
|
|
302
|
-
key: '[
|
|
302
|
+
key: '[CONTAINER_KEY]',
|
|
303
303
|
trigger: 'viewProgress',
|
|
304
304
|
effects: [
|
|
305
305
|
{
|
|
@@ -510,7 +510,7 @@ These rules help generate scroll-driven list animations using the `@wix/interact
|
|
|
510
510
|
},
|
|
511
511
|
interactions: [
|
|
512
512
|
{
|
|
513
|
-
key: '[
|
|
513
|
+
key: '[ITEM_KEY_N]',
|
|
514
514
|
trigger: 'viewProgress',
|
|
515
515
|
effects: [
|
|
516
516
|
{
|
|
@@ -637,12 +637,12 @@ These rules help generate scroll-driven list animations using the `@wix/interact
|
|
|
637
637
|
|
|
638
638
|
```typescript
|
|
639
639
|
{
|
|
640
|
-
key: '[
|
|
640
|
+
key: '[LIST_CONTAINER_KEY]',
|
|
641
641
|
trigger: 'viewProgress',
|
|
642
642
|
effects: [
|
|
643
643
|
{
|
|
644
|
-
key: '[
|
|
645
|
-
customEffect: (element, progress
|
|
644
|
+
key: '[DYNAMIC_CONTENT_KEY]',
|
|
645
|
+
customEffect: (element, progress) => {
|
|
646
646
|
// progress is 0-1 representing scroll position within range
|
|
647
647
|
[CUSTOM_CALCULATION_LOGIC]
|
|
648
648
|
[DYNAMIC_CONTENT_UPDATE]
|
package/rules/viewenter.md
CHANGED
|
@@ -17,7 +17,7 @@ These rules help generate viewport-based interactions using the `@wix/interact`
|
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
19
|
{
|
|
20
|
-
key: '[
|
|
20
|
+
key: '[SOURCE_KEY]',
|
|
21
21
|
trigger: 'viewEnter',
|
|
22
22
|
params: {
|
|
23
23
|
type: 'once',
|
|
@@ -26,7 +26,7 @@ These rules help generate viewport-based interactions using the `@wix/interact`
|
|
|
26
26
|
},
|
|
27
27
|
effects: [
|
|
28
28
|
{
|
|
29
|
-
key: '[
|
|
29
|
+
key: '[TARGET_KEY]',
|
|
30
30
|
[EFFECT_TYPE]: [EFFECT_DEFINITION],
|
|
31
31
|
duration: [DURATION_MS],
|
|
32
32
|
easing: '[EASING_FUNCTION]',
|
|
@@ -39,8 +39,8 @@ These rules help generate viewport-based interactions using the `@wix/interact`
|
|
|
39
39
|
|
|
40
40
|
**Variables**:
|
|
41
41
|
|
|
42
|
-
- `[
|
|
43
|
-
- `[
|
|
42
|
+
- `[SOURCE_KEY]`: Unique identifier for element that triggers when visible (often same as target key)
|
|
43
|
+
- `[TARGET_KEY]`: Unique identifier for element to animate (can be same as source or different)
|
|
44
44
|
- `[VISIBILITY_THRESHOLD]`: Number between 0-1 indicating how much of element must be visible (e.g., 0.3 = 30%)
|
|
45
45
|
- `[VIEWPORT_INSETS]`: String insets around viewport (e.g., '50px', '10%', '-100px')
|
|
46
46
|
- `[EFFECT_TYPE]`: Either `namedEffect` or `keyframeEffect`
|
|
@@ -121,7 +121,7 @@ These rules help generate viewport-based interactions using the `@wix/interact`
|
|
|
121
121
|
|
|
122
122
|
```typescript
|
|
123
123
|
{
|
|
124
|
-
key: '[
|
|
124
|
+
key: '[OBSERVER_KEY]',
|
|
125
125
|
trigger: 'viewEnter',
|
|
126
126
|
params: {
|
|
127
127
|
type: 'repeat',
|
|
@@ -130,7 +130,7 @@ These rules help generate viewport-based interactions using the `@wix/interact`
|
|
|
130
130
|
},
|
|
131
131
|
effects: [
|
|
132
132
|
{
|
|
133
|
-
key: '[
|
|
133
|
+
key: '[ANIMATION_TARGET_KEY]',
|
|
134
134
|
[EFFECT_TYPE]: [EFFECT_DEFINITION],
|
|
135
135
|
duration: [DURATION_MS],
|
|
136
136
|
easing: '[EASING_FUNCTION]',
|
|
@@ -143,8 +143,8 @@ These rules help generate viewport-based interactions using the `@wix/interact`
|
|
|
143
143
|
|
|
144
144
|
**Variables**:
|
|
145
145
|
|
|
146
|
-
- `[
|
|
147
|
-
- `[
|
|
146
|
+
- `[OBSERVER_KEY]`: Unique identifier for element that acts as scroll trigger
|
|
147
|
+
- `[ANIMATION_TARGET_KEY]`: Unique identifier for element that gets animated (different from observer)
|
|
148
148
|
- Other variables same as Rule 1
|
|
149
149
|
|
|
150
150
|
**Example - Image Reveal on Scroll**:
|
|
@@ -219,7 +219,7 @@ These rules help generate viewport-based interactions using the `@wix/interact`
|
|
|
219
219
|
|
|
220
220
|
```typescript
|
|
221
221
|
{
|
|
222
|
-
key: '[
|
|
222
|
+
key: '[OBSERVER_KEY]',
|
|
223
223
|
trigger: 'viewEnter',
|
|
224
224
|
params: {
|
|
225
225
|
type: 'alternate',
|
|
@@ -228,7 +228,7 @@ These rules help generate viewport-based interactions using the `@wix/interact`
|
|
|
228
228
|
},
|
|
229
229
|
effects: [
|
|
230
230
|
{
|
|
231
|
-
key: '[
|
|
231
|
+
key: '[ANIMATION_TARGET_KEY]',
|
|
232
232
|
[EFFECT_TYPE]: [EFFECT_DEFINITION],
|
|
233
233
|
duration: [DURATION_MS],
|
|
234
234
|
easing: '[EASING_FUNCTION]',
|
|
@@ -316,7 +316,7 @@ Same as Rule 2
|
|
|
316
316
|
|
|
317
317
|
```typescript
|
|
318
318
|
{
|
|
319
|
-
key: '[
|
|
319
|
+
key: '[SOURCE_KEY]',
|
|
320
320
|
trigger: 'viewEnter',
|
|
321
321
|
params: {
|
|
322
322
|
type: 'state',
|
|
@@ -325,7 +325,7 @@ Same as Rule 2
|
|
|
325
325
|
},
|
|
326
326
|
effects: [
|
|
327
327
|
{
|
|
328
|
-
key: '[
|
|
328
|
+
key: '[TARGET_KEY]',
|
|
329
329
|
[EFFECT_TYPE]: [EFFECT_DEFINITION],
|
|
330
330
|
duration: [DURATION_MS],
|
|
331
331
|
easing: '[EASING_FUNCTION]',
|
|
@@ -417,7 +417,7 @@ Same as Rule 2
|
|
|
417
417
|
|
|
418
418
|
```typescript
|
|
419
419
|
{
|
|
420
|
-
key: '[
|
|
420
|
+
key: '[SOURCE_KEY]',
|
|
421
421
|
trigger: 'viewEnter',
|
|
422
422
|
params: {
|
|
423
423
|
type: '[BEHAVIOR_TYPE]',
|
|
@@ -426,7 +426,7 @@ Same as Rule 2
|
|
|
426
426
|
},
|
|
427
427
|
effects: [
|
|
428
428
|
{
|
|
429
|
-
key: '[
|
|
429
|
+
key: '[TARGET_KEY]',
|
|
430
430
|
[EFFECT_TYPE]: [EFFECT_DEFINITION],
|
|
431
431
|
duration: [DURATION_MS],
|
|
432
432
|
easing: '[EASING_FUNCTION]'
|
|
@@ -576,7 +576,7 @@ Same as Rule 2
|
|
|
576
576
|
|
|
577
577
|
**Variables**:
|
|
578
578
|
|
|
579
|
-
- `[
|
|
579
|
+
- `[ELEMENT_N_KEY]`: Unique identifier for each individual element in sequence
|
|
580
580
|
- `[DELAY_N]`: Progressive delay values (e.g., 0, 100, 200, 300ms)
|
|
581
581
|
- `[SHARED_*]`: Common values used across all elements in the sequence
|
|
582
582
|
- Other variables same as Rule 1
|
|
@@ -885,14 +885,14 @@ Combining with conditions for responsive behavior:
|
|
|
885
885
|
|
|
886
886
|
## Preventing Flash of Unstyled Content (FOUC)
|
|
887
887
|
|
|
888
|
-
When using `viewEnter`
|
|
888
|
+
When using `viewEnter` for entrance animations, elements may briefly appear in their final state before the animation plays. Use the `generate` function to create critical CSS that prevents this.
|
|
889
889
|
|
|
890
890
|
### Using the `generate` Function
|
|
891
891
|
|
|
892
892
|
**Import and generate CSS:**
|
|
893
893
|
|
|
894
|
-
|
|
895
|
-
import { generate } from '@wix/interact';
|
|
894
|
+
```typescript
|
|
895
|
+
import { generate } from '@wix/interact/web';
|
|
896
896
|
|
|
897
897
|
const config: InteractConfig = {
|
|
898
898
|
interactions: [
|
|
@@ -904,19 +904,13 @@ const config: InteractConfig = {
|
|
|
904
904
|
{
|
|
905
905
|
namedEffect: { type: 'FadeIn' },
|
|
906
906
|
duration: 800,
|
|
907
|
-
fill: 'backwards'
|
|
908
|
-
}
|
|
909
|
-
]
|
|
910
|
-
}
|
|
911
|
-
]
|
|
907
|
+
fill: 'backwards',
|
|
908
|
+
},
|
|
909
|
+
],
|
|
910
|
+
},
|
|
911
|
+
],
|
|
912
912
|
};
|
|
913
913
|
|
|
914
|
-
/**Usage:**
|
|
915
|
-
```javascript
|
|
916
|
-
import { generate } from '@wix/interact';
|
|
917
|
-
|
|
918
|
-
const config = {/*...*/};
|
|
919
|
-
|
|
920
914
|
// Generate CSS at build time or on server
|
|
921
915
|
const css = generate(config);
|
|
922
916
|
|
|
@@ -938,7 +932,7 @@ const html = `
|
|
|
938
932
|
</body>
|
|
939
933
|
</html>
|
|
940
934
|
`;
|
|
941
|
-
|
|
935
|
+
```
|
|
942
936
|
|
|
943
937
|
### Generated CSS Behavior
|
|
944
938
|
|