@wix/interact 2.0.0-rc.2 → 2.0.0-rc.5
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 +129 -31
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/react.js +1 -1
- package/dist/cjs/react.js.map +1 -1
- package/dist/cjs/web.js +1 -1
- package/dist/cjs/web.js.map +1 -1
- package/dist/es/index.js +1 -1
- package/dist/es/react.js +2 -2
- package/dist/es/react.js.map +1 -1
- package/dist/es/web.js +9 -9
- package/dist/es/web.js.map +1 -1
- package/dist/index-CKecAdEz.mjs +7348 -0
- package/dist/index-CKecAdEz.mjs.map +1 -0
- package/dist/index-DlTJdKHL.js +18 -0
- package/dist/index-DlTJdKHL.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/core/Interact.d.ts +9 -4
- package/dist/types/core/Interact.d.ts.map +1 -1
- package/dist/types/core/InteractionController.d.ts +7 -2
- package/dist/types/core/InteractionController.d.ts.map +1 -1
- package/dist/types/core/add.d.ts.map +1 -1
- package/dist/types/core/remove.d.ts +1 -1
- package/dist/types/core/remove.d.ts.map +1 -1
- package/dist/types/handlers/animationEnd.d.ts.map +1 -1
- package/dist/types/handlers/click.d.ts.map +1 -1
- package/dist/types/handlers/hover.d.ts.map +1 -1
- package/dist/types/handlers/utilities.d.ts.map +1 -1
- package/dist/types/handlers/viewEnter.d.ts +2 -0
- package/dist/types/handlers/viewEnter.d.ts.map +1 -1
- package/dist/types/react/Interaction.d.ts.map +1 -1
- package/dist/types/types.d.ts +11 -5
- package/dist/types/types.d.ts.map +1 -1
- package/dist/types/web/InteractElement.d.ts +3 -1
- package/dist/types/web/InteractElement.d.ts.map +1 -1
- package/docs/README.md +5 -7
- package/package.json +4 -3
- package/rules/Integration.md +87 -39
- package/rules/full-lean.md +63 -7
- package/rules/{viewprogress-rules.md → viewprogress.md} +38 -53
- package/dist/index-C8QxOkui.mjs +0 -7940
- package/dist/index-C8QxOkui.mjs.map +0 -1
- package/dist/index-DEPRHaUt.js +0 -18
- package/dist/index-DEPRHaUt.js.map +0 -1
- /package/rules/{click-rules.md → click.md} +0 -0
- /package/rules/{hover-rules.md → hover.md} +0 -0
- /package/rules/{pointermove-rules.md → pointermove.md} +0 -0
- /package/rules/{scroll-list-rules.md → scroll-list.md} +0 -0
- /package/rules/{viewenter-rules.md → viewenter.md} +0 -0
package/rules/Integration.md
CHANGED
|
@@ -6,31 +6,86 @@ This document outlines the rules and best practices for generating code that int
|
|
|
6
6
|
|
|
7
7
|
`@wix/interact` is a library for creating interactive animations and effects triggered by user actions (click, hover, scroll, etc.). It works by binding **Triggers** and **Effects** to specific **Elements**.
|
|
8
8
|
|
|
9
|
-
## 2.
|
|
9
|
+
## 2. Integrations
|
|
10
10
|
|
|
11
|
-
###
|
|
12
|
-
|
|
11
|
+
### `web` :: using Custom Elements
|
|
12
|
+
|
|
13
|
+
#### 1. Basic Setup
|
|
14
|
+
|
|
15
|
+
**Usage:**
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { Interact } from '@wix/interact/web';
|
|
19
|
+
|
|
20
|
+
// Define your interaction configuration
|
|
21
|
+
const config = {
|
|
22
|
+
interactions: [
|
|
23
|
+
// ...
|
|
24
|
+
],
|
|
25
|
+
effects: {
|
|
26
|
+
// ...
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// Initialize the interact instance
|
|
31
|
+
const interact = Interact.create(config);
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
#### 2. HTML Setup
|
|
13
35
|
|
|
14
36
|
**Rules:**
|
|
15
|
-
- MUST have a `data-interact-key` attribute that is unique within the scope.
|
|
37
|
+
- MUST have a `data-interact-key` attribute with a value that is unique within the scope.
|
|
16
38
|
- MUST contain at least one child element.
|
|
17
|
-
- **Usage:**
|
|
18
|
-
```html
|
|
19
|
-
<interact-element data-interact-key="my-button">
|
|
20
|
-
<button>Click Me</button>
|
|
21
|
-
</interact-element>
|
|
22
|
-
```
|
|
23
39
|
|
|
24
|
-
|
|
25
|
-
|
|
40
|
+
**Usage:**
|
|
41
|
+
```html
|
|
42
|
+
<!-- Wrap your target element with interact-element -->
|
|
43
|
+
<interact-element data-interact-key="my-element">
|
|
44
|
+
<div>This will fade in when it enters the viewport!</div>
|
|
45
|
+
</interact-element>
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### `react` :: using React
|
|
49
|
+
|
|
50
|
+
#### 1. Basic Setup
|
|
51
|
+
|
|
52
|
+
**Usage:**
|
|
53
|
+
```typescript
|
|
54
|
+
import { Interact } from '@wix/interact/react';
|
|
55
|
+
|
|
56
|
+
// Define your interaction configuration
|
|
57
|
+
const config = {
|
|
58
|
+
interactions: [
|
|
59
|
+
// ...
|
|
60
|
+
],
|
|
61
|
+
effects: {
|
|
62
|
+
// ...
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Initialize the interact instance
|
|
67
|
+
const interact = Interact.create(config);
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
#### 2. HTML Setup
|
|
26
71
|
|
|
27
72
|
**Rules:**
|
|
28
|
-
- MUST
|
|
29
|
-
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
73
|
+
- MUST replace the element itself with the `<Interaction/>` component.
|
|
74
|
+
- MUST set the `tagName` prop with the tag of the replaced element.
|
|
75
|
+
- MUST set the `interactKey` prop to a unique string within the scope.
|
|
76
|
+
|
|
77
|
+
**Usage:**
|
|
78
|
+
```tsx
|
|
79
|
+
import { Interaction } from '@wix/interact/react';
|
|
80
|
+
|
|
81
|
+
function MyComponent() {
|
|
82
|
+
return (
|
|
83
|
+
<Interaction tagName="div" interactKey="my-element" className="animated-content">
|
|
84
|
+
Hello, animated world!
|
|
85
|
+
</Interaction>
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
34
89
|
|
|
35
90
|
## 3. Configuration Schema
|
|
36
91
|
|
|
@@ -60,7 +115,7 @@ type InteractConfig = {
|
|
|
60
115
|
### Element Selection Hierarchy
|
|
61
116
|
1. **`listContainer`**: If present, selects a container to target its immediate children as list items.
|
|
62
117
|
2. **`selector`**: Matches elements within the root, or within each list item.
|
|
63
|
-
3. **Fallback**: If neither is provided, targets the **first child** of `<interact-element
|
|
118
|
+
3. **Fallback**: If neither is provided, targets the **first child** of `<interact-element>` in `web` or the root element in `react`.
|
|
64
119
|
|
|
65
120
|
## 4. Generating Critical CSS for Entrance Animations
|
|
66
121
|
|
|
@@ -69,13 +124,11 @@ Generates critical CSS styles that prevent flash-of-unstyled-content (FOUC) for
|
|
|
69
124
|
|
|
70
125
|
**Rules:**
|
|
71
126
|
- MUST be called server-side or at build time to generate static CSS.
|
|
72
|
-
-
|
|
73
|
-
- Only affects users who have not requested reduced motion (`prefers-reduced-motion: no-preference`).
|
|
74
|
-
- The `<interact-element>` MUST have `data-interact-initial="true"` attribute to be affected by the generated CSS.
|
|
127
|
+
- MUST set `data-interact-initial="true"` on elements that have an entrance effect.
|
|
75
128
|
|
|
76
129
|
**Usage:**
|
|
77
130
|
```javascript
|
|
78
|
-
import { generate } from '@wix/interact';
|
|
131
|
+
import { generate } from '@wix/interact/web';
|
|
79
132
|
|
|
80
133
|
const config = {/*...*/};
|
|
81
134
|
|
|
@@ -102,25 +155,20 @@ const html = `
|
|
|
102
155
|
```
|
|
103
156
|
|
|
104
157
|
**When to Use:**
|
|
105
|
-
- For elements that
|
|
158
|
+
- For elements with an entrance efffect that is triggered a with `viewEnter`
|
|
106
159
|
- To prevent elements from being visible before their entrance animation plays
|
|
107
160
|
- For server-side rendering (SSR) or static site generation (SSG) scenarios
|
|
108
161
|
|
|
109
|
-
**Important Notes:**
|
|
110
|
-
- The attribute `data-motion-enter="done"` is automatically set by the runtime when the entrance animation completes
|
|
111
|
-
- Users with `prefers-reduced-motion: reduce` will see elements immediately (no hiding)
|
|
112
|
-
- The CSS resets transform properties to prevent any inherited transforms from affecting the hidden state
|
|
113
|
-
|
|
114
162
|
## 5. Triggers & Behaviors
|
|
115
163
|
|
|
116
|
-
| Trigger | Description | Key Parameters |
|
|
117
|
-
| :--- | :--- | :--- |
|
|
118
|
-
| `hover` | Mouse enter/leave | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states |
|
|
119
|
-
| `click` | Mouse click | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states |
|
|
120
|
-
| `viewEnter` | Element enters viewport | `type`: 'once', 'alternate', 'repeat', 'state'; `threshold` (0-1) |
|
|
121
|
-
| `viewProgress` | Scroll
|
|
122
|
-
| `pointerMove` | Mouse movement | `hitArea`: 'self' (default) or 'root' |
|
|
123
|
-
| `animationEnd` | Chaining animations | `effectId`: ID of the previous effect |
|
|
164
|
+
| Trigger | Description | Key Parameters | Rules File |
|
|
165
|
+
| :--- | :--- | :--- | :--- |
|
|
166
|
+
| `hover` | Mouse enter/leave | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states | `./hover.md` |
|
|
167
|
+
| `click` | Mouse click | `type`: 'once', 'alternate', 'repeat', 'state' for animations, or `method`: 'add', 'remove', 'toggle', 'clear' for states | `./click.md` |
|
|
168
|
+
| `viewEnter` | Element enters viewport | `type`: 'once', 'alternate', 'repeat', 'state'; `threshold` (0-1) | `./viewEnter.md` |
|
|
169
|
+
| `viewProgress` | Scroll-driven using ViewTimeline | (No specific params, uses effect ranges) | `./viewprogress.md` |
|
|
170
|
+
| `pointerMove` | Mouse movement | `hitArea`: 'self' (default) or 'root' | `./pointermove.md` |
|
|
171
|
+
| `animationEnd` | Chaining animations | `effectId`: ID of the previous effect | -- |
|
|
124
172
|
|
|
125
173
|
## 6. Effects & Animations
|
|
126
174
|
|
|
@@ -170,7 +218,8 @@ Used with `viewProgress`, linked to scroll progress while element is inside view
|
|
|
170
218
|
{
|
|
171
219
|
keyframeEffect: { ... },
|
|
172
220
|
rangeStart: { name: 'cover', offset: { value: 0, type: 'percentage' } },
|
|
173
|
-
rangeEnd: { name: 'cover', offset: { value: 100, type: 'percentage' } }
|
|
221
|
+
rangeEnd: { name: 'cover', offset: { value: 100, type: 'percentage' } },
|
|
222
|
+
fill: 'both'
|
|
174
223
|
}
|
|
175
224
|
```
|
|
176
225
|
|
|
@@ -252,4 +301,3 @@ const config = {
|
|
|
252
301
|
}]
|
|
253
302
|
};
|
|
254
303
|
```
|
|
255
|
-
|
package/rules/full-lean.md
CHANGED
|
@@ -4,8 +4,21 @@
|
|
|
4
4
|
- Call `Interact.create(config)` once to initialize.
|
|
5
5
|
- Create the full configuration up‑front and pass it in a single `create` call to avoid unintended overrides; subsequent calls replace the previous config.
|
|
6
6
|
|
|
7
|
+
**For web (Custom Elements):**
|
|
7
8
|
```ts
|
|
8
|
-
import { Interact } from '@wix/interact';
|
|
9
|
+
import { Interact } from '@wix/interact/web';
|
|
10
|
+
import type { InteractConfig } from '@wix/interact';
|
|
11
|
+
|
|
12
|
+
const config: InteractConfig = {
|
|
13
|
+
// config-props
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
Interact.create(config);
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
**For React:**
|
|
20
|
+
```ts
|
|
21
|
+
import { Interact } from '@wix/interact/react';
|
|
9
22
|
import type { InteractConfig } from '@wix/interact';
|
|
10
23
|
|
|
11
24
|
const config: InteractConfig = {
|
|
@@ -19,7 +32,7 @@ Interact.create(config);
|
|
|
19
32
|
|
|
20
33
|
```html
|
|
21
34
|
<script type="module">
|
|
22
|
-
import { Interact } from 'https://esm.sh/@wix/interact@
|
|
35
|
+
import { Interact } from 'https://esm.sh/@wix/interact@2.0.0-rc.4';
|
|
23
36
|
|
|
24
37
|
const config = {
|
|
25
38
|
// config-props
|
|
@@ -38,7 +51,7 @@ Interact.create(config);
|
|
|
38
51
|
|
|
39
52
|
**Usage:**
|
|
40
53
|
```javascript
|
|
41
|
-
import { generate } from '@wix/interact';
|
|
54
|
+
import { generate } from '@wix/interact/web';
|
|
42
55
|
|
|
43
56
|
const config = {/*...*/};
|
|
44
57
|
|
|
@@ -82,7 +95,7 @@ This configuration declares what user/system triggers occur on which source elem
|
|
|
82
95
|
- **Element keys**: All element keys (`key` fields) refer to the element path string (e.g., the value used in `data-interact-key`) and MUST be stable for the lifetime of the configuration.
|
|
83
96
|
- **List context**: Where both a list container and list item selector are provided, they MUST describe the same list context across an interaction and its effects. Mismatched list contexts will be ignored by the system.
|
|
84
97
|
- **Conditions**: Conditions act as guards. If any condition on an interaction or effect evaluates to false, the corresponding trigger/effect WILL NOT be applied.
|
|
85
|
-
- **
|
|
98
|
+
- **Element binding**: Do NOT add observers/listeners manually. For web, wrap the DOM subtree with `<interact-element>` and set `data-interact-key` to the element key. For React, use the `<Interaction>` component with `interactKey` prop. Use the same key in your config (`Interaction.key`/`Effect.key`). The runtime binds triggers/effects via this attribute.
|
|
86
99
|
|
|
87
100
|
### Structure
|
|
88
101
|
- **effects: Record<string, Effect>**
|
|
@@ -171,9 +184,13 @@ This configuration declares what user/system triggers occur on which source elem
|
|
|
171
184
|
- **effects: Array<Effect | EffectRef>**
|
|
172
185
|
- REQUIRED. The effects to apply when the trigger fires. Ordering is significant: the first array entry is applied first. The system may reverse internal storage to preserve this application order.
|
|
173
186
|
|
|
174
|
-
### Working with
|
|
175
|
-
|
|
176
|
-
|
|
187
|
+
### Working with elements
|
|
188
|
+
|
|
189
|
+
#### Web: `<interact-element>` custom element
|
|
190
|
+
- Wrap the interactive DOM subtree with the custom element and set `data-interact-key` to a stable key. Reference that same key from your config via `Interaction.key` (and optionally `Effect.key`). No observers/listeners or manual DOM querying are needed—the runtime binds triggers and effects via this attribute.
|
|
191
|
+
- If an effect targets an element that is not the interaction's source, you MUST also wrap that target element's subtree with its own `<interact-element>` and set `data-interact-key` to the target's key (the value used in `Effect.key` or the referenced registry Effect's `key`). This is required so the runtime can locate and apply effects to non-source targets.
|
|
192
|
+
- MUST have a `data-interact-key` attribute with a value that is unique within the scope.
|
|
193
|
+
- MUST contain at least one child element.
|
|
177
194
|
|
|
178
195
|
```html
|
|
179
196
|
<interact-element data-interact-key="my-button">
|
|
@@ -229,6 +246,45 @@ const config: InteractConfig = {
|
|
|
229
246
|
};
|
|
230
247
|
```
|
|
231
248
|
|
|
249
|
+
#### React: `<Interaction>` component
|
|
250
|
+
- MUST replace the element itself with the `<Interaction/>` component.
|
|
251
|
+
- MUST set the `tagName` prop with the tag of the replaced element.
|
|
252
|
+
- MUST set the `interactKey` prop to a unique string within the scope.
|
|
253
|
+
|
|
254
|
+
```tsx
|
|
255
|
+
import { Interaction } from '@wix/interact/react';
|
|
256
|
+
|
|
257
|
+
function MyComponent() {
|
|
258
|
+
return (
|
|
259
|
+
<Interaction tagName="button" interactKey="my-button" className="btn">
|
|
260
|
+
Click me
|
|
261
|
+
</Interaction>
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
For a different target element:
|
|
267
|
+
|
|
268
|
+
```tsx
|
|
269
|
+
import { Interaction } from '@wix/interact/react';
|
|
270
|
+
|
|
271
|
+
function MyComponent() {
|
|
272
|
+
return (
|
|
273
|
+
<>
|
|
274
|
+
<Interaction tagName="button" interactKey="my-button" className="btn">
|
|
275
|
+
Click me
|
|
276
|
+
</Interaction>
|
|
277
|
+
|
|
278
|
+
<Interaction tagName="span" interactKey="my-badge" className="badge">
|
|
279
|
+
Badge
|
|
280
|
+
</Interaction>
|
|
281
|
+
</>
|
|
282
|
+
);
|
|
283
|
+
}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
The config remains the same for both integrations—only the HTML/JSX setup differs.
|
|
287
|
+
|
|
232
288
|
### Effect rules (applies to both registry-defined Effect and inline Effect within interactions)
|
|
233
289
|
- Common fields (`EffectBase`):
|
|
234
290
|
- **key?: string**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# ViewProgress Trigger Rules for @wix/interact
|
|
2
2
|
|
|
3
|
-
These rules help generate scroll-driven interactions using the `@wix/interact` library.
|
|
3
|
+
These rules help generate scroll-driven interactions using the `@wix/interact` library. `viewProgress` triggers create scroll-based animations that update continuously as elements move through the viewport, leveraging native CSS ViewTimelines.
|
|
4
4
|
|
|
5
5
|
## Rule 1: Range-Based Parallax/Continuous Animation Control with Named Effects
|
|
6
6
|
|
|
@@ -12,7 +12,7 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
12
12
|
- For continuous scroll-driven decorative animations
|
|
13
13
|
- When using pre-built motion effects for scroll interactions
|
|
14
14
|
|
|
15
|
-
**Pattern**:
|
|
15
|
+
**KeyframeEffect Pattern**:
|
|
16
16
|
```typescript
|
|
17
17
|
{
|
|
18
18
|
key: '[SOURCE_SELECTOR]',
|
|
@@ -20,12 +20,14 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
20
20
|
effects: [
|
|
21
21
|
{
|
|
22
22
|
key: '[TARGET_SELECTOR]',
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
keyframeEffect: {
|
|
24
|
+
name: '[EFFECT_NAME]',
|
|
25
|
+
keyframes: [EFFECT_KEYFRAMES]
|
|
25
26
|
},
|
|
26
27
|
rangeStart: { name: '[RANGE_NAME]', offset: { type: 'percentage', value: [START_PERCENTAGE] } },
|
|
27
28
|
rangeEnd: { name: '[RANGE_NAME]', offset: { type: 'percentage', value: [END_PERCENTAGE] } },
|
|
28
29
|
easing: '[EASING_FUNCTION]',
|
|
30
|
+
fill: 'both',
|
|
29
31
|
effectId: '[UNIQUE_EFFECT_ID]'
|
|
30
32
|
}
|
|
31
33
|
]
|
|
@@ -35,48 +37,50 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
35
37
|
**Variables**:
|
|
36
38
|
- `[SOURCE_SELECTOR]`: Unique identifier for element that tracks scroll progress
|
|
37
39
|
- `[TARGET_SELECTOR]`: Unique identifier for element to animate (can be same as source or different)
|
|
38
|
-
- `[
|
|
40
|
+
- `[EFFECT_NAME]`: Optional unique name for the effec
|
|
41
|
+
- `[EFFECT_KEYFRAMES]`: Keyframes for the effect
|
|
39
42
|
- `[RANGE_NAME]`: 'cover', 'contain', 'entry', 'exit', 'entry-crossing', or 'exit-crossing'
|
|
40
43
|
- `[START_PERCENTAGE]`: Start point as percentage (0-100)
|
|
41
44
|
- `[END_PERCENTAGE]`: End point as percentage (0-100)
|
|
42
45
|
- `[EASING_FUNCTION]`: Timing function (typically 'linear' for smooth scroll effects)
|
|
43
46
|
- `[UNIQUE_EFFECT_ID]`: Optional unique identifier
|
|
44
47
|
|
|
45
|
-
**
|
|
48
|
+
**NamedEffect Pattern**:
|
|
46
49
|
```typescript
|
|
47
50
|
{
|
|
48
|
-
key: '
|
|
51
|
+
key: '[SOURCE_SELECTOR]',
|
|
49
52
|
trigger: 'viewProgress',
|
|
50
53
|
effects: [
|
|
51
54
|
{
|
|
52
|
-
key: '
|
|
55
|
+
key: '[TARGET_SELECTOR]',
|
|
53
56
|
namedEffect: {
|
|
54
|
-
|
|
57
|
+
type: '[NAMED_EFFECT]'
|
|
55
58
|
},
|
|
56
|
-
rangeStart: { name: '
|
|
57
|
-
rangeEnd: { name: '
|
|
58
|
-
easing: '
|
|
59
|
+
rangeStart: { name: '[RANGE_NAME]', offset: { type: 'percentage', value: [START_PERCENTAGE] } },
|
|
60
|
+
rangeEnd: { name: '[RANGE_NAME]', offset: { type: 'percentage', value: [END_PERCENTAGE] } },
|
|
61
|
+
easing: '[EASING_FUNCTION]',
|
|
62
|
+
effectId: '[UNIQUE_EFFECT_ID]'
|
|
59
63
|
}
|
|
60
64
|
]
|
|
61
65
|
}
|
|
62
66
|
```
|
|
67
|
+
- `[NAMED_EFFECT]`: Pre-built scroll effect name from @wix/motion (e.g., 'ParallaxScroll', 'MoveScroll', 'FadeScroll', 'RevealScroll', 'GrowScroll', 'SlideScroll', 'SpinScroll', 'PanScroll', 'BlurScroll', 'ArcScroll', 'FlipScroll', 'Spin3dScroll', 'TiltScroll', 'TurnScroll', 'ShapeScroll', 'ShuttersScroll', 'ShrinkScroll', 'SkewPanScroll', 'StretchScroll')
|
|
68
|
+
|
|
63
69
|
|
|
64
|
-
**Example -
|
|
70
|
+
**Example - Background Parallax**:
|
|
65
71
|
```typescript
|
|
66
72
|
{
|
|
67
|
-
key: '
|
|
73
|
+
key: 'hero-section',
|
|
68
74
|
trigger: 'viewProgress',
|
|
69
75
|
effects: [
|
|
70
76
|
{
|
|
71
|
-
key: '
|
|
77
|
+
key: 'hero-background',
|
|
72
78
|
namedEffect: {
|
|
73
|
-
type: '
|
|
74
|
-
angle: 45 // 45-degree angle movement
|
|
79
|
+
type: 'ParallaxScroll'
|
|
75
80
|
},
|
|
76
|
-
rangeStart: { name: '
|
|
77
|
-
rangeEnd: { name: '
|
|
78
|
-
easing: 'linear'
|
|
79
|
-
effectId: 'decoration-float'
|
|
81
|
+
rangeStart: { name: 'cover', offset: { type: 'percentage', value: 0 } },
|
|
82
|
+
rangeEnd: { name: 'cover', offset: { type: 'percentage', value: 100 } },
|
|
83
|
+
easing: 'linear'
|
|
80
84
|
}
|
|
81
85
|
]
|
|
82
86
|
}
|
|
@@ -180,13 +184,14 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
180
184
|
effects: [
|
|
181
185
|
{
|
|
182
186
|
key: '[TARGET_SELECTOR]',
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
187
|
+
keyframeEffect: {
|
|
188
|
+
name: '[EFFECT_NAME]',
|
|
189
|
+
keyframes: [EFFECT_KEYFRAMES]
|
|
186
190
|
},
|
|
187
191
|
rangeStart: { name: 'exit', offset: { type: 'percentage', value: [EXIT_START] } },
|
|
188
192
|
rangeEnd: { name: 'exit', offset: { type: 'percentage', value: [EXIT_END] } },
|
|
189
193
|
easing: '[EASING_FUNCTION]',
|
|
194
|
+
fill: 'both',
|
|
190
195
|
effectId: '[UNIQUE_EFFECT_ID]'
|
|
191
196
|
}
|
|
192
197
|
]
|
|
@@ -194,10 +199,9 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
194
199
|
```
|
|
195
200
|
|
|
196
201
|
**Variables**:
|
|
197
|
-
- `[EXIT_EFFECT]`: Named exit effect (e.g., 'FadeScroll', 'SlideScroll', 'GrowScroll', 'ShrinkScroll')
|
|
198
202
|
- `[EXIT_START]`: Exit animation start percentage (typically 0-30)
|
|
199
203
|
- `[EXIT_END]`: Exit animation end percentage (typically 70-100)
|
|
200
|
-
-
|
|
204
|
+
- `[EFFECT_KEYFRAMES]`:
|
|
201
205
|
|
|
202
206
|
**Example - Content Fade Out on Exit**:
|
|
203
207
|
```typescript
|
|
@@ -207,35 +211,16 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
207
211
|
effects: [
|
|
208
212
|
{
|
|
209
213
|
key: 'hero-text',
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
214
|
+
keyframeEffect: {
|
|
215
|
+
name: 'fade-out'
|
|
216
|
+
keyframes: [{
|
|
217
|
+
opacity: 0
|
|
218
|
+
}]
|
|
213
219
|
},
|
|
214
220
|
rangeStart: { name: 'exit', offset: { type: 'percentage', value: 0 } },
|
|
215
|
-
rangeEnd: { name: 'exit', offset: { type: 'percentage', value:
|
|
216
|
-
easing: 'ease-in'
|
|
217
|
-
|
|
218
|
-
]
|
|
219
|
-
}
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
**Example - Navigation Hide on Scroll Out**:
|
|
223
|
-
```typescript
|
|
224
|
-
{
|
|
225
|
-
key: 'main-content',
|
|
226
|
-
trigger: 'viewProgress',
|
|
227
|
-
effects: [
|
|
228
|
-
{
|
|
229
|
-
key: 'floating-nav',
|
|
230
|
-
namedEffect: {
|
|
231
|
-
type: 'SlideScroll',
|
|
232
|
-
direction: 'top',
|
|
233
|
-
range: 'out'
|
|
234
|
-
},
|
|
235
|
-
rangeStart: { name: 'exit', offset: { type: 'percentage', value: 20 } },
|
|
236
|
-
rangeEnd: { name: 'exit', offset: { type: 'percentage', value: 80 } },
|
|
237
|
-
easing: 'ease-in-out',
|
|
238
|
-
effectId: 'nav-hide'
|
|
221
|
+
rangeEnd: { name: 'exit', offset: { type: 'percentage', value: 100 } },
|
|
222
|
+
easing: 'ease-in',
|
|
223
|
+
fill: 'both'
|
|
239
224
|
}
|
|
240
225
|
]
|
|
241
226
|
}
|