@mkbabb/keyframes.js 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -216
- package/dist/animation-BGyzfzBq.js +947 -0
- package/dist/compile-CcSUwM8R.js +276 -0
- package/dist/{waapi-D0ssxKy1.js → delegation-DWwr4IXr.js} +115 -93
- package/dist/{draw-svg-Dat9mHgi.js → draw-svg-GURj9nin.js} +17 -13
- package/dist/easing-registry-DHV2-5gA.js +27 -0
- package/dist/easing-registry-y1p9McFy.js +2 -0
- package/dist/engine/index.d.ts +2873 -0
- package/dist/engine/index.js +17 -0
- package/dist/engine-DEVgCTUy.js +156 -0
- package/dist/engine-DrBtsKaf.js +4 -0
- package/dist/{format-BUgCTjmr.js → format-C-Gi9r7L.js} +4 -4
- package/dist/{scroll-grammar-B4kPvGh5.js → grammar-BLucehC4.js} +1 -1
- package/dist/group-vJcsHKN9.js +360 -0
- package/dist/{ingest-CU-kdYcM.js → ingest-S5hUe20K.js} +62 -56
- package/dist/keyframes.d.ts +475 -942
- package/dist/keyframes.js +196 -137
- package/dist/morph-svg-BToeumw5.js +89 -0
- package/dist/{motion-path-C0OHqcA3.js → motion-path-pQVbamWT.js} +16 -12
- package/dist/parse-flatten-DRMHFytp.js +2 -0
- package/dist/parse-flatten-ZZUSEQEL.js +63 -0
- package/dist/{animations-CZxf0rep.js → presets-BG2Fczzq.js} +124 -73
- package/dist/{scheduler-7eIr_q1g.js → scheduler-CUtVnuoU.js} +1 -1
- package/dist/{scroll-scene-DQxhxn9I.js → scroll-CxpYFO4u.js} +50 -46
- package/dist/sequence-C_DCiOIQ.js +708 -0
- package/dist/validate-DDeGnvSt.js +39 -0
- package/package.json +12 -3
- package/dist/animate-CTWr6K7j.js +0 -26
- package/dist/compile-YRJRdpKF.js +0 -251
- package/dist/decay-BvNmFk51.js +0 -25
- package/dist/engine-DQcb7CLW.js +0 -1349
- package/dist/errors-W8zkvPw4.js +0 -21
- package/dist/morph-svg-83uyYxoW.js +0 -84
- package/dist/rolldown-runtime-Dy4uBu1J.js +0 -11
- package/dist/sequence-cBr7thU8.js +0 -198
- package/dist/springTimingFunction-D26gPkAy.js +0 -63
- package/dist/timeline-vY3eD3Ax.js +0 -430
- package/dist/utils-BPRImVl5.js +0 -100
- package/dist/validate-B1pE-Y_T.js +0 -35
package/dist/errors-W8zkvPw4.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//#region src/animation/internal/errors.ts
|
|
2
|
-
var e = (e) => typeof e == "string" ? JSON.stringify(e) : typeof e == "function" ? `[function ${e.name || "anonymous"}]` : String(e), t = class extends Error {
|
|
3
|
-
option;
|
|
4
|
-
value;
|
|
5
|
-
code;
|
|
6
|
-
constructor(t, n, r, i) {
|
|
7
|
-
super(`Invalid value for animation option "${t}": ${e(n)} — ${r}`), this.name = "AnimationOptionError", this.option = t, this.value = n, i !== void 0 && (this.code = i);
|
|
8
|
-
}
|
|
9
|
-
}, n = class extends Error {
|
|
10
|
-
easingName;
|
|
11
|
-
constructor(t) {
|
|
12
|
-
super(`Unknown easing name ${e(t)} — not a value.js registry entry or cubic-bezier() literal. Pass a callable TimingFunction (or a typed Easing), or resolve the name first via \`await resolveEasing(name)\`.`), this.name = "UnknownEasingError", this.easingName = t;
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
function r(e, n, r, i) {
|
|
16
|
-
let a = r(n);
|
|
17
|
-
if (a === void 0) throw new t(e, n, i);
|
|
18
|
-
return a;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { n, r, t };
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./errors-W8zkvPw4.js";
|
|
2
|
-
import { CSSKeyframesAnimation as t } from "./engine-DQcb7CLW.js";
|
|
3
|
-
import { PathGeometry as n } from "@mkbabb/value.js";
|
|
4
|
-
//#region src/animation/morph-svg.ts
|
|
5
|
-
var r = 64, i = (e) => `--morph-${e}-x`, a = (e) => `--morph-${e}-y`, o = (e) => `--morph-${e}-angle`, s = (e, t, n) => {
|
|
6
|
-
let r = Array(t + 1);
|
|
7
|
-
for (let i = 0; i <= t; i++) if (n) {
|
|
8
|
-
let n = e.sampleAtLength(e.totalLength * (i / t));
|
|
9
|
-
r[i] = {
|
|
10
|
-
x: n.x,
|
|
11
|
-
y: n.y,
|
|
12
|
-
angle: n.angle
|
|
13
|
-
};
|
|
14
|
-
} else r[i] = e.getPointAtT(i / t);
|
|
15
|
-
return r;
|
|
16
|
-
}, c = (e) => Number.isInteger(e) ? `${e}` : e.toFixed(3), l = (e) => {
|
|
17
|
-
if (e.length === 0) return "";
|
|
18
|
-
let t = `M ${c(e[0].x)} ${c(e[0].y)}`;
|
|
19
|
-
for (let n = 1; n < e.length; n++) t += ` L ${c(e[n].x)} ${c(e[n].y)}`;
|
|
20
|
-
return t;
|
|
21
|
-
}, u = (e, t) => {
|
|
22
|
-
let n = Array(t + 1);
|
|
23
|
-
for (let e = 0; e <= t; e++) n[e] = {
|
|
24
|
-
x: 0,
|
|
25
|
-
y: 0
|
|
26
|
-
};
|
|
27
|
-
return (r) => {
|
|
28
|
-
let o = r;
|
|
29
|
-
for (let e = 0; e <= t; e++) {
|
|
30
|
-
let t = n[e];
|
|
31
|
-
t.x = o[i(e)]?.[0]?.value ?? 0, t.y = o[a(e)]?.[0]?.value ?? 0;
|
|
32
|
-
}
|
|
33
|
-
let s = l(n);
|
|
34
|
-
e.style.setProperty("--morph-d", s), e.style.setProperty("d", `path("${s}")`);
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
function d(c, l, d = {}) {
|
|
38
|
-
let { samples: f = r, target: p, orient: m = !1, autoPlay: h = !0, ...g } = d;
|
|
39
|
-
if (typeof c != "string" || c.length === 0) throw new e("from", c, "fromMorphSVG(): `from` must be a non-empty SVG path `d` string.");
|
|
40
|
-
if (typeof l != "string" || l.length === 0) throw new e("to", l, "fromMorphSVG(): `to` must be a non-empty SVG path `d` string.");
|
|
41
|
-
if (!Number.isInteger(f) || f < 2) throw new e("samples", f, "fromMorphSVG(): `samples` must be an integer >= 2 (a 1-sample morph is just the two endpoints, with no body to interpolate).");
|
|
42
|
-
let _ = new n(c), v = new n(l);
|
|
43
|
-
if (_.totalLength === 0) throw new e("from", c, "fromMorphSVG(): the `from` path has zero arc-length — a morph between a zero-length path and anything is malformed input, not an identity animation.");
|
|
44
|
-
if (v.totalLength === 0) throw new e("to", l, "fromMorphSVG(): the `to` path has zero arc-length — a morph between a zero-length path and anything is malformed input, not an identity animation.");
|
|
45
|
-
let y = s(_, f, m), b = s(v, f, m), x = {}, S = {};
|
|
46
|
-
for (let e = 0; e <= f; e++) x[i(e)] = y[e].x, x[a(e)] = y[e].y, S[i(e)] = b[e].x, S[a(e)] = b[e].y, m && (x[o(e)] = y[e].angle ?? 0, S[o(e)] = b[e].angle ?? 0);
|
|
47
|
-
let C = {
|
|
48
|
-
"0%": x,
|
|
49
|
-
"100%": S
|
|
50
|
-
}, w = p == null ? void 0 : u(p, f), T = new t(g).fromKeyframes(C, w);
|
|
51
|
-
return h && T.play(), T;
|
|
52
|
-
}
|
|
53
|
-
var f = class {
|
|
54
|
-
animation;
|
|
55
|
-
samples;
|
|
56
|
-
constructor(e, t, n = {}) {
|
|
57
|
-
this.animation = d(e, t, n), this.samples = n.samples ?? r;
|
|
58
|
-
}
|
|
59
|
-
sampleD(e) {
|
|
60
|
-
let t = (e < 0 ? 0 : e > 1 ? 1 : e) * this.animation.options.duration, n = this.animation.interpFrames(t, !1), r = Array(this.samples + 1);
|
|
61
|
-
for (let e = 0; e <= this.samples; e++) {
|
|
62
|
-
let t = n[i(e)]?.[0]?.value, o = n[a(e)]?.[0]?.value;
|
|
63
|
-
r[e] = {
|
|
64
|
-
x: t ?? 0,
|
|
65
|
-
y: o ?? 0
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
return l(r);
|
|
69
|
-
}
|
|
70
|
-
play() {
|
|
71
|
-
return this.animation.play();
|
|
72
|
-
}
|
|
73
|
-
pause() {
|
|
74
|
-
return this.animation.pause(), this;
|
|
75
|
-
}
|
|
76
|
-
stop() {
|
|
77
|
-
return this.animation.stop(), this;
|
|
78
|
-
}
|
|
79
|
-
get finished() {
|
|
80
|
-
return this.animation.finished;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
//#endregion
|
|
84
|
-
export { f as MorphSVG, d as fromMorphSVG };
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var e = Object.defineProperty, t = (t, n) => {
|
|
3
|
-
let r = {};
|
|
4
|
-
for (var i in t) e(r, i, {
|
|
5
|
-
get: t[i],
|
|
6
|
-
enumerable: !0
|
|
7
|
-
});
|
|
8
|
-
return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
|
|
9
|
-
};
|
|
10
|
-
//#endregion
|
|
11
|
-
export { t };
|
|
@@ -1,198 +0,0 @@
|
|
|
1
|
-
import { f as e, l as t } from "./timeline-vY3eD3Ax.js";
|
|
2
|
-
//#region src/animation/sequence-events.ts
|
|
3
|
-
var n = class {
|
|
4
|
-
subscribers = new Map([
|
|
5
|
-
["segment:enter", /* @__PURE__ */ new Set()],
|
|
6
|
-
["segment:leave", /* @__PURE__ */ new Set()],
|
|
7
|
-
["label", /* @__PURE__ */ new Set()]
|
|
8
|
-
]);
|
|
9
|
-
_activeSegments = /* @__PURE__ */ new Set();
|
|
10
|
-
_prevPhase = void 0;
|
|
11
|
-
subscribe(e, t) {
|
|
12
|
-
let n = this.subscribers.get(e);
|
|
13
|
-
return n.add(t), () => n.delete(t);
|
|
14
|
-
}
|
|
15
|
-
fire(e, t, n) {
|
|
16
|
-
let r = this.subscribers.get("segment:enter"), i = this.subscribers.get("segment:leave"), a = this.subscribers.get("label");
|
|
17
|
-
if (r.size === 0 && i.size === 0 && a.size === 0) {
|
|
18
|
-
this._prevPhase = n;
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
let o = this._prevPhase;
|
|
22
|
-
if (r.size > 0 || i.size > 0) for (let t of e) {
|
|
23
|
-
let e = n >= t.at && n < t.at + t.animation.options.duration, a = this._activeSegments.has(t);
|
|
24
|
-
if (e && !a) {
|
|
25
|
-
this._activeSegments.add(t);
|
|
26
|
-
for (let e of r) e(t.animation, n);
|
|
27
|
-
} else if (!e && a) {
|
|
28
|
-
this._activeSegments.delete(t);
|
|
29
|
-
for (let e of i) e(t.animation, n);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (a.size > 0 && o !== void 0 && o !== n) {
|
|
33
|
-
let e = Math.min(o, n), r = Math.max(o, n);
|
|
34
|
-
for (let [i, o] of t) if (o > e && o <= r) for (let e of a) e(i, n);
|
|
35
|
-
}
|
|
36
|
-
this._prevPhase = n;
|
|
37
|
-
}
|
|
38
|
-
}, r = class {
|
|
39
|
-
entries = [];
|
|
40
|
-
labels = /* @__PURE__ */ new Map();
|
|
41
|
-
_events = new n();
|
|
42
|
-
cursor = 0;
|
|
43
|
-
_time = 0;
|
|
44
|
-
respectReducedMotion;
|
|
45
|
-
playback = new t();
|
|
46
|
-
_boundFrame;
|
|
47
|
-
_resolvePlay = null;
|
|
48
|
-
_playOrigin = void 0;
|
|
49
|
-
_playingPromise = null;
|
|
50
|
-
_rate = 1;
|
|
51
|
-
_repeatCount = 1;
|
|
52
|
-
_yoyoOn = !1;
|
|
53
|
-
_paused = !1;
|
|
54
|
-
_lastClock = void 0;
|
|
55
|
-
constructor(e) {
|
|
56
|
-
this.respectReducedMotion = e?.respectReducedMotion ?? !1, this._boundFrame = this._frame.bind(this);
|
|
57
|
-
}
|
|
58
|
-
get duration() {
|
|
59
|
-
let e = 0;
|
|
60
|
-
for (let t of this.entries) {
|
|
61
|
-
let n = t.at + t.animation.options.duration;
|
|
62
|
-
n > e && (e = n);
|
|
63
|
-
}
|
|
64
|
-
return e;
|
|
65
|
-
}
|
|
66
|
-
get time() {
|
|
67
|
-
return this._time;
|
|
68
|
-
}
|
|
69
|
-
get progress() {
|
|
70
|
-
return this.duration === 0 ? 0 : this._time / this.duration;
|
|
71
|
-
}
|
|
72
|
-
set progress(t) {
|
|
73
|
-
this.seek(e(t, 0, 1) * this.duration);
|
|
74
|
-
}
|
|
75
|
-
get rate() {
|
|
76
|
-
return this._rate;
|
|
77
|
-
}
|
|
78
|
-
label(e, t) {
|
|
79
|
-
return this.labels.set(e, this.resolvePosition(t)), this;
|
|
80
|
-
}
|
|
81
|
-
on(e, t) {
|
|
82
|
-
return this._events.subscribe(e, t);
|
|
83
|
-
}
|
|
84
|
-
add(e, t) {
|
|
85
|
-
let n = this.resolvePosition(t);
|
|
86
|
-
return this.entries.push({
|
|
87
|
-
animation: e,
|
|
88
|
-
at: n
|
|
89
|
-
}), this.entries.sort((e, t) => e.at - t.at), this.cursor = n + e.options.duration, this;
|
|
90
|
-
}
|
|
91
|
-
resolvePosition(e) {
|
|
92
|
-
if (e === void 0) return this.cursor;
|
|
93
|
-
if (typeof e == "number") return e;
|
|
94
|
-
let t = /^([+-])=(\d*\.?\d+)$/.exec(e);
|
|
95
|
-
if (t) {
|
|
96
|
-
let e = t[1] === "+" ? 1 : -1;
|
|
97
|
-
return this.cursor + e * Number.parseFloat(t[2]);
|
|
98
|
-
}
|
|
99
|
-
let n = this.labels.get(e);
|
|
100
|
-
if (n === void 0) throw Error(`Sequence: unknown position "${e}". Register it with .label("${e}", at) first, or pass a number / "+=n" / "-=n".`);
|
|
101
|
-
return n;
|
|
102
|
-
}
|
|
103
|
-
seek(e) {
|
|
104
|
-
return this._time = e, this._fireCrossings(e), this._applyAt(e), this;
|
|
105
|
-
}
|
|
106
|
-
_applyAt(t) {
|
|
107
|
-
for (let { animation: n, at: r } of this.entries) {
|
|
108
|
-
let i = e(t - r, 0, n.options.duration);
|
|
109
|
-
n.interpFrames(i, !0);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
_fireCrossings(e) {
|
|
113
|
-
this._events.fire(this.entries, this.labels, e);
|
|
114
|
-
}
|
|
115
|
-
_fold(t) {
|
|
116
|
-
let n = this.duration;
|
|
117
|
-
if (n <= 0) return 0;
|
|
118
|
-
let r = e(t, 0, n * this._repeatCount), i = Math.floor(r / n), a = r - i * n;
|
|
119
|
-
return a === 0 && i > 0 && (--i, a = n), this._yoyoOn && i % 2 == 1 ? n - a : a;
|
|
120
|
-
}
|
|
121
|
-
setTargets(...e) {
|
|
122
|
-
for (let { animation: t } of this.entries) t.setTargets(...e);
|
|
123
|
-
return this;
|
|
124
|
-
}
|
|
125
|
-
get finished() {
|
|
126
|
-
return this._playingPromise ?? Promise.resolve();
|
|
127
|
-
}
|
|
128
|
-
play() {
|
|
129
|
-
if (this._playingPromise) return this._playingPromise;
|
|
130
|
-
if (this.respectReducedMotion && i()) return this.seek(this.duration), Promise.resolve();
|
|
131
|
-
for (let { animation: e, at: t } of this.entries) e.startTime = t, e.started = !0, e.managed = !0;
|
|
132
|
-
this._time = 0, this._paused = !1, this._playOrigin = void 0, this._lastClock = void 0;
|
|
133
|
-
let e = new Promise((e) => {
|
|
134
|
-
this._resolvePlay = e, this.playback.loop(this._boundFrame);
|
|
135
|
-
});
|
|
136
|
-
return this._playingPromise = e, e.finally(() => {
|
|
137
|
-
this._playingPromise = null;
|
|
138
|
-
}), e;
|
|
139
|
-
}
|
|
140
|
-
async _frame(e) {
|
|
141
|
-
this._playOrigin === void 0 && (this._playOrigin = this._rate === 0 ? e : e - this._time / this._rate), this._lastClock = e;
|
|
142
|
-
let t = (e - this._playOrigin) * this._rate, n = this.duration * this._repeatCount, r = this._rate >= 0 ? t >= n : t <= 0, i = r ? this._rate >= 0 ? this._restPhase() : 0 : this._fold(t);
|
|
143
|
-
if (this._time = i, this._isForwardMonotone()) for (let { animation: e, at: t } of this.entries) i >= t && i - t < e.options.duration && await e.advanceTo(i);
|
|
144
|
-
if (this._fireCrossings(i), this._applyAt(i), r) {
|
|
145
|
-
this._settle();
|
|
146
|
-
let e = this._resolvePlay;
|
|
147
|
-
return this._resolvePlay = null, e?.(), !1;
|
|
148
|
-
}
|
|
149
|
-
return !0;
|
|
150
|
-
}
|
|
151
|
-
_isForwardMonotone() {
|
|
152
|
-
return this._rate === 1 && this._repeatCount === 1 && !this._yoyoOn;
|
|
153
|
-
}
|
|
154
|
-
_restPhase() {
|
|
155
|
-
let e = this.duration;
|
|
156
|
-
return this._yoyoOn && (this._repeatCount - 1) % 2 == 1 ? 0 : e;
|
|
157
|
-
}
|
|
158
|
-
_reanchor() {
|
|
159
|
-
if (!this._playingPromise) return;
|
|
160
|
-
let e = this._lastClock;
|
|
161
|
-
if (e === void 0) {
|
|
162
|
-
this._playOrigin = void 0;
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
this._playOrigin = this._rate === 0 ? e : e - this._time / this._rate;
|
|
166
|
-
}
|
|
167
|
-
_settle() {
|
|
168
|
-
for (let { animation: e } of this.entries) e.managed = !1, e.started = !1, e.startTime = void 0;
|
|
169
|
-
this._playOrigin = void 0, this._lastClock = void 0, this._paused = !1;
|
|
170
|
-
}
|
|
171
|
-
stop() {
|
|
172
|
-
this.playback.stop(), this._settle();
|
|
173
|
-
let e = this._resolvePlay;
|
|
174
|
-
return this._resolvePlay = null, e?.(), this;
|
|
175
|
-
}
|
|
176
|
-
pause() {
|
|
177
|
-
return !this._playingPromise || this._paused ? this : (this._paused = !0, this.playback.stop(), this._playOrigin = void 0, this);
|
|
178
|
-
}
|
|
179
|
-
resume() {
|
|
180
|
-
return !this._playingPromise || !this._paused ? this : (this._paused = !1, this._playOrigin = void 0, this._lastClock = void 0, this.playback.loop(this._boundFrame), this);
|
|
181
|
-
}
|
|
182
|
-
timeScale(e) {
|
|
183
|
-
if (!Number.isFinite(e)) throw Error(`Sequence.timeScale(n): n must be a finite number, got ${e}.`);
|
|
184
|
-
return this._rate = e, this._reanchor(), this;
|
|
185
|
-
}
|
|
186
|
-
reverse() {
|
|
187
|
-
return this._rate = -this._rate, this._reanchor(), this;
|
|
188
|
-
}
|
|
189
|
-
repeat(e) {
|
|
190
|
-
if (e !== Infinity && (!Number.isInteger(e) || e < 1)) throw Error(`Sequence.repeat(count): count must be a positive integer or Infinity, got ${e}.`);
|
|
191
|
-
return this._repeatCount = e, this;
|
|
192
|
-
}
|
|
193
|
-
yoyo(e = !0) {
|
|
194
|
-
return this._yoyoOn = e, this;
|
|
195
|
-
}
|
|
196
|
-
}, i = () => typeof matchMedia == "function" && matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
197
|
-
//#endregion
|
|
198
|
-
export { r as t };
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { a as e } from "./timeline-vY3eD3Ax.js";
|
|
2
|
-
//#region src/animation/internal/binarySearch.ts
|
|
3
|
-
function t(e, t, n, r) {
|
|
4
|
-
let i = 0, a = e.length - 1;
|
|
5
|
-
for (; i <= a;) {
|
|
6
|
-
let o = i + a >> 1, s = e[o];
|
|
7
|
-
if (t < n(s)) a = o - 1;
|
|
8
|
-
else if (t > r(s)) i = o + 1;
|
|
9
|
-
else return o;
|
|
10
|
-
}
|
|
11
|
-
return -1;
|
|
12
|
-
}
|
|
13
|
-
//#endregion
|
|
14
|
-
//#region src/animation/springLinearStops.ts
|
|
15
|
-
function n(t) {
|
|
16
|
-
let n = t.sampleCount ?? 24, r = t.settleThreshold ?? .001, i = t.maxDuration ?? t.response * 4, a = new e({
|
|
17
|
-
response: t.response,
|
|
18
|
-
dampingFraction: t.dampingFraction,
|
|
19
|
-
initial: 0,
|
|
20
|
-
settleThreshold: r,
|
|
21
|
-
velocitySettleThreshold: r
|
|
22
|
-
});
|
|
23
|
-
a.target = 1;
|
|
24
|
-
let o = ["0"], s = i / (n + 1);
|
|
25
|
-
for (let e = 1; e <= n; e++) {
|
|
26
|
-
a._stepSeconds(s);
|
|
27
|
-
let t = e / (n + 1) * 100, r = a.settled ? 1 : a.value;
|
|
28
|
-
o.push(`${r.toFixed(5)} ${t.toFixed(3)}%`);
|
|
29
|
-
}
|
|
30
|
-
return o.push("1"), a.dispose(), `linear(${o.join(", ")})`;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/animation/springTimingFunction.ts
|
|
34
|
-
function r(t) {
|
|
35
|
-
let r = t.sampleCount ?? 64, i = t.settleThreshold ?? .001, a = t.maxDuration ?? t.response * 4, o = new e({
|
|
36
|
-
response: t.response,
|
|
37
|
-
dampingFraction: t.dampingFraction,
|
|
38
|
-
initial: 0,
|
|
39
|
-
settleThreshold: i,
|
|
40
|
-
velocitySettleThreshold: i
|
|
41
|
-
});
|
|
42
|
-
o.target = 1;
|
|
43
|
-
let s = new Float64Array(r + 1);
|
|
44
|
-
s[0] = 0;
|
|
45
|
-
let c = a / r;
|
|
46
|
-
for (let e = 1; e <= r; e++) o._stepSeconds(c), s[e] = o.settled ? 1 : o.value;
|
|
47
|
-
s[r] = 1, o.dispose();
|
|
48
|
-
let l = (e) => {
|
|
49
|
-
if (e <= 0) return 0;
|
|
50
|
-
if (e >= 1) return 1;
|
|
51
|
-
let t = e * r, n = Math.floor(t), i = t - n, a = s[n];
|
|
52
|
-
return a + (s[n + 1] - a) * i;
|
|
53
|
-
}, u = {
|
|
54
|
-
response: t.response,
|
|
55
|
-
dampingFraction: t.dampingFraction
|
|
56
|
-
};
|
|
57
|
-
return t.settleThreshold !== void 0 && (u.settleThreshold = t.settleThreshold), t.maxDuration !== void 0 && (u.maxDuration = t.maxDuration), {
|
|
58
|
-
fn: l,
|
|
59
|
-
css: n(u)
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
//#endregion
|
|
63
|
-
export { n, t as r, r as t };
|