@mkbabb/keyframes.js 4.2.0 → 4.4.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 +151 -1
- package/dist/animate-CuUJt2Tb.js +26 -0
- package/dist/{animations-WlZvjmDT.js → animations-5nf2kBkv.js} +3 -3
- package/dist/compile-DgNRG6Lo.js +251 -0
- package/dist/decay-BvNmFk51.js +25 -0
- package/dist/{draw-svg-Dm9f0vTl.js → draw-svg-DYRDxBlL.js} +1 -1
- package/dist/engine-CNHvTgpw.js +1122 -0
- package/dist/errors-W8zkvPw4.js +21 -0
- package/dist/format-BUgCTjmr.js +123 -0
- package/dist/ingest-CNM5xkQT.js +160 -0
- package/dist/keyframes.d.ts +2417 -666
- package/dist/keyframes.js +226 -244
- package/dist/morph-svg-DRjl9Hfz.js +62 -0
- package/dist/{motion-path-DQ73oD2j.js → motion-path-J-RSNmRQ.js} +1 -1
- package/dist/rolldown-runtime-Dy4uBu1J.js +11 -0
- package/dist/scheduler-7eIr_q1g.js +14 -0
- package/dist/scroll-grammar-B4kPvGh5.js +23 -0
- package/dist/scroll-scene-CXEgM49Q.js +176 -0
- package/dist/sequence-CF5hazqz.js +198 -0
- package/dist/springTimingFunction-CDHZ00JQ.js +63 -0
- package/dist/timeline-B7SV3T_E.js +442 -0
- package/dist/utils-D7nuAND5.js +97 -0
- package/dist/validate-8r6Yo-uc.js +35 -0
- package/dist/waapi-D9MHMm_9.js +179 -0
- package/package.json +49 -8
- package/dist/animate-WjeAtXAe.js +0 -21
- package/dist/engine-Gk4Q7ltr.js +0 -1083
- package/dist/springTimingFunction-DMb11kBe.js +0 -178
- package/dist/timeline-CPT7qUV1.js +0 -282
|
@@ -0,0 +1,11 @@
|
|
|
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 };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { t as e } from "./rolldown-runtime-Dy4uBu1J.js";
|
|
2
|
+
//#region src/animation/internal/scheduler.ts
|
|
3
|
+
var t = /* @__PURE__ */ e({ yieldToMain: () => i }), n = null, r = () => typeof MessageChannel == "function" ? () => new Promise((e) => {
|
|
4
|
+
let t = new MessageChannel();
|
|
5
|
+
t.port1.onmessage = () => {
|
|
6
|
+
t.port1.close(), e();
|
|
7
|
+
}, t.port2.postMessage(void 0);
|
|
8
|
+
}) : () => new Promise((e) => setTimeout(e, 0));
|
|
9
|
+
function i() {
|
|
10
|
+
let e = globalThis.scheduler;
|
|
11
|
+
return e && typeof e.yield == "function" ? e.yield() : (n ??= r(), n());
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { i as n, t };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { extractTimelineOptions as e, parseAnimationRange as t, parseAnimationTimeline as n, parseCSSStylesheet as r, serializeTimelineOptions as i } from "@mkbabb/value.js";
|
|
2
|
+
//#region src/animation/scroll-grammar.ts
|
|
3
|
+
function a(e) {
|
|
4
|
+
return n(e);
|
|
5
|
+
}
|
|
6
|
+
function o(e) {
|
|
7
|
+
return t(e);
|
|
8
|
+
}
|
|
9
|
+
function s(t) {
|
|
10
|
+
return e(typeof t == "string" ? r(t) : t);
|
|
11
|
+
}
|
|
12
|
+
function c(e) {
|
|
13
|
+
return i(e);
|
|
14
|
+
}
|
|
15
|
+
function l(e) {
|
|
16
|
+
let t = s(e);
|
|
17
|
+
return {
|
|
18
|
+
options: t,
|
|
19
|
+
declarations: c(t)
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
export { c as a, l as i, o as n, a as r, s as t };
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
import { a as e, c as t, f as n, i as r } from "./timeline-B7SV3T_E.js";
|
|
2
|
+
import { n as i } from "./decay-BvNmFk51.js";
|
|
3
|
+
import { n as a, t as o } from "./waapi-D9MHMm_9.js";
|
|
4
|
+
import { a as s, i as c, n as l, r as u, t as d } from "./scroll-grammar-B4kPvGh5.js";
|
|
5
|
+
//#region src/animation/scroll-scene.ts
|
|
6
|
+
var f = {
|
|
7
|
+
normal: {
|
|
8
|
+
start: 0,
|
|
9
|
+
end: 1
|
|
10
|
+
},
|
|
11
|
+
cover: {
|
|
12
|
+
start: .25,
|
|
13
|
+
end: .75
|
|
14
|
+
},
|
|
15
|
+
contain: {
|
|
16
|
+
start: .375,
|
|
17
|
+
end: .625
|
|
18
|
+
},
|
|
19
|
+
entry: {
|
|
20
|
+
start: 0,
|
|
21
|
+
end: .25
|
|
22
|
+
},
|
|
23
|
+
exit: {
|
|
24
|
+
start: .75,
|
|
25
|
+
end: 1
|
|
26
|
+
},
|
|
27
|
+
"entry-crossing": {
|
|
28
|
+
start: 0,
|
|
29
|
+
end: .25
|
|
30
|
+
},
|
|
31
|
+
"exit-crossing": {
|
|
32
|
+
start: .75,
|
|
33
|
+
end: 1
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
function p(e) {
|
|
37
|
+
if (e == null) return null;
|
|
38
|
+
let t = e.trim();
|
|
39
|
+
if (t.endsWith("%")) {
|
|
40
|
+
let e = Number.parseFloat(t.slice(0, -1));
|
|
41
|
+
return Number.isFinite(e) ? e / 100 : null;
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
function m(e, t) {
|
|
46
|
+
if (e == null) return t;
|
|
47
|
+
let n = p(e.offset);
|
|
48
|
+
if (n != null) {
|
|
49
|
+
if (e.phase != null && e.phase !== "normal") {
|
|
50
|
+
let t = f[e.phase];
|
|
51
|
+
return t.start + n * (t.end - t.start);
|
|
52
|
+
}
|
|
53
|
+
return n;
|
|
54
|
+
}
|
|
55
|
+
return e.phase == null ? t : f[e.phase].start;
|
|
56
|
+
}
|
|
57
|
+
function h(e) {
|
|
58
|
+
if (e == null) return {
|
|
59
|
+
start: 0,
|
|
60
|
+
end: 1
|
|
61
|
+
};
|
|
62
|
+
let t = m(e.start, 0), n = m(e.end, 1);
|
|
63
|
+
return n > t ? {
|
|
64
|
+
start: t,
|
|
65
|
+
end: n
|
|
66
|
+
} : {
|
|
67
|
+
start: 0,
|
|
68
|
+
end: 1
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
function g(e) {
|
|
72
|
+
let { animation: t, nativeSpec: n, scrub: i, snap: s, velocity: c } = e;
|
|
73
|
+
if (i) return {
|
|
74
|
+
backend: "js",
|
|
75
|
+
reason: "scrub smoothing requested (native scroll has no SmoothProgress smoother)"
|
|
76
|
+
};
|
|
77
|
+
if (s) return {
|
|
78
|
+
backend: "js",
|
|
79
|
+
reason: "physics snap requested (native scroll has no decay/spring settle)"
|
|
80
|
+
};
|
|
81
|
+
if (c) return {
|
|
82
|
+
backend: "js",
|
|
83
|
+
reason: "scroll velocity / non-DOM driving requested (JS-only capability)"
|
|
84
|
+
};
|
|
85
|
+
if (t == null || n == null) return {
|
|
86
|
+
backend: "js",
|
|
87
|
+
reason: "non-DOM target or no native timeline spec (the universal JS driver)"
|
|
88
|
+
};
|
|
89
|
+
let l = a(t);
|
|
90
|
+
if (!l.eligible) return {
|
|
91
|
+
backend: "js",
|
|
92
|
+
reason: l.reason
|
|
93
|
+
};
|
|
94
|
+
if (r(n) == null) return {
|
|
95
|
+
backend: "js",
|
|
96
|
+
reason: "native scroll/view timeline unavailable (feature absent)"
|
|
97
|
+
};
|
|
98
|
+
let u = o(t, n);
|
|
99
|
+
return u.attached ? {
|
|
100
|
+
backend: "native",
|
|
101
|
+
attachment: u
|
|
102
|
+
} : {
|
|
103
|
+
backend: "js",
|
|
104
|
+
reason: u.reason
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function _(e) {
|
|
108
|
+
let t = ["position: sticky;"];
|
|
109
|
+
return e?.bottom == null ? t.push(`top: ${e?.top ?? 0}px;`) : t.push(`bottom: ${e.bottom}px;`), t.join(" ");
|
|
110
|
+
}
|
|
111
|
+
var v = class {
|
|
112
|
+
resolvedRange;
|
|
113
|
+
snapPoints;
|
|
114
|
+
snapSpring;
|
|
115
|
+
scrubSeconds;
|
|
116
|
+
smoother;
|
|
117
|
+
rawScroll = 0;
|
|
118
|
+
localProgress = 0;
|
|
119
|
+
wasInside = !1;
|
|
120
|
+
subscribers = new Map([["enter", /* @__PURE__ */ new Set()], ["leave", /* @__PURE__ */ new Set()]]);
|
|
121
|
+
constructor(r = {}) {
|
|
122
|
+
if (this.resolvedRange = h(r.range), this.scrubSeconds = r.scrub ?? 0, this.snapPoints = r.snap != null && r.snap.length > 0 ? r.snap : void 0, this.scrubSeconds > 0) {
|
|
123
|
+
let e = n(1 / (this.scrubSeconds * 60 + 1), .01, 1);
|
|
124
|
+
this.smoother = new t({
|
|
125
|
+
damping: e,
|
|
126
|
+
clamp: !0,
|
|
127
|
+
...r.smoothing
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
this.snapPoints != null && (this.snapSpring = new e({ ...r.snapSpring }));
|
|
131
|
+
}
|
|
132
|
+
get range() {
|
|
133
|
+
return this.resolvedRange;
|
|
134
|
+
}
|
|
135
|
+
scrollProgress(e) {
|
|
136
|
+
this.rawScroll = n(e, 0, 1);
|
|
137
|
+
let { start: t, end: r } = this.resolvedRange, i = r - t, a = i > 0 ? n((this.rawScroll - t) / i, 0, 1) : 0, o = this.rawScroll >= t && this.rawScroll <= r;
|
|
138
|
+
return o && !this.wasInside && this.fire("enter", a), !o && this.wasInside && this.fire("leave", a), this.wasInside = o, this.smoother ? (this.smoother.setTarget(a), this.localProgress = this.smoother.current) : this.localProgress = a, this.localProgress;
|
|
139
|
+
}
|
|
140
|
+
tick(e) {
|
|
141
|
+
return this.smoother && (this.smoother.tickDt(e), this.localProgress = this.smoother.current), this.localProgress;
|
|
142
|
+
}
|
|
143
|
+
get progress() {
|
|
144
|
+
return this.localProgress;
|
|
145
|
+
}
|
|
146
|
+
get settled() {
|
|
147
|
+
return this.smoother == null || this.smoother.settled;
|
|
148
|
+
}
|
|
149
|
+
snapTo(e = 0) {
|
|
150
|
+
if (this.snapPoints == null || this.snapSpring == null) return null;
|
|
151
|
+
let t = n(i({
|
|
152
|
+
initial: this.localProgress,
|
|
153
|
+
velocity: e
|
|
154
|
+
}), 0, 1), r = this.snapPoints[0], a = Math.abs(t - r);
|
|
155
|
+
for (let e of this.snapPoints) {
|
|
156
|
+
let n = Math.abs(t - e);
|
|
157
|
+
n < a && (a = n, r = e);
|
|
158
|
+
}
|
|
159
|
+
return this.snapSpring.reset(this.localProgress, e), this.snapSpring.target = r, r;
|
|
160
|
+
}
|
|
161
|
+
tickSnap(e) {
|
|
162
|
+
return this.snapSpring && !this.snapSpring.settled && (this.snapSpring.tickDt(e), this.localProgress = this.snapSpring.value), this.localProgress;
|
|
163
|
+
}
|
|
164
|
+
on(e, t) {
|
|
165
|
+
let n = this.subscribers.get(e);
|
|
166
|
+
return n.add(t), () => n.delete(t);
|
|
167
|
+
}
|
|
168
|
+
fire(e, t) {
|
|
169
|
+
for (let n of this.subscribers.get(e)) n(t);
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
function y(e = {}) {
|
|
173
|
+
return new v(e);
|
|
174
|
+
}
|
|
175
|
+
//#endregion
|
|
176
|
+
export { v as ScrollScene, y as createScrollScene, g as dispatchScrollBackend, d as parseScrollCSS, l as parseScrollRange, u as parseScrollTimeline, _ as pinCSS, h as resolveRange, c as roundTripScrollCSS, s as serializeScrollOptions };
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { f as e, l as t } from "./timeline-B7SV3T_E.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 };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { a as e } from "./timeline-B7SV3T_E.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 };
|