@wix/interact 2.0.0-rc.7 → 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-muYJHOYV.js +18 -0
- package/dist/index-muYJHOYV.js.map +1 -0
- package/dist/{index-DdSF9eaW.mjs → index-wDdpOvzw.mjs} +218 -214
- package/dist/index-wDdpOvzw.mjs.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/handlers/viewEnter.d.ts.map +1 -1
- package/docs/README.md +39 -73
- package/docs/api/README.md +1 -1
- package/docs/api/element-selection.md +38 -38
- 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 +31 -144
- package/docs/guides/configuration-structure.md +8 -8
- 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 +21 -19
- package/rules/hover.md +2 -2
- package/rules/{Integration.md → integration.md} +15 -12
- 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/dist/index-BDNsOpKs.js +0 -18
- package/dist/index-BDNsOpKs.js.map +0 -1
- package/dist/index-DdSF9eaW.mjs.map +0 -1
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
|
|
package/rules/viewprogress.md
CHANGED
|
@@ -17,11 +17,11 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
17
17
|
|
|
18
18
|
```typescript
|
|
19
19
|
{
|
|
20
|
-
key: '[
|
|
20
|
+
key: '[SOURCE_KEY]',
|
|
21
21
|
trigger: 'viewProgress',
|
|
22
22
|
effects: [
|
|
23
23
|
{
|
|
24
|
-
key: '[
|
|
24
|
+
key: '[TARGET_KEY]',
|
|
25
25
|
keyframeEffect: {
|
|
26
26
|
name: '[EFFECT_NAME]',
|
|
27
27
|
keyframes: [EFFECT_KEYFRAMES]
|
|
@@ -38,8 +38,8 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
38
38
|
|
|
39
39
|
**Variables**:
|
|
40
40
|
|
|
41
|
-
- `[
|
|
42
|
-
- `[
|
|
41
|
+
- `[SOURCE_KEY]`: Unique identifier for element that tracks scroll progress
|
|
42
|
+
- `[TARGET_KEY]`: Unique identifier for element to animate (can be same as source or different)
|
|
43
43
|
- `[EFFECT_NAME]`: Optional unique name for the effec
|
|
44
44
|
- `[EFFECT_KEYFRAMES]`: Keyframes for the effect
|
|
45
45
|
- `[RANGE_NAME]`: 'cover', 'contain', 'entry', 'exit', 'entry-crossing', or 'exit-crossing'
|
|
@@ -52,11 +52,11 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
52
52
|
|
|
53
53
|
```typescript
|
|
54
54
|
{
|
|
55
|
-
key: '[
|
|
55
|
+
key: '[SOURCE_KEY]',
|
|
56
56
|
trigger: 'viewProgress',
|
|
57
57
|
effects: [
|
|
58
58
|
{
|
|
59
|
-
key: '[
|
|
59
|
+
key: '[TARGET_KEY]',
|
|
60
60
|
namedEffect: {
|
|
61
61
|
type: '[NAMED_EFFECT]'
|
|
62
62
|
},
|
|
@@ -69,7 +69,7 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
69
69
|
}
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
-
- `[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')
|
|
72
|
+
- `[NAMED_EFFECT]`: Pre-built scroll effect name from @wix/motion-presets (e.g., 'ParallaxScroll', 'MoveScroll', 'FadeScroll', 'RevealScroll', 'GrowScroll', 'SlideScroll', 'SpinScroll', 'PanScroll', 'BlurScroll', 'ArcScroll', 'FlipScroll', 'Spin3dScroll', 'TiltScroll', 'TurnScroll', 'ShapeScroll', 'ShuttersScroll', 'ShrinkScroll', 'SkewPanScroll', 'StretchScroll')
|
|
73
73
|
|
|
74
74
|
**Example - Background Parallax**:
|
|
75
75
|
|
|
@@ -108,11 +108,11 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
108
108
|
|
|
109
109
|
```typescript
|
|
110
110
|
{
|
|
111
|
-
key: '[
|
|
111
|
+
key: '[SOURCE_KEY]',
|
|
112
112
|
trigger: 'viewProgress',
|
|
113
113
|
effects: [
|
|
114
114
|
{
|
|
115
|
-
key: '[
|
|
115
|
+
key: '[TARGET_KEY]',
|
|
116
116
|
namedEffect: {
|
|
117
117
|
type: '[ENTRANCE_EFFECT]'
|
|
118
118
|
},
|
|
@@ -127,7 +127,7 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
127
127
|
|
|
128
128
|
**Variables**:
|
|
129
129
|
|
|
130
|
-
- `[ENTRANCE_EFFECT]`: Named entrance effect from @wix/motion scroll animations (e.g., 'FadeScroll', 'SlideScroll', 'RevealScroll', 'ShapeScroll', 'GrowScroll', 'MoveScroll', 'BlurScroll')
|
|
130
|
+
- `[ENTRANCE_EFFECT]`: Named entrance effect from @wix/motion-presets scroll animations (e.g., 'FadeScroll', 'SlideScroll', 'RevealScroll', 'ShapeScroll', 'GrowScroll', 'MoveScroll', 'BlurScroll')
|
|
131
131
|
- `[ENTRY_START]`: Entry animation start percentage (typically 0-30)
|
|
132
132
|
- `[ENTRY_END]`: Entry animation end percentage (typically 70-100)
|
|
133
133
|
- Other variables same as Rule 1
|
|
@@ -191,11 +191,11 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
191
191
|
|
|
192
192
|
```typescript
|
|
193
193
|
{
|
|
194
|
-
key: '[
|
|
194
|
+
key: '[SOURCE_KEY]',
|
|
195
195
|
trigger: 'viewProgress',
|
|
196
196
|
effects: [
|
|
197
197
|
{
|
|
198
|
-
key: '[
|
|
198
|
+
key: '[TARGET_KEY]',
|
|
199
199
|
keyframeEffect: {
|
|
200
200
|
name: '[EFFECT_NAME]',
|
|
201
201
|
keyframes: [EFFECT_KEYFRAMES]
|
|
@@ -226,7 +226,7 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
226
226
|
{
|
|
227
227
|
key: 'hero-text',
|
|
228
228
|
keyframeEffect: {
|
|
229
|
-
name: 'fade-out'
|
|
229
|
+
name: 'fade-out',
|
|
230
230
|
keyframes: [{
|
|
231
231
|
opacity: 0
|
|
232
232
|
}]
|
|
@@ -257,11 +257,11 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
257
257
|
|
|
258
258
|
```typescript
|
|
259
259
|
{
|
|
260
|
-
key: '[
|
|
260
|
+
key: '[SOURCE_KEY]',
|
|
261
261
|
trigger: 'viewProgress',
|
|
262
262
|
effects: [
|
|
263
263
|
{
|
|
264
|
-
key: '[
|
|
264
|
+
key: '[TARGET_KEY]',
|
|
265
265
|
keyframeEffect: {
|
|
266
266
|
name: '[UNIQUE_KEYFRAME_EFFECT_NAME]',
|
|
267
267
|
keyframes: [
|
|
@@ -329,7 +329,7 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
329
329
|
{ transform: 'scale(1) translateY(-100px)', filter: 'blur(2px)' }
|
|
330
330
|
]
|
|
331
331
|
},
|
|
332
|
-
rangeStart: { name: '
|
|
332
|
+
rangeStart: { name: 'entry', offset: { type: 'percentage', value: 0 } },
|
|
333
333
|
rangeEnd: { name: 'exit', offset: { type: 'percentage', value: 100 } },
|
|
334
334
|
easing: 'linear',
|
|
335
335
|
fill: 'both',
|
|
@@ -356,11 +356,11 @@ These rules help generate scroll-driven interactions using the `@wix/interact` l
|
|
|
356
356
|
|
|
357
357
|
```typescript
|
|
358
358
|
{
|
|
359
|
-
key: '[
|
|
359
|
+
key: '[SOURCE_KEY]',
|
|
360
360
|
trigger: 'viewProgress',
|
|
361
361
|
effects: [
|
|
362
362
|
{
|
|
363
|
-
key: '[
|
|
363
|
+
key: '[TARGET_KEY]',
|
|
364
364
|
keyframeEffect: {
|
|
365
365
|
name: '[UNIQUE_KEYFRAME_EFFECT_NAME]',
|
|
366
366
|
keyframes: [
|
|
@@ -449,11 +449,11 @@ Same as Rule 4, with focus on entry range
|
|
|
449
449
|
|
|
450
450
|
```typescript
|
|
451
451
|
{
|
|
452
|
-
key: '[
|
|
452
|
+
key: '[SOURCE_KEY]',
|
|
453
453
|
trigger: 'viewProgress',
|
|
454
454
|
effects: [
|
|
455
455
|
{
|
|
456
|
-
key: '[
|
|
456
|
+
key: '[TARGET_KEY]',
|
|
457
457
|
keyframeEffect: {
|
|
458
458
|
name: '[UNIQUE_KEYFRAME_EFFECT_NAME]',
|
|
459
459
|
keyframes: [
|
|
@@ -542,12 +542,12 @@ Same as Rule 4, with focus on exit range
|
|
|
542
542
|
|
|
543
543
|
```typescript
|
|
544
544
|
{
|
|
545
|
-
key: '[
|
|
545
|
+
key: '[SOURCE_KEY]',
|
|
546
546
|
trigger: 'viewProgress',
|
|
547
547
|
effects: [
|
|
548
548
|
{
|
|
549
|
-
key: '[
|
|
550
|
-
customEffect: (element, progress
|
|
549
|
+
key: '[TARGET_KEY]',
|
|
550
|
+
customEffect: (element, progress) => {
|
|
551
551
|
// progress is 0-1 representing scroll position within range
|
|
552
552
|
[CUSTOM_ANIMATION_LOGIC]
|
|
553
553
|
},
|
|
@@ -640,12 +640,12 @@ Same as Rule 4, with focus on exit range
|
|
|
640
640
|
|
|
641
641
|
```typescript
|
|
642
642
|
{
|
|
643
|
-
key: '[
|
|
643
|
+
key: '[SOURCE_KEY]',
|
|
644
644
|
trigger: 'viewProgress',
|
|
645
645
|
effects: [
|
|
646
646
|
{
|
|
647
|
-
key: '[
|
|
648
|
-
customEffect: (element, progress
|
|
647
|
+
key: '[TARGET_KEY]',
|
|
648
|
+
customEffect: (element, progress) => {
|
|
649
649
|
// progress is 0-1 representing entry progress
|
|
650
650
|
[ENTRY_ANIMATION_LOGIC]
|
|
651
651
|
},
|
|
@@ -734,12 +734,12 @@ Same as Rule 4, with focus on exit range
|
|
|
734
734
|
|
|
735
735
|
```typescript
|
|
736
736
|
{
|
|
737
|
-
key: '[
|
|
737
|
+
key: '[SOURCE_KEY]',
|
|
738
738
|
trigger: 'viewProgress',
|
|
739
739
|
effects: [
|
|
740
740
|
{
|
|
741
|
-
key: '[
|
|
742
|
-
customEffect: (element, progress
|
|
741
|
+
key: '[TARGET_KEY]',
|
|
742
|
+
customEffect: (element, progress) => {
|
|
743
743
|
// progress is 0-1 representing exit progress
|
|
744
744
|
[EXIT_ANIMATION_LOGIC]
|
|
745
745
|
},
|