use-scroll-animate 6.2.0 → 6.3.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/CHANGELOG.md +14 -0
- package/dist/chunks/{base-C_3cAoRz.js → base-DchG4q_S.js} +2 -2
- package/dist/chunks/{base-C_3cAoRz.js.map → base-DchG4q_S.js.map} +1 -1
- package/dist/chunks/{core-ps8uvYuN.js → core-D2vF8kZb.js} +2 -2
- package/dist/chunks/{core-ps8uvYuN.js.map → core-D2vF8kZb.js.map} +1 -1
- package/dist/chunks/{core-VEBw36QK.js → core-DVyTlo9Q.js} +2 -2
- package/dist/chunks/{core-VEBw36QK.js.map → core-DVyTlo9Q.js.map} +1 -1
- package/dist/chunks/{fx-Bs6IrV4Q.js → fx-DUMVKSvg.js} +2 -2
- package/dist/chunks/{fx-Bs6IrV4Q.js.map → fx-DUMVKSvg.js.map} +1 -1
- package/dist/chunks/{generative-DzIZq-_g.cjs → generative-BHIj-NU0.cjs} +3 -56
- package/dist/chunks/generative-BHIj-NU0.cjs.map +1 -0
- package/dist/chunks/{generative-D2YyhaeO.js → generative-BRUZaIsX.js} +3 -49
- package/dist/chunks/generative-BRUZaIsX.js.map +1 -0
- package/dist/chunks/{gpu-CenK2l6b.cjs → gpu-BBRLgEzM.cjs} +13 -12
- package/dist/chunks/gpu-BBRLgEzM.cjs.map +1 -0
- package/dist/chunks/{gpu-Bu7qwugO.js → gpu-XHWzeNb5.js} +4 -3
- package/dist/chunks/gpu-XHWzeNb5.js.map +1 -0
- package/dist/chunks/{registry-CKNLQpwd.js → registry-Bu5NrAyA.js} +2 -2
- package/dist/chunks/{registry-CKNLQpwd.js.map → registry-Bu5NrAyA.js.map} +1 -1
- package/dist/chunks/shared-eweTlzxv.js +50 -0
- package/dist/chunks/shared-eweTlzxv.js.map +1 -0
- package/dist/chunks/shared-jkgRH-Hx.cjs +58 -0
- package/dist/chunks/shared-jkgRH-Hx.cjs.map +1 -0
- package/dist/chunks/{spring-CbvHfVtP.js → spring-BhoT09Qb.js} +2 -2
- package/dist/chunks/{spring-CbvHfVtP.js.map → spring-BhoT09Qb.js.map} +1 -1
- package/dist/chunks/{variants-DRlKVHvu.js → variants-C_hv_s23.js} +2 -2
- package/dist/chunks/{variants-DRlKVHvu.js.map → variants-C_hv_s23.js.map} +1 -1
- package/dist/components/a11y.js +2 -2
- package/dist/components/angular.js +7 -7
- package/dist/components/background.js +2 -2
- package/dist/components/bridge.js +1 -1
- package/dist/components/cards.js +2 -2
- package/dist/components/click.js +3 -3
- package/dist/components/depth.js +3 -3
- package/dist/components/effects.cjs +45 -44
- package/dist/components/effects.cjs.map +1 -1
- package/dist/components/effects.js +7 -6
- package/dist/components/effects.js.map +1 -1
- package/dist/components/feedback.js +1 -1
- package/dist/components/fx-gpu.cjs +3 -2
- package/dist/components/fx-gpu.cjs.map +1 -1
- package/dist/components/fx-gpu.js +5 -4
- package/dist/components/fx-gpu.js.map +1 -1
- package/dist/components/fx-text.cjs +267 -0
- package/dist/components/fx-text.cjs.map +1 -0
- package/dist/components/fx-text.d.cts +70 -0
- package/dist/components/fx-text.d.ts +70 -0
- package/dist/components/fx-text.js +263 -0
- package/dist/components/fx-text.js.map +1 -0
- package/dist/components/fx.js +5 -5
- package/dist/components/fx2.cjs +9 -2
- package/dist/components/fx2.cjs.map +1 -1
- package/dist/components/fx2.d.cts +27 -1
- package/dist/components/fx2.d.ts +27 -1
- package/dist/components/fx2.js +11 -6
- package/dist/components/fx2.js.map +1 -1
- package/dist/components/gesture.js +4 -4
- package/dist/components/interaction.js +1 -1
- package/dist/components/layout.js +1 -1
- package/dist/components/packs.js +1 -1
- package/dist/components/page.js +3 -3
- package/dist/components/perf.js +2 -2
- package/dist/components/physics.js +3 -3
- package/dist/components/reveal.js +1 -1
- package/dist/components/solid.js +7 -7
- package/dist/components/svelte.js +7 -7
- package/dist/components/svg.js +1 -1
- package/dist/components/text.js +2 -2
- package/dist/components/timeline.js +3 -3
- package/dist/components/transitions.js +1 -1
- package/dist/components/ui.js +4 -4
- package/dist/components/vue.js +7 -7
- package/dist/components/webgl.js +1 -1
- package/dist/components/widgets.cjs +591 -8
- package/dist/components/widgets.cjs.map +1 -1
- package/dist/components/widgets.d.cts +98 -2
- package/dist/components/widgets.d.ts +98 -2
- package/dist/components/widgets.js +585 -11
- package/dist/components/widgets.js.map +1 -1
- package/dist/components.js +9 -9
- package/dist/index.js +2 -2
- package/dist/widgets.umd.js +1 -1
- package/dist/widgets.umd.js.map +1 -1
- package/docs/ROADMAP.md +1 -1
- package/docs/components.md +32 -0
- package/package.json +11 -1
- package/dist/chunks/generative-D2YyhaeO.js.map +0 -1
- package/dist/chunks/generative-DzIZq-_g.cjs.map +0 -1
- package/dist/chunks/gpu-Bu7qwugO.js.map +0 -1
- package/dist/chunks/gpu-CenK2l6b.cjs.map +0 -1
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var components_fx = require('./fx.cjs');
|
|
4
|
-
var
|
|
4
|
+
var shared = require('../chunks/shared-jkgRH-Hx.cjs');
|
|
5
5
|
var base = require('../chunks/base-BaQV-2ha.cjs');
|
|
6
|
+
var generative = require('../chunks/generative-BHIj-NU0.cjs');
|
|
6
7
|
var registry = require('../chunks/registry-DehBVRDV.cjs');
|
|
7
8
|
var components_tokens = require('./tokens.cjs');
|
|
8
9
|
var core = require('../chunks/core-BGAyaY6L.cjs');
|
|
@@ -16,7 +17,7 @@ const CARD_FX = [
|
|
|
16
17
|
reduced: 'run',
|
|
17
18
|
defaults: { strength: 0.55 },
|
|
18
19
|
run: (el, o, ctx) => {
|
|
19
|
-
const [layer, remove] =
|
|
20
|
+
const [layer, remove] = shared.overlay(el, `mix-blend-mode:color-dodge;opacity:${o.strength};background:linear-gradient(115deg,transparent 20%,#ff8bd855 35%,#8bf3ff55 45%,#fff58b55 55%,transparent 70%),repeating-linear-gradient(55deg,#ffffff10 0 2px,transparent 2px 6px);background-size:250% 250%,100% 100%;background-position:50% 50%;transition:background-position .2s ease-out`);
|
|
20
21
|
if (ctx.reduced)
|
|
21
22
|
return remove;
|
|
22
23
|
const move = (e) => {
|
|
@@ -48,7 +49,7 @@ const CARD_FX = [
|
|
|
48
49
|
run: (el, o, ctx) => {
|
|
49
50
|
if (ctx.reduced)
|
|
50
51
|
return;
|
|
51
|
-
const [g, remove] =
|
|
52
|
+
const [g, remove] = shared.overlay(el, `overflow:hidden;background:linear-gradient(105deg,transparent 35%,${o.color} 50%,transparent 65%);background-size:250% 100%`);
|
|
52
53
|
const a = ctx.animate(g, [{ backgroundPosition: '150% 0' }, { backgroundPosition: '-50% 0' }], { duration: o.duration, easing: 'ease-in-out' });
|
|
53
54
|
if (a)
|
|
54
55
|
a.finished.then(remove, remove);
|
|
@@ -75,7 +76,7 @@ const CARD_FX = [
|
|
|
75
76
|
run: (el, o, ctx) => {
|
|
76
77
|
const kids = Array.from(el.children);
|
|
77
78
|
const mid = (kids.length - 1) / 2;
|
|
78
|
-
return
|
|
79
|
+
return shared.all(kids.map((k, i) => ctx.animate(k, [{ transform: 'none' }, { transform: `translateX(${(i - mid) * o.spread}px) rotate(${(i - mid) * (o.spread / 2)}deg)`, offset: 0.5 }, { transform: 'none' }], { duration: o.duration, easing: 'cubic-bezier(0.34, 1.56, 0.64, 1)' })));
|
|
79
80
|
},
|
|
80
81
|
},
|
|
81
82
|
{
|
|
@@ -108,24 +109,24 @@ const CLICK_FX = [
|
|
|
108
109
|
run: (el, o, ctx) => {
|
|
109
110
|
if (ctx.reduced)
|
|
110
111
|
return;
|
|
111
|
-
const { x, y } =
|
|
112
|
-
return
|
|
112
|
+
const { x, y } = shared.origin(el, ctx);
|
|
113
|
+
return shared.all([0, 120].map((delay) => shared.spawn(x, y, `width:${o.size}px;height:${o.size}px;margin:${-o.size / 2}px 0 0 ${-o.size / 2}px;border:3px solid ${o.color};border-radius:50%`, ctx, [{ transform: 'scale(0)', opacity: 0.9 }, { transform: 'scale(1)', opacity: 0 }], { duration: o.duration, delay, easing: 'cubic-bezier(0.22, 1, 0.36, 1)' })));
|
|
113
114
|
},
|
|
114
115
|
},
|
|
115
116
|
{
|
|
116
117
|
name: 'ink-splash',
|
|
117
118
|
kind: 'click',
|
|
118
119
|
description: 'Ink blobs splatter from the click point and fade.',
|
|
119
|
-
defaults: { count: 9, colors:
|
|
120
|
+
defaults: { count: 9, colors: shared.PALETTE, duration: 800 },
|
|
120
121
|
run: (el, o, ctx) => {
|
|
121
122
|
if (ctx.reduced)
|
|
122
123
|
return;
|
|
123
|
-
const { x, y } =
|
|
124
|
-
return
|
|
125
|
-
const s =
|
|
126
|
-
const ang =
|
|
127
|
-
const d =
|
|
128
|
-
return
|
|
124
|
+
const { x, y } = shared.origin(el, ctx);
|
|
125
|
+
return shared.all(Array.from({ length: o.count }, (_, i) => {
|
|
126
|
+
const s = shared.rand(6, 22);
|
|
127
|
+
const ang = shared.rand(0, Math.PI * 2);
|
|
128
|
+
const d = shared.rand(20, 70);
|
|
129
|
+
return shared.spawn(x, y, `width:${s}px;height:${s}px;margin:${-s / 2}px 0 0 ${-s / 2}px;background:${o.colors[i % o.colors.length]};border-radius:${shared.rand(40, 50)}% ${shared.rand(50, 60)}% ${shared.rand(40, 60)}% ${shared.rand(45, 55)}%`, ctx, [{ transform: 'translate(0,0) scale(.3)', opacity: 1 }, { transform: `translate(${Math.cos(ang) * d}px,${Math.sin(ang) * d}px) scale(1)`, opacity: 0.9, offset: 0.5 }, { transform: `translate(${Math.cos(ang) * d}px,${Math.sin(ang) * d + 8}px) scale(1.1)`, opacity: 0 }], { duration: o.duration, easing: 'cubic-bezier(0.22, 1, 0.36, 1)' });
|
|
129
130
|
}));
|
|
130
131
|
},
|
|
131
132
|
},
|
|
@@ -137,12 +138,12 @@ const CLICK_FX = [
|
|
|
137
138
|
run: (el, o, ctx) => {
|
|
138
139
|
if (ctx.reduced)
|
|
139
140
|
return;
|
|
140
|
-
const { x, y } =
|
|
141
|
-
return
|
|
141
|
+
const { x, y } = shared.origin(el, ctx);
|
|
142
|
+
return shared.all(Array.from({ length: o.count }, (_, i) => {
|
|
142
143
|
const ang = (i / o.count) * Math.PI * 2;
|
|
143
|
-
const d =
|
|
144
|
-
const s =
|
|
145
|
-
return
|
|
144
|
+
const d = shared.rand(40, 80);
|
|
145
|
+
const s = shared.rand(12, 22);
|
|
146
|
+
return shared.spawn(x, y, `font-size:${s}px;line-height:1;margin:${-s / 2}px 0 0 ${-s / 2}px;color:${o.colors[i % o.colors.length]}`, ctx, [{ transform: 'translate(0,0) rotate(0) scale(.2)', opacity: 1 }, { transform: `translate(${Math.cos(ang) * d}px,${Math.sin(ang) * d}px) rotate(${shared.rand(180, 360)}deg) scale(1)`, opacity: 0 }], { duration: o.duration, easing: 'cubic-bezier(0.22, 1, 0.36, 1)' }, '★');
|
|
146
147
|
}));
|
|
147
148
|
},
|
|
148
149
|
},
|
|
@@ -161,8 +162,8 @@ const CLICK_FX = [
|
|
|
161
162
|
run: (el, o, ctx) => {
|
|
162
163
|
if (ctx.reduced)
|
|
163
164
|
return;
|
|
164
|
-
const { x, y } =
|
|
165
|
-
return
|
|
165
|
+
const { x, y } = shared.origin(el, ctx);
|
|
166
|
+
return shared.all(Array.from({ length: o.rings }, (_, i) => shared.spawn(x, y, `width:${o.size}px;height:${o.size}px;margin:${-o.size / 2}px 0 0 ${-o.size / 2}px;border:2px solid ${o.color};border-radius:50%`, ctx, [{ transform: 'scale(.1)', opacity: 0.8 }, { transform: 'scale(1)', opacity: 0 }], { duration: o.duration, delay: i * 160, easing: 'ease-out' })));
|
|
166
167
|
},
|
|
167
168
|
},
|
|
168
169
|
{
|
|
@@ -173,11 +174,11 @@ const CLICK_FX = [
|
|
|
173
174
|
run: (el, o, ctx) => {
|
|
174
175
|
if (ctx.reduced)
|
|
175
176
|
return;
|
|
176
|
-
const { x, y } =
|
|
177
|
+
const { x, y } = shared.origin(el, ctx);
|
|
177
178
|
const chars = Array.from(String(o.emoji));
|
|
178
|
-
return
|
|
179
|
-
const dx =
|
|
180
|
-
return
|
|
179
|
+
return shared.all(Array.from({ length: o.count }, (_, i) => {
|
|
180
|
+
const dx = shared.rand(-90, 90);
|
|
181
|
+
return shared.spawn(x, y, `font-size:${shared.rand(16, 28)}px;line-height:1`, ctx, [{ transform: 'translate(0,0) scale(.4)', opacity: 0 }, { transform: `translate(${dx * 0.6}px,${shared.rand(-90, -50)}px) scale(1)`, opacity: 1, offset: 0.35 }, { transform: `translate(${dx}px,${shared.rand(40, 90)}px) rotate(${shared.rand(-60, 60)}deg) scale(.9)`, opacity: 0 }], { duration: o.duration, delay: i * 25, easing: 'cubic-bezier(0.33, 0, 0.67, 1)' }, chars[i % chars.length]);
|
|
181
182
|
}));
|
|
182
183
|
},
|
|
183
184
|
},
|
|
@@ -324,7 +325,7 @@ const PHYSICS_FX = [
|
|
|
324
325
|
el.dataset.usaSplit = '1';
|
|
325
326
|
}
|
|
326
327
|
const hs = bounceKeyframes(o.bounce, 32);
|
|
327
|
-
return
|
|
328
|
+
return shared.all(Array.from(el.children).map((s, i) => ctx.animate(s, hs.map((h) => ({ transform: `translateY(${(-h * o.height).toFixed(1)}px)` })), { duration: o.duration, delay: i * o.stagger, easing: 'linear', fill: 'backwards' })));
|
|
328
329
|
},
|
|
329
330
|
},
|
|
330
331
|
{
|
|
@@ -458,7 +459,7 @@ const PAGE_FX = [
|
|
|
458
459
|
reduced: 'run',
|
|
459
460
|
defaults: TRANSITION_DEFAULTS,
|
|
460
461
|
run: transition((s, o, ctx, el) => {
|
|
461
|
-
const { x, y } =
|
|
462
|
+
const { x, y } = shared.origin(el, ctx);
|
|
462
463
|
const r = Math.hypot(Math.max(x, innerWidth - x), Math.max(y, innerHeight - y)) + 2;
|
|
463
464
|
// a huge box-shadow ring around a hole: the hole shrinks to 0 to cover
|
|
464
465
|
const p = part(s, `left:${x}px;top:${y}px;width:0;height:0;border-radius:50%;box-shadow:0 0 0 ${Math.ceil(r)}px ${o.color}`);
|
|
@@ -968,7 +969,7 @@ const audioFx = (name, description, defaults, spec) => ({
|
|
|
968
969
|
kind: 'background',
|
|
969
970
|
description,
|
|
970
971
|
reduced: 'skip',
|
|
971
|
-
defaults: { colors:
|
|
972
|
+
defaults: { colors: shared.PALETTE, background: '#0b0d12', speed: 1, quality: 1, ...defaults },
|
|
972
973
|
run: (el, o, ctx) => generative.canvasBackground(el, ctx, spec, o),
|
|
973
974
|
});
|
|
974
975
|
const AUDIO_FX = [
|
|
@@ -1114,7 +1115,7 @@ const touchOk = (e, o) => o.touch || e.pointerType !== 'touch';
|
|
|
1114
1115
|
function overlayCanvas(draw) {
|
|
1115
1116
|
const c = document.createElement('canvas');
|
|
1116
1117
|
c.style.cssText = 'position:absolute;inset:0;width:100%;height:100%';
|
|
1117
|
-
|
|
1118
|
+
shared.fxLayer().appendChild(c);
|
|
1118
1119
|
const g = c.getContext('2d');
|
|
1119
1120
|
let raf = 0;
|
|
1120
1121
|
const frame = (now) => {
|
|
@@ -1214,7 +1215,7 @@ const CURSOR_FX = [
|
|
|
1214
1215
|
name: 'sparkle-trail',
|
|
1215
1216
|
kind: 'cursor',
|
|
1216
1217
|
description: 'Little stars twinkle off the pointer as it moves (persistent; `colors`, `spacing` px between stars).',
|
|
1217
|
-
defaults: { colors:
|
|
1218
|
+
defaults: { colors: shared.PALETTE, spacing: 14, size: 14, touch: false },
|
|
1218
1219
|
run: (el, o, ctx) => {
|
|
1219
1220
|
let lx = -1e4;
|
|
1220
1221
|
let ly = -1e4;
|
|
@@ -1223,8 +1224,8 @@ const CURSOR_FX = [
|
|
|
1223
1224
|
return;
|
|
1224
1225
|
lx = e.clientX;
|
|
1225
1226
|
ly = e.clientY;
|
|
1226
|
-
const s = o.size *
|
|
1227
|
-
|
|
1227
|
+
const s = o.size * shared.rand(0.6, 1.2);
|
|
1228
|
+
shared.spawn(e.clientX - s / 2, e.clientY - s / 2, `font-size:${s}px;line-height:1;color:${o.colors[Math.floor(shared.rand(0, o.colors.length))]}`, ctx, [{ transform: 'translate(0,0) scale(0) rotate(0deg)', opacity: 1 }, { transform: `translate(${shared.rand(-14, 14)}px,${shared.rand(4, 26)}px) scale(1) rotate(${shared.rand(-90, 90)}deg)`, opacity: 0 }], { duration: shared.rand(500, 800), easing: 'ease-out' }, '✦');
|
|
1228
1229
|
};
|
|
1229
1230
|
el.addEventListener('pointermove', move, { passive: true });
|
|
1230
1231
|
return () => el.removeEventListener('pointermove', move);
|
|
@@ -1523,11 +1524,11 @@ function bumpCount(el, delta, ctx) {
|
|
|
1523
1524
|
const pop = (el, ctx, s = 1.25, d = 380) => ctx.animate(el, [{ transform: 'scale(1)' }, { transform: `scale(${s})`, offset: 0.4 }, { transform: 'scale(1)' }], { duration: d, easing: 'cubic-bezier(.2,1.4,.4,1)' });
|
|
1524
1525
|
/** A few glyphs flying out of the pointer / centre. */
|
|
1525
1526
|
function burst(el, ctx, glyph, color, n = 6, rise = false) {
|
|
1526
|
-
const { x, y } =
|
|
1527
|
-
return
|
|
1528
|
-
const a = rise ? -Math.PI / 2 +
|
|
1529
|
-
const d =
|
|
1530
|
-
return
|
|
1527
|
+
const { x, y } = shared.origin(el, ctx);
|
|
1528
|
+
return shared.all(Array.from({ length: n }, (_, i) => {
|
|
1529
|
+
const a = rise ? -Math.PI / 2 + shared.rand(-0.6, 0.6) : (i / n) * Math.PI * 2;
|
|
1530
|
+
const d = shared.rand(28, 56);
|
|
1531
|
+
return shared.spawn(x - 7, y - 7, `font-size:14px;line-height:1;color:${color}`, ctx, [{ transform: 'translate(0,0) scale(.4)', opacity: 1 }, { transform: `translate(${Math.cos(a) * d}px,${Math.sin(a) * d}px) scale(1)`, opacity: 0 }], { duration: shared.rand(500, 750), easing: 'cubic-bezier(.2,.8,.3,1)' }, glyph);
|
|
1531
1532
|
}));
|
|
1532
1533
|
}
|
|
1533
1534
|
const click = (name, description, defaults, run) => ({ name, kind: 'click', description, defaults, run });
|
|
@@ -1570,7 +1571,7 @@ const MICRO_FX = [
|
|
|
1570
1571
|
if (el.getAttribute('aria-busy') === 'true')
|
|
1571
1572
|
return;
|
|
1572
1573
|
el.setAttribute('aria-busy', 'true');
|
|
1573
|
-
const [bar, remove] =
|
|
1574
|
+
const [bar, remove] = shared.overlay(el, `background:${o.color}55;transform-origin:left;transform:scaleX(0)`);
|
|
1574
1575
|
const a = ctx.animate(bar, [{ transform: 'scaleX(0)' }, { transform: 'scaleX(1)' }], { duration: o.duration, easing: 'linear', fill: 'forwards' });
|
|
1575
1576
|
const done = a ? a.finished.catch(() => undefined) : Promise.resolve();
|
|
1576
1577
|
return done.then(() => {
|
|
@@ -1596,12 +1597,12 @@ const MICRO_FX = [
|
|
|
1596
1597
|
click('send-plane', 'A paper plane ✈ takes off from the button.', { color: '#22d3ee' }, (el, o, ctx) => {
|
|
1597
1598
|
const r = el.getBoundingClientRect();
|
|
1598
1599
|
pop(el, ctx, 0.92, 200);
|
|
1599
|
-
return
|
|
1600
|
+
return shared.spawn(r.left + r.width / 2 - 8, r.top + r.height / 2 - 8, `font-size:16px;color:${o.color}`, ctx, [{ transform: 'translate(0,0) rotate(0)', opacity: 1 }, { transform: 'translate(40px,-10px) rotate(-10deg)', opacity: 1, offset: 0.4 }, { transform: 'translate(160px,-90px) rotate(-25deg)', opacity: 0 }], { duration: 800, easing: 'ease-in' }, '✈')?.finished;
|
|
1600
1601
|
}),
|
|
1601
1602
|
click('add-to-cart', 'Bumps `[data-count]` by one and floats a "+1" (`text`).', { text: '+1', color: '#34d399' }, (el, o, ctx) => {
|
|
1602
1603
|
bumpCount(el, 1, ctx);
|
|
1603
|
-
const { x, y } =
|
|
1604
|
-
return
|
|
1604
|
+
const { x, y } = shared.origin(el, ctx);
|
|
1605
|
+
return shared.spawn(x - 10, y - 10, `font:700 14px system-ui;color:${o.color}`, ctx, [{ transform: 'translateY(0)', opacity: 1 }, { transform: 'translateY(-40px)', opacity: 0 }], { duration: 700, easing: 'ease-out' }, o.text)?.finished;
|
|
1605
1606
|
}),
|
|
1606
1607
|
click('counter-bump', 'Adds `step` to `[data-count]` with a rolling number.', { step: 1 }, (el, o, ctx) => void bumpCount(el, Number(o.step) || 1, ctx)),
|
|
1607
1608
|
click('upvote', 'Toggles an upvote: the arrow nudges up and `[data-count]` ±1.', {}, (el, _o, ctx) => {
|
|
@@ -1635,7 +1636,7 @@ const MICRO_FX = [
|
|
|
1635
1636
|
}),
|
|
1636
1637
|
attn('error-flash', 'Flashes the element red once (no more than one flash per call).', { color: '#ff5c8a' }, (el, o, ctx) => ctx.animate(el, [{ boxShadow: `0 0 0 0 ${o.color}00` }, { boxShadow: `0 0 0 4px ${o.color}`, offset: 0.3 }, { boxShadow: `0 0 0 0 ${o.color}00` }], { duration: 700 })),
|
|
1637
1638
|
attn('success-check', 'A green ✓ badge pops over the element and fades.', { color: '#34d399' }, (el, o, ctx) => {
|
|
1638
|
-
const [b, remove] =
|
|
1639
|
+
const [b, remove] = shared.overlay(el, `display:grid;place-items:center;font:700 22px system-ui;color:#fff;background:${o.color}d0`);
|
|
1639
1640
|
b.textContent = '✓';
|
|
1640
1641
|
const a = ctx.animate(b, [{ opacity: 0, transform: 'scale(.6)' }, { opacity: 1, transform: 'scale(1)', offset: 0.3 }, { opacity: 1, offset: 0.75 }, { opacity: 0 }], { duration: 1100, easing: 'ease-out' });
|
|
1641
1642
|
return a ? a.finished.then(remove, remove) : void setTimeout(remove, 900);
|
|
@@ -1773,7 +1774,7 @@ const THEME_FX = [
|
|
|
1773
1774
|
description: 'A bright diagonal shine sweeps across frosted glass.',
|
|
1774
1775
|
defaults: { duration: 700 },
|
|
1775
1776
|
run: (el, o, ctx) => {
|
|
1776
|
-
const [s, remove] =
|
|
1777
|
+
const [s, remove] = shared.overlay(el, 'overflow:hidden;background:linear-gradient(105deg,transparent 35%,#ffffff8c 50%,transparent 65%);background-size:250% 100%;background-position:120% 0');
|
|
1777
1778
|
const a = ctx.animate(s, [{ backgroundPosition: '120% 0' }, { backgroundPosition: '-20% 0' }], { duration: o.duration, easing: 'ease-in-out' });
|
|
1778
1779
|
return a ? a.finished.then(remove, remove) : void remove();
|
|
1779
1780
|
},
|
|
@@ -1785,7 +1786,7 @@ const THEME_FX = [
|
|
|
1785
1786
|
reduced: 'run',
|
|
1786
1787
|
defaults: { opacity: 0.18 },
|
|
1787
1788
|
run: (el, o, ctx) => {
|
|
1788
|
-
const [s, remove] =
|
|
1789
|
+
const [s, remove] = shared.overlay(el, `opacity:${o.opacity};background:repeating-linear-gradient(0deg,#000 0 1px,transparent 1px 3px);mix-blend-mode:multiply`);
|
|
1789
1790
|
const a = ctx.reduced ? null : ctx.animate(s, [{ backgroundPosition: '0 0' }, { backgroundPosition: '0 30px' }], { duration: 2400, iterations: Infinity, easing: 'linear' });
|
|
1790
1791
|
return () => {
|
|
1791
1792
|
a?.cancel();
|
|
@@ -2197,9 +2198,9 @@ function registerAllEffects() {
|
|
|
2197
2198
|
registry.registerEffects(defs);
|
|
2198
2199
|
}
|
|
2199
2200
|
|
|
2201
|
+
exports.fxLayer = shared.fxLayer;
|
|
2200
2202
|
exports.GENERATIVE_FX = generative.GENERATIVE_FX;
|
|
2201
2203
|
exports.canvasBackground = generative.canvasBackground;
|
|
2202
|
-
exports.fxLayer = generative.fxLayer;
|
|
2203
2204
|
exports.hexRgb = generative.hexRgb;
|
|
2204
2205
|
exports.noise2 = generative.noise2;
|
|
2205
2206
|
exports.ANIMATION_FORMAT = ANIMATION_FORMAT;
|