@plastic-js/tsumiki 0.1.21 → 0.1.22
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/components/DatePickerMobile/wheel.js +28 -14
- package/dist/components/DatePickerMobile/wheel.js.map +1 -1
- package/dist/node_modules/framesync/dist/es/create-render-step.js +54 -0
- package/dist/node_modules/framesync/dist/es/create-render-step.js.map +1 -0
- package/dist/node_modules/framesync/dist/es/index.js +61 -0
- package/dist/node_modules/framesync/dist/es/index.js.map +1 -0
- package/dist/node_modules/framesync/dist/es/on-next-frame.js +8 -0
- package/dist/node_modules/framesync/dist/es/on-next-frame.js.map +1 -0
- package/dist/node_modules/hey-listen/dist/hey-listen.es.js +15 -0
- package/dist/node_modules/hey-listen/dist/hey-listen.es.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/animations/generators/decay.js +24 -0
- package/dist/node_modules/popmotion/dist/es/animations/generators/decay.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/animations/generators/keyframes.js +40 -0
- package/dist/node_modules/popmotion/dist/es/animations/generators/keyframes.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/animations/generators/spring.js +96 -0
- package/dist/node_modules/popmotion/dist/es/animations/generators/spring.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/animations/index.js +94 -0
- package/dist/node_modules/popmotion/dist/es/animations/index.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/animations/inertia.js +74 -0
- package/dist/node_modules/popmotion/dist/es/animations/inertia.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.js +21 -0
- package/dist/node_modules/popmotion/dist/es/animations/utils/detect-animation-from-options.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/animations/utils/elapsed.js +14 -0
- package/dist/node_modules/popmotion/dist/es/animations/utils/elapsed.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/animations/utils/find-spring.js +68 -0
- package/dist/node_modules/popmotion/dist/es/animations/utils/find-spring.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/easing/index.js +28 -0
- package/dist/node_modules/popmotion/dist/es/easing/index.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/easing/utils.js +13 -0
- package/dist/node_modules/popmotion/dist/es/easing/utils.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/clamp.js +6 -0
- package/dist/node_modules/popmotion/dist/es/utils/clamp.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/hsla-to-rgba.js +35 -0
- package/dist/node_modules/popmotion/dist/es/utils/hsla-to-rgba.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/inc.js +6 -0
- package/dist/node_modules/popmotion/dist/es/utils/inc.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/interpolate.js +69 -0
- package/dist/node_modules/popmotion/dist/es/utils/interpolate.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/mix-color.js +45 -0
- package/dist/node_modules/popmotion/dist/es/utils/mix-color.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/mix-complex.js +61 -0
- package/dist/node_modules/popmotion/dist/es/utils/mix-complex.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/mix.js +6 -0
- package/dist/node_modules/popmotion/dist/es/utils/mix.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/pipe.js +7 -0
- package/dist/node_modules/popmotion/dist/es/utils/pipe.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/progress.js +9 -0
- package/dist/node_modules/popmotion/dist/es/utils/progress.js.map +1 -0
- package/dist/node_modules/popmotion/dist/es/utils/velocity-per-second.js +8 -0
- package/dist/node_modules/popmotion/dist/es/utils/velocity-per-second.js.map +1 -0
- package/dist/node_modules/popmotion/node_modules/tslib/tslib.es6.js +13 -0
- package/dist/node_modules/popmotion/node_modules/tslib/tslib.es6.js.map +1 -0
- package/dist/node_modules/style-value-types/dist/es/color/hex.js +39 -0
- package/dist/node_modules/style-value-types/dist/es/color/hex.js.map +1 -0
- package/dist/node_modules/style-value-types/dist/es/color/hsla.js +16 -0
- package/dist/node_modules/style-value-types/dist/es/color/hsla.js.map +1 -0
- package/dist/node_modules/style-value-types/dist/es/color/index.js +20 -0
- package/dist/node_modules/style-value-types/dist/es/color/index.js.map +1 -0
- package/dist/node_modules/style-value-types/dist/es/color/rgba.js +15 -0
- package/dist/node_modules/style-value-types/dist/es/color/rgba.js.map +1 -0
- package/dist/node_modules/style-value-types/dist/es/color/utils.js +19 -0
- package/dist/node_modules/style-value-types/dist/es/color/utils.js.map +1 -0
- package/dist/node_modules/style-value-types/dist/es/complex/index.js +58 -0
- package/dist/node_modules/style-value-types/dist/es/complex/index.js.map +1 -0
- package/dist/node_modules/style-value-types/dist/es/numbers/index.js +13 -0
- package/dist/node_modules/style-value-types/dist/es/numbers/index.js.map +1 -0
- package/dist/node_modules/style-value-types/dist/es/numbers/units.js +16 -0
- package/dist/node_modules/style-value-types/dist/es/numbers/units.js.map +1 -0
- package/dist/node_modules/style-value-types/dist/es/utils.js +13 -0
- package/dist/node_modules/style-value-types/dist/es/utils.js.map +1 -0
- package/package.json +4 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { inertia } from "../../node_modules/popmotion/dist/es/animations/inertia.js";
|
|
1
2
|
function expandCircular(items, index) {
|
|
2
3
|
const len = items.length;
|
|
3
4
|
if (len === 0) return [items, index];
|
|
@@ -16,7 +17,7 @@ function makeWheel(displayItems, displayIndex, circular) {
|
|
|
16
17
|
const baseLen = circular ? Math.round(displayItems.length / 3) : displayItems.length;
|
|
17
18
|
let translateY = circular ? 72 - displayIndex * 36 : clampOffset(72 - displayIndex * 36, displayItems.length);
|
|
18
19
|
let drag = null;
|
|
19
|
-
let
|
|
20
|
+
let animPlayback = null;
|
|
20
21
|
function clampOrPass(v) {
|
|
21
22
|
if (!circular) return clampOffset(v, displayItems.length);
|
|
22
23
|
const maxV = 108;
|
|
@@ -44,13 +45,13 @@ function makeWheel(displayItems, displayIndex, circular) {
|
|
|
44
45
|
el.style.transform = `translateY(${translateY}px)`;
|
|
45
46
|
},
|
|
46
47
|
destroy() {
|
|
47
|
-
|
|
48
|
-
|
|
48
|
+
if (animPlayback) animPlayback.stop();
|
|
49
|
+
animPlayback = null;
|
|
49
50
|
drag = null;
|
|
50
51
|
},
|
|
51
52
|
handlePointerDown(e) {
|
|
52
53
|
e.preventDefault();
|
|
53
|
-
|
|
54
|
+
if (animPlayback) animPlayback.stop();
|
|
54
55
|
drag = {
|
|
55
56
|
startY: e.clientY,
|
|
56
57
|
startTranslate: translateY,
|
|
@@ -74,24 +75,37 @@ function makeWheel(displayItems, displayIndex, circular) {
|
|
|
74
75
|
},
|
|
75
76
|
handlePointerUp(e, el, onChange) {
|
|
76
77
|
if (!drag) return;
|
|
77
|
-
const
|
|
78
|
+
const initialVelocity = drag.velocity * 1e3;
|
|
78
79
|
drag = null;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
animPlayback = inertia({
|
|
81
|
+
from: translateY,
|
|
82
|
+
velocity: initialVelocity,
|
|
83
|
+
min: circular ? void 0 : 72 - (displayItems.length - 1) * 36,
|
|
84
|
+
max: circular ? void 0 : 72,
|
|
85
|
+
bounceStiffness: 250,
|
|
86
|
+
bounceDamping: 25,
|
|
87
|
+
power: .8,
|
|
88
|
+
timeConstant: 350,
|
|
89
|
+
restDelta: .5,
|
|
90
|
+
modifyTarget: (target) => {
|
|
91
|
+
return nearestCopyOffset(resolveIndex(target), target);
|
|
92
|
+
},
|
|
93
|
+
onUpdate: (v) => {
|
|
94
|
+
translateY = v;
|
|
95
|
+
el.style.transform = `translateY(${v}px)`;
|
|
96
|
+
},
|
|
97
|
+
onComplete: () => {
|
|
98
|
+
onChange(resolveIndex(translateY));
|
|
99
|
+
}
|
|
100
|
+
});
|
|
87
101
|
},
|
|
88
102
|
handlePointerCancel(e, el) {
|
|
89
103
|
if (!drag) return;
|
|
104
|
+
drag = null;
|
|
90
105
|
const target = nearestCopyOffset(resolveIndex(translateY), translateY);
|
|
91
106
|
translateY = target;
|
|
92
107
|
el.style.transition = "transform 180ms cubic-bezier(0.32, 0.72, 0, 1)";
|
|
93
108
|
el.style.transform = `translateY(${target}px)`;
|
|
94
|
-
drag = null;
|
|
95
109
|
}
|
|
96
110
|
};
|
|
97
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wheel.js","names":[],"sources":["../../../src/components/DatePickerMobile/wheel.js"],"sourcesContent":["
|
|
1
|
+
{"version":3,"file":"wheel.js","names":[],"sources":["../../../src/components/DatePickerMobile/wheel.js"],"sourcesContent":["import { inertia } from 'popmotion'\n\nexport const ITEM_HEIGHT = 36\nexport const VISIBLE_ITEMS = 5\nexport const CONTAINER_HEIGHT = ITEM_HEIGHT * VISIBLE_ITEMS\nexport const CENTER_OFFSET = (CONTAINER_HEIGHT - ITEM_HEIGHT) / 2\n\nexport function expandCircular(items, index) {\n\tconst len = items.length\n\tif (len === 0) return [items, index]\n\treturn [[...items, ...items, ...items], len + index]\n}\n\nexport function clampOffset(offset, itemCount) {\n\tconst max = CENTER_OFFSET\n\tconst min = CENTER_OFFSET - Math.max(0, itemCount - 1) * ITEM_HEIGHT\n\treturn Math.max(min, Math.min(max, offset))\n}\n\nexport function makeWheel(displayItems, displayIndex, circular) {\n\tconst baseLen = circular ? Math.round(displayItems.length / 3) : displayItems.length\n\n\tlet translateY = circular\n\t\t? CENTER_OFFSET - displayIndex * ITEM_HEIGHT\n\t\t: clampOffset(CENTER_OFFSET - displayIndex * ITEM_HEIGHT, displayItems.length)\n\n\tlet drag = null\n\tlet animPlayback = null\n\n\tfunction clampOrPass(v) {\n\t\tif (!circular) return clampOffset(v, displayItems.length)\n\t\tconst maxV = CENTER_OFFSET + ITEM_HEIGHT\n\t\tconst minV = CENTER_OFFSET - (2 * baseLen + 1) * ITEM_HEIGHT\n\t\tif (v > maxV) return maxV + (v - maxV) * 0.15\n\t\tif (v < minV) return minV + (v - minV) * 0.15\n\t\treturn v\n\t}\n\n\tfunction resolveIndex(offset) {\n\t\tconst raw = Math.round((CENTER_OFFSET - offset) / ITEM_HEIGHT)\n\t\tif (circular) return ((raw % baseLen) + baseLen) % baseLen\n\t\treturn Math.max(0, Math.min(displayItems.length - 1, raw))\n\t}\n\n\tfunction nearestCopyOffset(idx, currentOffset) {\n\t\tif (!circular) return CENTER_OFFSET - idx * ITEM_HEIGHT\n\t\tconst copies = [0, 1, 2]\n\t\t\t.map((c) => CENTER_OFFSET - (c * baseLen + idx) * ITEM_HEIGHT)\n\t\treturn copies.reduce((a, b) =>\n\t\t\tMath.abs(a - currentOffset) < Math.abs(b - currentOffset) ? a : b,\n\t\t)\n\t}\n\n\treturn {\n\t\tmount(el) {\n\t\t\tel.style.transition = 'none'\n\t\t\tel.style.transform = `translateY(${translateY}px)`\n\t\t},\n\n\t\tdestroy() {\n\t\t\tif (animPlayback) animPlayback.stop()\n\t\t\tanimPlayback = null\n\t\t\tdrag = null\n\t\t},\n\n\t\thandlePointerDown(e) {\n\t\t\te.preventDefault()\n\t\t\tif (animPlayback) animPlayback.stop()\n\n\t\t\tdrag = {\n\t\t\t\tstartY: e.clientY,\n\t\t\t\tstartTranslate: translateY,\n\t\t\t\tlastY: e.clientY,\n\t\t\t\tlastTime: performance.now(),\n\t\t\t\tvelocity: 0,\n\t\t\t}\n\t\t},\n\n\t\thandlePointerMove(e, el) {\n\t\t\tif (!drag) return\n\t\t\tconst dy = e.clientY - drag.startY\n\t\t\tconst now = performance.now()\n\t\t\tconst dt = now - drag.lastTime\n\n\t\t\tif (dt > 0) {\n\t\t\t\tdrag.velocity = (e.clientY - drag.lastY) / dt\n\t\t\t}\n\t\t\tdrag.lastY = e.clientY\n\t\t\tdrag.lastTime = now\n\n\t\t\tconst offset = clampOrPass(drag.startTranslate + dy)\n\t\t\ttranslateY = offset\n\t\t\tel.style.transition = 'none'\n\t\t\tel.style.transform = `translateY(${offset}px)`\n\t\t},\n\n\t\thandlePointerUp(e, el, onChange) {\n\t\t\tif (!drag) return\n\n\t\t\tconst initialVelocity = drag.velocity * 1000\n\t\t\tdrag = null\n\n\t\t\tanimPlayback = inertia({\n\t\t\t\tfrom: translateY,\n\t\t\t\tvelocity: initialVelocity,\n\t\t\t\tmin: circular ? undefined : CENTER_OFFSET - (displayItems.length - 1) * ITEM_HEIGHT,\n\t\t\t\tmax: circular ? undefined : CENTER_OFFSET,\n\t\t\t\tbounceStiffness: 250,\n\t\t\t\tbounceDamping: 25,\n\t\t\t\tpower: 0.8,\n\t\t\t\ttimeConstant: 350,\n\t\t\t\trestDelta: 0.5,\n\t\t\t\tmodifyTarget: (target) => {\n\t\t\t\t\tconst idx = resolveIndex(target)\n\t\t\t\t\treturn nearestCopyOffset(idx, target)\n\t\t\t\t},\n\t\t\t\tonUpdate: (v) => {\n\t\t\t\t\ttranslateY = v\n\t\t\t\t\tel.style.transform = `translateY(${v}px)`\n\t\t\t\t},\n\t\t\t\tonComplete: () => {\n\t\t\t\t\tconst idx = resolveIndex(translateY)\n\t\t\t\t\tonChange(idx)\n\t\t\t\t},\n\t\t\t})\n\t\t},\n\n\t\thandlePointerCancel(e, el) {\n\t\t\tif (!drag) return\n\t\t\tdrag = null\n\t\t\tconst idx = resolveIndex(translateY)\n\t\t\tconst target = nearestCopyOffset(idx, translateY)\n\t\t\ttranslateY = target\n\t\t\tel.style.transition = 'transform 180ms cubic-bezier(0.32, 0.72, 0, 1)'\n\t\t\tel.style.transform = `translateY(${target}px)`\n\t\t},\n\t}\n}\n"],"mappings":";AAOA,SAAgB,eAAe,OAAO,OAAO;CAC5C,MAAM,MAAM,MAAM;CAClB,IAAI,QAAQ,GAAG,OAAO,CAAC,OAAO,KAAK;CACnC,OAAO,CAAC;EAAC,GAAG;EAAO,GAAG;EAAO,GAAG;CAAK,GAAG,MAAM,KAAK;AACpD;AAEA,SAAgB,YA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AG,MAAM,YAAY,cAAc,OAAO;EAC3C;CACD;AACD"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region node_modules/framesync/dist/es/create-render-step.mjs
|
|
2
|
+
function createRenderStep(runNextFrame) {
|
|
3
|
+
let toRun = [];
|
|
4
|
+
let toRunNextFrame = [];
|
|
5
|
+
let numToRun = 0;
|
|
6
|
+
let isProcessing = false;
|
|
7
|
+
let flushNextFrame = false;
|
|
8
|
+
const toKeepAlive = /* @__PURE__ */ new WeakSet();
|
|
9
|
+
const step = {
|
|
10
|
+
schedule: (callback, keepAlive = false, immediate = false) => {
|
|
11
|
+
const addToCurrentFrame = immediate && isProcessing;
|
|
12
|
+
const buffer = addToCurrentFrame ? toRun : toRunNextFrame;
|
|
13
|
+
if (keepAlive) toKeepAlive.add(callback);
|
|
14
|
+
if (buffer.indexOf(callback) === -1) {
|
|
15
|
+
buffer.push(callback);
|
|
16
|
+
if (addToCurrentFrame && isProcessing) numToRun = toRun.length;
|
|
17
|
+
}
|
|
18
|
+
return callback;
|
|
19
|
+
},
|
|
20
|
+
cancel: (callback) => {
|
|
21
|
+
const index = toRunNextFrame.indexOf(callback);
|
|
22
|
+
if (index !== -1) toRunNextFrame.splice(index, 1);
|
|
23
|
+
toKeepAlive.delete(callback);
|
|
24
|
+
},
|
|
25
|
+
process: (frameData) => {
|
|
26
|
+
if (isProcessing) {
|
|
27
|
+
flushNextFrame = true;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
isProcessing = true;
|
|
31
|
+
[toRun, toRunNextFrame] = [toRunNextFrame, toRun];
|
|
32
|
+
toRunNextFrame.length = 0;
|
|
33
|
+
numToRun = toRun.length;
|
|
34
|
+
if (numToRun) for (let i = 0; i < numToRun; i++) {
|
|
35
|
+
const callback = toRun[i];
|
|
36
|
+
callback(frameData);
|
|
37
|
+
if (toKeepAlive.has(callback)) {
|
|
38
|
+
step.schedule(callback);
|
|
39
|
+
runNextFrame();
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
isProcessing = false;
|
|
43
|
+
if (flushNextFrame) {
|
|
44
|
+
flushNextFrame = false;
|
|
45
|
+
step.process(frameData);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
return step;
|
|
50
|
+
}
|
|
51
|
+
//#endregion
|
|
52
|
+
export { createRenderStep };
|
|
53
|
+
|
|
54
|
+
//# sourceMappingURL=create-render-step.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-render-step.js","names":[],"sources":["../../../../../node_modules/framesync/dist/es/create-render-step.mjs"],"sourcesContent":["function createRenderStep(runNextFrame) {\n let toRun = [];\n let toRunNextFrame = [];\n let numToRun = 0;\n let isProcessing = false;\n let flushNextFrame = false;\n const toKeepAlive = new WeakSet();\n const step = {\n schedule: (callback, keepAlive = false, immediate = false) => {\n const addToCurrentFrame = immediate && isProcessing;\n const buffer = addToCurrentFrame ? toRun : toRunNextFrame;\n if (keepAlive)\n toKeepAlive.add(callback);\n if (buffer.indexOf(callback) === -1) {\n buffer.push(callback);\n if (addToCurrentFrame && isProcessing)\n numToRun = toRun.length;\n }\n return callback;\n },\n cancel: (callback) => {\n const index = toRunNextFrame.indexOf(callback);\n if (index !== -1)\n toRunNextFrame.splice(index, 1);\n toKeepAlive.delete(callback);\n },\n process: (frameData) => {\n if (isProcessing) {\n flushNextFrame = true;\n return;\n }\n isProcessing = true;\n [toRun, toRunNextFrame] = [toRunNextFrame, toRun];\n toRunNextFrame.length = 0;\n numToRun = toRun.length;\n if (numToRun) {\n for (let i = 0; i < numToRun; i++) {\n const callback = toRun[i];\n callback(frameData);\n if (toKeepAlive.has(callback)) {\n step.schedule(callback);\n runNextFrame();\n }\n }\n }\n isProcessing = false;\n if (flushNextFrame) {\n flushNextFrame = false;\n step.process(frameData);\n }\n },\n };\n return step;\n}\n\nexport { createRenderStep };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAS,iBAAiB,cAAc;CACpC,IAAI,QAAQ,CAAC;CACb,IAAI,iBAAiB,CAAC;CACtB,IAAI,WAAW;CACf,IAAI,eAAe;CACnB,IAAI,iBAAiB;CACrB,MAAM,8BAAc,IAAI,QAAQ;CAChC,MAAM,OAAO;EACT,WAAW,UAAU,YAAY,OAAO,YAAY,UAAU;GAC1D,MAAM,oBAAoB,aAAa;GACvC,MAAM,SAAS,oBAAoB,QAAQ;GAC3C,IAAI,WACA,YAAY,IAAI,QAAQ;GAC5B,IAAI,OAAO,QAAQ,QAAQ,MAAM,IAAI;IACjC,OAAO,KAAK,QAAQ;IACpB,IAAI,qBAAqB,cACrB,WAAW,MAAM;GACzB;GACA,OAAO;EACX;EACA,SAAS,aAAa;GAClB,MAAM,QAAQ,eAAe,QAAQ,QAAQ;GAC7C,IAAI,UAAU,IACV,eAAe,OAAO,OAAO,CAAC;GAClC,YAAY,OAAO,QAAQ;EAC/B;EACA,UAAU,cAAc;GACpB,IAAI,cAAc;IACd,iBAAiB;IACjB;GACJ;GACA,eAAe;GACf,CAAC,OAAO,kBAAkB,CAAC,gBAAgB,KAAK;GAChD,eAAe,SAAS;GACxB,WAAW,MAAM;GACjB,IAAI,UACA,KAAK,IAAI,IAAI,GAAG,IAAI,UAAU,KAAK;IAC/B,MAAM,WAAW,MAAM;IACvB,SAAS,SAAS;IAClB,IAAI,YAAY,IAAI,QAAQ,GAAG;KAC3B,KAAK,SAAS,QAAQ;KACtB,aAAa;IACjB;GACJ;GAEJ,eAAe;GACf,IAAI,gBAAgB;IAChB,iBAAiB;IACjB,KAAK,QAAQ,SAAS;GAC1B;EACJ;CACJ;CACA,OAAO;AACX"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { defaultTimestep, onNextFrame } from "./on-next-frame.js";
|
|
2
|
+
import { createRenderStep } from "./create-render-step.js";
|
|
3
|
+
//#region node_modules/framesync/dist/es/index.mjs
|
|
4
|
+
var maxElapsed = 40;
|
|
5
|
+
var useDefaultElapsed = true;
|
|
6
|
+
var runNextFrame = false;
|
|
7
|
+
var isProcessing = false;
|
|
8
|
+
var frame = {
|
|
9
|
+
delta: 0,
|
|
10
|
+
timestamp: 0
|
|
11
|
+
};
|
|
12
|
+
var stepsOrder = [
|
|
13
|
+
"read",
|
|
14
|
+
"update",
|
|
15
|
+
"preRender",
|
|
16
|
+
"render",
|
|
17
|
+
"postRender"
|
|
18
|
+
];
|
|
19
|
+
var steps = stepsOrder.reduce((acc, key) => {
|
|
20
|
+
acc[key] = createRenderStep(() => runNextFrame = true);
|
|
21
|
+
return acc;
|
|
22
|
+
}, {});
|
|
23
|
+
var sync = stepsOrder.reduce((acc, key) => {
|
|
24
|
+
const step = steps[key];
|
|
25
|
+
acc[key] = (process, keepAlive = false, immediate = false) => {
|
|
26
|
+
if (!runNextFrame) startLoop();
|
|
27
|
+
return step.schedule(process, keepAlive, immediate);
|
|
28
|
+
};
|
|
29
|
+
return acc;
|
|
30
|
+
}, {});
|
|
31
|
+
var cancelSync = stepsOrder.reduce((acc, key) => {
|
|
32
|
+
acc[key] = steps[key].cancel;
|
|
33
|
+
return acc;
|
|
34
|
+
}, {});
|
|
35
|
+
stepsOrder.reduce((acc, key) => {
|
|
36
|
+
acc[key] = () => steps[key].process(frame);
|
|
37
|
+
return acc;
|
|
38
|
+
}, {});
|
|
39
|
+
var processStep = (stepId) => steps[stepId].process(frame);
|
|
40
|
+
var processFrame = (timestamp) => {
|
|
41
|
+
runNextFrame = false;
|
|
42
|
+
frame.delta = useDefaultElapsed ? defaultTimestep : Math.max(Math.min(timestamp - frame.timestamp, maxElapsed), 1);
|
|
43
|
+
frame.timestamp = timestamp;
|
|
44
|
+
isProcessing = true;
|
|
45
|
+
stepsOrder.forEach(processStep);
|
|
46
|
+
isProcessing = false;
|
|
47
|
+
if (runNextFrame) {
|
|
48
|
+
useDefaultElapsed = false;
|
|
49
|
+
onNextFrame(processFrame);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var startLoop = () => {
|
|
53
|
+
runNextFrame = true;
|
|
54
|
+
useDefaultElapsed = true;
|
|
55
|
+
if (!isProcessing) onNextFrame(processFrame);
|
|
56
|
+
};
|
|
57
|
+
var getFrameData = () => frame;
|
|
58
|
+
//#endregion
|
|
59
|
+
export { cancelSync, sync as default, getFrameData };
|
|
60
|
+
|
|
61
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../node_modules/framesync/dist/es/index.mjs"],"sourcesContent":["import { onNextFrame, defaultTimestep } from './on-next-frame.mjs';\nimport { createRenderStep } from './create-render-step.mjs';\n\nconst maxElapsed = 40;\nlet useDefaultElapsed = true;\nlet runNextFrame = false;\nlet isProcessing = false;\nconst frame = {\n delta: 0,\n timestamp: 0,\n};\nconst stepsOrder = [\n \"read\",\n \"update\",\n \"preRender\",\n \"render\",\n \"postRender\",\n];\nconst steps = stepsOrder.reduce((acc, key) => {\n acc[key] = createRenderStep(() => (runNextFrame = true));\n return acc;\n}, {});\nconst sync = stepsOrder.reduce((acc, key) => {\n const step = steps[key];\n acc[key] = (process, keepAlive = false, immediate = false) => {\n if (!runNextFrame)\n startLoop();\n return step.schedule(process, keepAlive, immediate);\n };\n return acc;\n}, {});\nconst cancelSync = stepsOrder.reduce((acc, key) => {\n acc[key] = steps[key].cancel;\n return acc;\n}, {});\nconst flushSync = stepsOrder.reduce((acc, key) => {\n acc[key] = () => steps[key].process(frame);\n return acc;\n}, {});\nconst processStep = (stepId) => steps[stepId].process(frame);\nconst processFrame = (timestamp) => {\n runNextFrame = false;\n frame.delta = useDefaultElapsed\n ? defaultTimestep\n : Math.max(Math.min(timestamp - frame.timestamp, maxElapsed), 1);\n frame.timestamp = timestamp;\n isProcessing = true;\n stepsOrder.forEach(processStep);\n isProcessing = false;\n if (runNextFrame) {\n useDefaultElapsed = false;\n onNextFrame(processFrame);\n }\n};\nconst startLoop = () => {\n runNextFrame = true;\n useDefaultElapsed = true;\n if (!isProcessing)\n onNextFrame(processFrame);\n};\nconst getFrameData = () => frame;\n\nexport default sync;\nexport { cancelSync, flushSync, getFrameData };\n"],"x_google_ignoreList":[0],"mappings":";;;AAGA,IAAM,aAAa;AACnB,IAAI,oBAAoB;AACxB,IAAI,eAAe;AACnB,IAAI,eAAe;AACnB,IAAM,QAAQ;CACV,OAAO;CACP,WAAW;AACf;AACA,IAAM,aAAa;CACf;CACA;CACA;CACA;CACA;AACJ;AACA,IAAM,QAAQ,WAAW,QAAQ,KAAK,QAAQ;CAC1C,IAAI,OAAO,uBAAwB,eAAe,IAAK;CACvD,OAAO;AACX,GAAG,CAAC,CAAC;AACL,IAAM,OAAO,WAAW,QAAQ,KAAK,QAAQ;CACzC,MAAM,OAAO,MAAM;CACnB,IAAI,QAAQ,SAAS,YAAY,OAAO,YAAY,UAAU;EAC1D,IAAI,CAAC,cACD,UAAU;EACd,OAAO,KAAK,SAAS,SAAS,WAAW,SAAS;CACtD;CACA,OAAO;AACX,GAAG,CAAC,CAAC;AACL,IAAM,aAAa,WAAW,QAAQ,KAAK,QAAQ;CAC/C,IAAI,OAAO,MAAM,KAAK;CACtB,OAAO;AACX,GAAG,CAAC,CAAC;AACa,WAAW,QAAQ,KAAK,QAAQ;CAC9C,IAAI,aAAa,MAAM,KAAK,QAAQ,KAAK;CACzC,OAAO;AACX,GAAG,CAAC,CAAC;AACL,IAAM,eAAe,WAAW,MAAM,QAAQ,QAAQ,KAAK;AAC3D,IAAM,gBAAgB,cAAc;CAChC,eAAe;CACf,MAAM,QAAQ,oBACR,kBACA,KAAK,IAAI,KAAK,IAAI,YAAY,MAAM,WAAW,UAAU,GAAG,CAAC;CACnE,MAAM,YAAY;CAClB,eAAe;CACf,WAAW,QAAQ,WAAW;CAC9B,eAAe;CACf,IAAI,cAAc;EACd,oBAAoB;EACpB,YAAY,YAAY;CAC5B;AACJ;AACA,IAAM,kBAAkB;CACpB,eAAe;CACf,oBAAoB;CACpB,IAAI,CAAC,cACD,YAAY,YAAY;AAChC;AACA,IAAM,qBAAqB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
//#region node_modules/framesync/dist/es/on-next-frame.mjs
|
|
2
|
+
var defaultTimestep = 1 / 60 * 1e3;
|
|
3
|
+
var getCurrentTime = typeof performance !== "undefined" ? () => performance.now() : () => Date.now();
|
|
4
|
+
var onNextFrame = typeof window !== "undefined" ? (callback) => window.requestAnimationFrame(callback) : (callback) => setTimeout(() => callback(getCurrentTime()), defaultTimestep);
|
|
5
|
+
//#endregion
|
|
6
|
+
export { defaultTimestep, onNextFrame };
|
|
7
|
+
|
|
8
|
+
//# sourceMappingURL=on-next-frame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"on-next-frame.js","names":[],"sources":["../../../../../node_modules/framesync/dist/es/on-next-frame.mjs"],"sourcesContent":["const defaultTimestep = (1 / 60) * 1000;\nconst getCurrentTime = typeof performance !== \"undefined\"\n ? () => performance.now()\n : () => Date.now();\nconst onNextFrame = typeof window !== \"undefined\"\n ? (callback) => window.requestAnimationFrame(callback)\n : (callback) => setTimeout(() => callback(getCurrentTime()), defaultTimestep);\n\nexport { defaultTimestep, onNextFrame };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAM,kBAAmB,IAAI,KAAM;AACnC,IAAM,iBAAiB,OAAO,gBAAgB,oBAClC,YAAY,IAAI,UAChB,KAAK,IAAI;AACrB,IAAM,cAAc,OAAO,WAAW,eAC/B,aAAa,OAAO,sBAAsB,QAAQ,KAClD,aAAa,iBAAiB,SAAS,eAAe,CAAC,GAAG,eAAe"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region node_modules/hey-listen/dist/hey-listen.es.js
|
|
2
|
+
var warning = function() {};
|
|
3
|
+
var invariant = function() {};
|
|
4
|
+
if (process.env.NODE_ENV !== "production") {
|
|
5
|
+
warning = function(check, message) {
|
|
6
|
+
if (!check && typeof console !== "undefined") console.warn(message);
|
|
7
|
+
};
|
|
8
|
+
invariant = function(check, message) {
|
|
9
|
+
if (!check) throw new Error(message);
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { invariant, warning };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=hey-listen.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hey-listen.es.js","names":[],"sources":["../../../../node_modules/hey-listen/dist/hey-listen.es.js"],"sourcesContent":["var warning = function () { };\r\nvar invariant = function () { };\r\nif (process.env.NODE_ENV !== 'production') {\r\n warning = function (check, message) {\r\n if (!check && typeof console !== 'undefined') {\r\n console.warn(message);\r\n }\r\n };\r\n invariant = function (check, message) {\r\n if (!check) {\r\n throw new Error(message);\r\n }\r\n };\r\n}\n\nexport { invariant, warning };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,IAAI,UAAU,WAAY,CAAE;AAC5B,IAAI,YAAY,WAAY,CAAE;AAC9B,IAAA,QAAA,IAAA,aAA6B,cAAc;CACvC,UAAU,SAAU,OAAO,SAAS;EAChC,IAAI,CAAC,SAAS,OAAO,YAAY,aAC7B,QAAQ,KAAK,OAAO;CAE5B;CACA,YAAY,SAAU,OAAO,SAAS;EAClC,IAAI,CAAC,OACD,MAAM,IAAI,MAAM,OAAO;CAE/B;AACJ"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//#region node_modules/popmotion/dist/es/animations/generators/decay.mjs
|
|
2
|
+
function decay({ velocity = 0, from = 0, power = .8, timeConstant = 350, restDelta = .5, modifyTarget }) {
|
|
3
|
+
const state = {
|
|
4
|
+
done: false,
|
|
5
|
+
value: from
|
|
6
|
+
};
|
|
7
|
+
let amplitude = power * velocity;
|
|
8
|
+
const ideal = from + amplitude;
|
|
9
|
+
const target = modifyTarget === void 0 ? ideal : modifyTarget(ideal);
|
|
10
|
+
if (target !== ideal) amplitude = target - from;
|
|
11
|
+
return {
|
|
12
|
+
next: (t) => {
|
|
13
|
+
const delta = -amplitude * Math.exp(-t / timeConstant);
|
|
14
|
+
state.done = !(delta > restDelta || delta < -restDelta);
|
|
15
|
+
state.value = state.done ? target : target + delta;
|
|
16
|
+
return state;
|
|
17
|
+
},
|
|
18
|
+
flipTarget: () => {}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
//#endregion
|
|
22
|
+
export { decay };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=decay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decay.js","names":[],"sources":["../../../../../../../node_modules/popmotion/dist/es/animations/generators/decay.mjs"],"sourcesContent":["function decay({ velocity = 0, from = 0, power = 0.8, timeConstant = 350, restDelta = 0.5, modifyTarget, }) {\n const state = { done: false, value: from };\n let amplitude = power * velocity;\n const ideal = from + amplitude;\n const target = modifyTarget === undefined ? ideal : modifyTarget(ideal);\n if (target !== ideal)\n amplitude = target - from;\n return {\n next: (t) => {\n const delta = -amplitude * Math.exp(-t / timeConstant);\n state.done = !(delta > restDelta || delta < -restDelta);\n state.value = state.done ? target : target + delta;\n return state;\n },\n flipTarget: () => { },\n };\n}\n\nexport { decay };\n"],"x_google_ignoreList":[0],"mappings":";AAAA,SAAS,MAAM,EAAE,WAAW,GAAG,OAAO,GAAG,QAAQ,IAAK,eAAe,KAAK,YAAY,IAAK,gBAAiB;CACxG,MAAM,QAAQ;EAAE,MAAM;EAAO,OAAO;CAAK;CACzC,IAAI,YAAY,QAAQ;CACxB,MAAM,QAAQ,OAAO;CACrB,MAAM,SAAS,iBAAiB,KAAA,IAAY,QAAQ,aAAa,KAAK;CACtE,IAAI,WAAW,OACX,YAAY,SAAS;CACzB,OAAO;EACH,OAAO,MAAM;GACT,MAAM,QAAQ,CAAC,YAAY,KAAK,IAAI,CAAC,IAAI,YAAY;GACrD,MAAM,OAAO,EAAE,QAAQ,aAAa,QAAQ,CAAC;GAC7C,MAAM,QAAQ,MAAM,OAAO,SAAS,SAAS;GAC7C,OAAO;EACX;EACA,kBAAkB,CAAE;CACxB;AACJ"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { interpolate } from "../../utils/interpolate.js";
|
|
2
|
+
import { easeInOut } from "../../easing/index.js";
|
|
3
|
+
//#region node_modules/popmotion/dist/es/animations/generators/keyframes.mjs
|
|
4
|
+
function defaultEasing(values, easing) {
|
|
5
|
+
return values.map(() => easing || easeInOut).splice(0, values.length - 1);
|
|
6
|
+
}
|
|
7
|
+
function defaultOffset(values) {
|
|
8
|
+
const numValues = values.length;
|
|
9
|
+
return values.map((_value, i) => i !== 0 ? i / (numValues - 1) : 0);
|
|
10
|
+
}
|
|
11
|
+
function convertOffsetToTimes(offset, duration) {
|
|
12
|
+
return offset.map((o) => o * duration);
|
|
13
|
+
}
|
|
14
|
+
function keyframes({ from = 0, to = 1, ease, offset, duration = 300 }) {
|
|
15
|
+
const state = {
|
|
16
|
+
done: false,
|
|
17
|
+
value: from
|
|
18
|
+
};
|
|
19
|
+
const values = Array.isArray(to) ? to : [from, to];
|
|
20
|
+
const times = convertOffsetToTimes(offset && offset.length === values.length ? offset : defaultOffset(values), duration);
|
|
21
|
+
function createInterpolator() {
|
|
22
|
+
return interpolate(times, values, { ease: Array.isArray(ease) ? ease : defaultEasing(values, ease) });
|
|
23
|
+
}
|
|
24
|
+
let interpolator = createInterpolator();
|
|
25
|
+
return {
|
|
26
|
+
next: (t) => {
|
|
27
|
+
state.value = interpolator(t);
|
|
28
|
+
state.done = t >= duration;
|
|
29
|
+
return state;
|
|
30
|
+
},
|
|
31
|
+
flipTarget: () => {
|
|
32
|
+
values.reverse();
|
|
33
|
+
interpolator = createInterpolator();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { keyframes };
|
|
39
|
+
|
|
40
|
+
//# sourceMappingURL=keyframes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"keyframes.js","names":[],"sources":["../../../../../../../node_modules/popmotion/dist/es/animations/generators/keyframes.mjs"],"sourcesContent":["import { interpolate } from '../../utils/interpolate.mjs';\nimport { easeInOut } from '../../easing/index.mjs';\n\nfunction defaultEasing(values, easing) {\n return values.map(() => easing || easeInOut).splice(0, values.length - 1);\n}\nfunction defaultOffset(values) {\n const numValues = values.length;\n return values.map((_value, i) => i !== 0 ? i / (numValues - 1) : 0);\n}\nfunction convertOffsetToTimes(offset, duration) {\n return offset.map((o) => o * duration);\n}\nfunction keyframes({ from = 0, to = 1, ease, offset, duration = 300, }) {\n const state = { done: false, value: from };\n const values = Array.isArray(to) ? to : [from, to];\n const times = convertOffsetToTimes(offset && offset.length === values.length\n ? offset\n : defaultOffset(values), duration);\n function createInterpolator() {\n return interpolate(times, values, {\n ease: Array.isArray(ease) ? ease : defaultEasing(values, ease),\n });\n }\n let interpolator = createInterpolator();\n return {\n next: (t) => {\n state.value = interpolator(t);\n state.done = t >= duration;\n return state;\n },\n flipTarget: () => {\n values.reverse();\n interpolator = createInterpolator();\n },\n };\n}\n\nexport { convertOffsetToTimes, defaultEasing, defaultOffset, keyframes };\n"],"x_google_ignoreList":[0],"mappings":";;;AAGA,SAAS,cAAc,QAAQ,QAAQ;CACnC,OAAO,OAAO,UAAU,UAAU,SAAS,EAAE,OAAO,GAAG,OAAO,SAAS,CAAC;AAC5E;AACA,SAAS,cAAc,QAAQ;CAC3B,MAAM,YAAY,OAAO;CACzB,OAAO,OAAO,KAAK,QAAQ,MAAM,MAAM,IAAI,KAAK,YAAY,KAAK,CAAC;AACtE;AACA,SAAS,qBAAqB,QAAQ,UAAU;CAC5C,OAAO,OAAO,KAAK,MAAM,IAAI,QAAQ;AACzC;AACA,SAAS,UAAU,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM,QAAQ,WAAW,OAAQ;CACpE,MAAM,QAAQ;EAAE,MAAM;EAAO,OAAO;CAAK;CACzC,MAAM,SAAS,MAAM,QAAQ,EAAE,IAAI,KAAK,CAAC,MAAM,EAAE;CACjD,MAAM,QAAQ,qBAAqB,UAAU,OAAO,WAAW,OAAO,SAChE,SACA,cAAc,MAAM,GAAG,QAAQ;CACrC,SAAS,qBAAqB;EAC1B,OAAO,YAAY,OAAO,QAAQ,EAC9B,MAAM,MAAM,QAAQ,IAAI,IAAI,OAAO,cAAc,QAAQ,IAAI,EACjE,CAAC;CACL;CACA,IAAI,eAAe,mBAAmB;CACtC,OAAO;EACH,OAAO,MAAM;GACT,MAAM,QAAQ,aAAa,CAAC;GAC5B,MAAM,OAAO,KAAK;GAClB,OAAO;EACX;EACA,kBAAkB;GACd,OAAO,QAAQ;GACf,eAAe,mBAAmB;EACtC;CACJ;AACJ"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { __rest } from "../../../../node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import { calcAngularFreq, findSpring } from "../utils/find-spring.js";
|
|
3
|
+
//#region node_modules/popmotion/dist/es/animations/generators/spring.mjs
|
|
4
|
+
var durationKeys = ["duration", "bounce"];
|
|
5
|
+
var physicsKeys = [
|
|
6
|
+
"stiffness",
|
|
7
|
+
"damping",
|
|
8
|
+
"mass"
|
|
9
|
+
];
|
|
10
|
+
function isSpringType(options, keys) {
|
|
11
|
+
return keys.some((key) => options[key] !== void 0);
|
|
12
|
+
}
|
|
13
|
+
function getSpringOptions(options) {
|
|
14
|
+
let springOptions = Object.assign({
|
|
15
|
+
velocity: 0,
|
|
16
|
+
stiffness: 100,
|
|
17
|
+
damping: 10,
|
|
18
|
+
mass: 1,
|
|
19
|
+
isResolvedFromDuration: false
|
|
20
|
+
}, options);
|
|
21
|
+
if (!isSpringType(options, physicsKeys) && isSpringType(options, durationKeys)) {
|
|
22
|
+
const derived = findSpring(options);
|
|
23
|
+
springOptions = Object.assign(Object.assign(Object.assign({}, springOptions), derived), {
|
|
24
|
+
velocity: 0,
|
|
25
|
+
mass: 1
|
|
26
|
+
});
|
|
27
|
+
springOptions.isResolvedFromDuration = true;
|
|
28
|
+
}
|
|
29
|
+
return springOptions;
|
|
30
|
+
}
|
|
31
|
+
function spring(_a) {
|
|
32
|
+
var { from = 0, to = 1, restSpeed = 2, restDelta } = _a, options = __rest(_a, [
|
|
33
|
+
"from",
|
|
34
|
+
"to",
|
|
35
|
+
"restSpeed",
|
|
36
|
+
"restDelta"
|
|
37
|
+
]);
|
|
38
|
+
const state = {
|
|
39
|
+
done: false,
|
|
40
|
+
value: from
|
|
41
|
+
};
|
|
42
|
+
let { stiffness, damping, mass, velocity, duration, isResolvedFromDuration } = getSpringOptions(options);
|
|
43
|
+
let resolveSpring = zero;
|
|
44
|
+
let resolveVelocity = zero;
|
|
45
|
+
function createSpring() {
|
|
46
|
+
const initialVelocity = velocity ? -(velocity / 1e3) : 0;
|
|
47
|
+
const initialDelta = to - from;
|
|
48
|
+
const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
|
|
49
|
+
const undampedAngularFreq = Math.sqrt(stiffness / mass) / 1e3;
|
|
50
|
+
if (restDelta === void 0) restDelta = Math.min(Math.abs(to - from) / 100, .4);
|
|
51
|
+
if (dampingRatio < 1) {
|
|
52
|
+
const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
|
|
53
|
+
resolveSpring = (t) => {
|
|
54
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
55
|
+
return to - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq * Math.sin(angularFreq * t) + initialDelta * Math.cos(angularFreq * t));
|
|
56
|
+
};
|
|
57
|
+
resolveVelocity = (t) => {
|
|
58
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
59
|
+
return dampingRatio * undampedAngularFreq * envelope * (Math.sin(angularFreq * t) * (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) / angularFreq + initialDelta * Math.cos(angularFreq * t)) - envelope * (Math.cos(angularFreq * t) * (initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) - angularFreq * initialDelta * Math.sin(angularFreq * t));
|
|
60
|
+
};
|
|
61
|
+
} else if (dampingRatio === 1) resolveSpring = (t) => to - Math.exp(-undampedAngularFreq * t) * (initialDelta + (initialVelocity + undampedAngularFreq * initialDelta) * t);
|
|
62
|
+
else {
|
|
63
|
+
const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
|
|
64
|
+
resolveSpring = (t) => {
|
|
65
|
+
const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
|
|
66
|
+
const freqForT = Math.min(dampedAngularFreq * t, 300);
|
|
67
|
+
return to - envelope * ((initialVelocity + dampingRatio * undampedAngularFreq * initialDelta) * Math.sinh(freqForT) + dampedAngularFreq * initialDelta * Math.cosh(freqForT)) / dampedAngularFreq;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
createSpring();
|
|
72
|
+
return {
|
|
73
|
+
next: (t) => {
|
|
74
|
+
const current = resolveSpring(t);
|
|
75
|
+
if (!isResolvedFromDuration) {
|
|
76
|
+
const currentVelocity = resolveVelocity(t) * 1e3;
|
|
77
|
+
const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
|
|
78
|
+
const isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta;
|
|
79
|
+
state.done = isBelowVelocityThreshold && isBelowDisplacementThreshold;
|
|
80
|
+
} else state.done = t >= duration;
|
|
81
|
+
state.value = state.done ? to : current;
|
|
82
|
+
return state;
|
|
83
|
+
},
|
|
84
|
+
flipTarget: () => {
|
|
85
|
+
velocity = -velocity;
|
|
86
|
+
[from, to] = [to, from];
|
|
87
|
+
createSpring();
|
|
88
|
+
}
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
spring.needsInterpolation = (a, b) => typeof a === "string" || typeof b === "string";
|
|
92
|
+
var zero = (_t) => 0;
|
|
93
|
+
//#endregion
|
|
94
|
+
export { spring };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=spring.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spring.js","names":[],"sources":["../../../../../../../node_modules/popmotion/dist/es/animations/generators/spring.mjs"],"sourcesContent":["import { __rest } from 'tslib';\nimport { findSpring, calcAngularFreq } from '../utils/find-spring.mjs';\n\nconst durationKeys = [\"duration\", \"bounce\"];\nconst physicsKeys = [\"stiffness\", \"damping\", \"mass\"];\nfunction isSpringType(options, keys) {\n return keys.some((key) => options[key] !== undefined);\n}\nfunction getSpringOptions(options) {\n let springOptions = Object.assign({ velocity: 0.0, stiffness: 100, damping: 10, mass: 1.0, isResolvedFromDuration: false }, options);\n if (!isSpringType(options, physicsKeys) &&\n isSpringType(options, durationKeys)) {\n const derived = findSpring(options);\n springOptions = Object.assign(Object.assign(Object.assign({}, springOptions), derived), { velocity: 0.0, mass: 1.0 });\n springOptions.isResolvedFromDuration = true;\n }\n return springOptions;\n}\nfunction spring(_a) {\n var { from = 0.0, to = 1.0, restSpeed = 2, restDelta } = _a, options = __rest(_a, [\"from\", \"to\", \"restSpeed\", \"restDelta\"]);\n const state = { done: false, value: from };\n let { stiffness, damping, mass, velocity, duration, isResolvedFromDuration, } = getSpringOptions(options);\n let resolveSpring = zero;\n let resolveVelocity = zero;\n function createSpring() {\n const initialVelocity = velocity ? -(velocity / 1000) : 0.0;\n const initialDelta = to - from;\n const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));\n const undampedAngularFreq = Math.sqrt(stiffness / mass) / 1000;\n if (restDelta === undefined) {\n restDelta = Math.min(Math.abs(to - from) / 100, 0.4);\n }\n if (dampingRatio < 1) {\n const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);\n resolveSpring = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n return (to -\n envelope *\n (((initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) /\n angularFreq) *\n Math.sin(angularFreq * t) +\n initialDelta * Math.cos(angularFreq * t)));\n };\n resolveVelocity = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n return (dampingRatio *\n undampedAngularFreq *\n envelope *\n ((Math.sin(angularFreq * t) *\n (initialVelocity +\n dampingRatio *\n undampedAngularFreq *\n initialDelta)) /\n angularFreq +\n initialDelta * Math.cos(angularFreq * t)) -\n envelope *\n (Math.cos(angularFreq * t) *\n (initialVelocity +\n dampingRatio *\n undampedAngularFreq *\n initialDelta) -\n angularFreq *\n initialDelta *\n Math.sin(angularFreq * t)));\n };\n }\n else if (dampingRatio === 1) {\n resolveSpring = (t) => to -\n Math.exp(-undampedAngularFreq * t) *\n (initialDelta +\n (initialVelocity + undampedAngularFreq * initialDelta) *\n t);\n }\n else {\n const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);\n resolveSpring = (t) => {\n const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);\n const freqForT = Math.min(dampedAngularFreq * t, 300);\n return (to -\n (envelope *\n ((initialVelocity +\n dampingRatio * undampedAngularFreq * initialDelta) *\n Math.sinh(freqForT) +\n dampedAngularFreq *\n initialDelta *\n Math.cosh(freqForT))) /\n dampedAngularFreq);\n };\n }\n }\n createSpring();\n return {\n next: (t) => {\n const current = resolveSpring(t);\n if (!isResolvedFromDuration) {\n const currentVelocity = resolveVelocity(t) * 1000;\n const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;\n const isBelowDisplacementThreshold = Math.abs(to - current) <= restDelta;\n state.done =\n isBelowVelocityThreshold && isBelowDisplacementThreshold;\n }\n else {\n state.done = t >= duration;\n }\n state.value = state.done ? to : current;\n return state;\n },\n flipTarget: () => {\n velocity = -velocity;\n [from, to] = [to, from];\n createSpring();\n },\n };\n}\nspring.needsInterpolation = (a, b) => typeof a === \"string\" || typeof b === \"string\";\nconst zero = (_t) => 0;\n\nexport { spring };\n"],"x_google_ignoreList":[0],"mappings":";;;AAGA,IAAM,eAAe,CAAC,YAAY,QAAQ;AAC1C,IAAM,cAAc;CAAC;CAAa;CAAW;AAAM;AACnD,SAAS,aAAa,SAAS,MAAM;CACjC,O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IAAI,IAAI;GACtB,aAAa;EACjB;CACJ;AACJ;AACA,OAAO,sBAAsB,GAAG,MAAM,OAAO,MAAM,YAAY,OAAO,MAAM;AAC5E,IAAM,QAAQ,OAAO"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { __rest } from "../../../node_modules/tslib/tslib.es6.js";
|
|
2
|
+
import { interpolate } from "../utils/interpolate.js";
|
|
3
|
+
import { detectAnimationFromOptions } from "./utils/detect-animation-from-options.js";
|
|
4
|
+
import sync, { cancelSync } from "../../../../framesync/dist/es/index.js";
|
|
5
|
+
import { hasRepeatDelayElapsed, loopElapsed, reverseElapsed } from "./utils/elapsed.js";
|
|
6
|
+
//#region node_modules/popmotion/dist/es/animations/index.mjs
|
|
7
|
+
var framesync = (update) => {
|
|
8
|
+
const passTimestamp = ({ delta }) => update(delta);
|
|
9
|
+
return {
|
|
10
|
+
start: () => sync.update(passTimestamp, true),
|
|
11
|
+
stop: () => cancelSync.update(passTimestamp)
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
function animate(_a) {
|
|
15
|
+
var _b, _c;
|
|
16
|
+
var { from, autoplay = true, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = "loop", repeatDelay = 0, onPlay, onStop, onComplete, onRepeat, onUpdate } = _a, options = __rest(_a, [
|
|
17
|
+
"from",
|
|
18
|
+
"autoplay",
|
|
19
|
+
"driver",
|
|
20
|
+
"elapsed",
|
|
21
|
+
"repeat",
|
|
22
|
+
"repeatType",
|
|
23
|
+
"repeatDelay",
|
|
24
|
+
"onPlay",
|
|
25
|
+
"onStop",
|
|
26
|
+
"onComplete",
|
|
27
|
+
"onRepeat",
|
|
28
|
+
"onUpdate"
|
|
29
|
+
]);
|
|
30
|
+
let { to } = options;
|
|
31
|
+
let driverControls;
|
|
32
|
+
let repeatCount = 0;
|
|
33
|
+
let computedDuration = options.duration;
|
|
34
|
+
let latest;
|
|
35
|
+
let isComplete = false;
|
|
36
|
+
let isForwardPlayback = true;
|
|
37
|
+
let interpolateFromNumber;
|
|
38
|
+
const animator = detectAnimationFromOptions(options);
|
|
39
|
+
if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) {
|
|
40
|
+
interpolateFromNumber = interpolate([0, 100], [from, to], { clamp: false });
|
|
41
|
+
from = 0;
|
|
42
|
+
to = 100;
|
|
43
|
+
}
|
|
44
|
+
const animation = animator(Object.assign(Object.assign({}, options), {
|
|
45
|
+
from,
|
|
46
|
+
to
|
|
47
|
+
}));
|
|
48
|
+
function repeat() {
|
|
49
|
+
repeatCount++;
|
|
50
|
+
if (repeatType === "reverse") {
|
|
51
|
+
isForwardPlayback = repeatCount % 2 === 0;
|
|
52
|
+
elapsed = reverseElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback);
|
|
53
|
+
} else {
|
|
54
|
+
elapsed = loopElapsed(elapsed, computedDuration, repeatDelay);
|
|
55
|
+
if (repeatType === "mirror") animation.flipTarget();
|
|
56
|
+
}
|
|
57
|
+
isComplete = false;
|
|
58
|
+
onRepeat && onRepeat();
|
|
59
|
+
}
|
|
60
|
+
function complete() {
|
|
61
|
+
driverControls.stop();
|
|
62
|
+
onComplete && onComplete();
|
|
63
|
+
}
|
|
64
|
+
function update(delta) {
|
|
65
|
+
if (!isForwardPlayback) delta = -delta;
|
|
66
|
+
elapsed += delta;
|
|
67
|
+
if (!isComplete) {
|
|
68
|
+
const state = animation.next(Math.max(0, elapsed));
|
|
69
|
+
latest = state.value;
|
|
70
|
+
if (interpolateFromNumber) latest = interpolateFromNumber(latest);
|
|
71
|
+
isComplete = isForwardPlayback ? state.done : elapsed <= 0;
|
|
72
|
+
}
|
|
73
|
+
onUpdate === null || onUpdate === void 0 || onUpdate(latest);
|
|
74
|
+
if (isComplete) {
|
|
75
|
+
if (repeatCount === 0) computedDuration !== null && computedDuration !== void 0 || (computedDuration = elapsed);
|
|
76
|
+
if (repeatCount < repeatMax) hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat();
|
|
77
|
+
else complete();
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
function play() {
|
|
81
|
+
onPlay === null || onPlay === void 0 || onPlay();
|
|
82
|
+
driverControls = driver(update);
|
|
83
|
+
driverControls.start();
|
|
84
|
+
}
|
|
85
|
+
autoplay && play();
|
|
86
|
+
return { stop: () => {
|
|
87
|
+
onStop === null || onStop === void 0 || onStop();
|
|
88
|
+
driverControls.stop();
|
|
89
|
+
} };
|
|
90
|
+
}
|
|
91
|
+
//#endregion
|
|
92
|
+
export { animate };
|
|
93
|
+
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../../../node_modules/popmotion/dist/es/animations/index.mjs"],"sourcesContent":["import { __rest } from 'tslib';\nimport { detectAnimationFromOptions } from './utils/detect-animation-from-options.mjs';\nimport sync, { cancelSync } from 'framesync';\nimport { interpolate } from '../utils/interpolate.mjs';\nimport { hasRepeatDelayElapsed, reverseElapsed, loopElapsed } from './utils/elapsed.mjs';\n\nconst framesync = (update) => {\n const passTimestamp = ({ delta }) => update(delta);\n return {\n start: () => sync.update(passTimestamp, true),\n stop: () => cancelSync.update(passTimestamp),\n };\n};\nfunction animate(_a) {\n var _b, _c;\n var { from, autoplay = true, driver = framesync, elapsed = 0, repeat: repeatMax = 0, repeatType = \"loop\", repeatDelay = 0, onPlay, onStop, onComplete, onRepeat, onUpdate } = _a, options = __rest(_a, [\"from\", \"autoplay\", \"driver\", \"elapsed\", \"repeat\", \"repeatType\", \"repeatDelay\", \"onPlay\", \"onStop\", \"onComplete\", \"onRepeat\", \"onUpdate\"]);\n let { to } = options;\n let driverControls;\n let repeatCount = 0;\n let computedDuration = options.duration;\n let latest;\n let isComplete = false;\n let isForwardPlayback = true;\n let interpolateFromNumber;\n const animator = detectAnimationFromOptions(options);\n if ((_c = (_b = animator).needsInterpolation) === null || _c === void 0 ? void 0 : _c.call(_b, from, to)) {\n interpolateFromNumber = interpolate([0, 100], [from, to], {\n clamp: false,\n });\n from = 0;\n to = 100;\n }\n const animation = animator(Object.assign(Object.assign({}, options), { from, to }));\n function repeat() {\n repeatCount++;\n if (repeatType === \"reverse\") {\n isForwardPlayback = repeatCount % 2 === 0;\n elapsed = reverseElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback);\n }\n else {\n elapsed = loopElapsed(elapsed, computedDuration, repeatDelay);\n if (repeatType === \"mirror\")\n animation.flipTarget();\n }\n isComplete = false;\n onRepeat && onRepeat();\n }\n function complete() {\n driverControls.stop();\n onComplete && onComplete();\n }\n function update(delta) {\n if (!isForwardPlayback)\n delta = -delta;\n elapsed += delta;\n if (!isComplete) {\n const state = animation.next(Math.max(0, elapsed));\n latest = state.value;\n if (interpolateFromNumber)\n latest = interpolateFromNumber(latest);\n isComplete = isForwardPlayback ? state.done : elapsed <= 0;\n }\n onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(latest);\n if (isComplete) {\n if (repeatCount === 0)\n computedDuration !== null && computedDuration !== void 0 ? computedDuration : (computedDuration = elapsed);\n if (repeatCount < repeatMax) {\n hasRepeatDelayElapsed(elapsed, computedDuration, repeatDelay, isForwardPlayback) && repeat();\n }\n else {\n complete();\n }\n }\n }\n function play() {\n onPlay === null || onPlay === void 0 ? void 0 : onPlay();\n driverControls = driver(update);\n driverControls.start();\n }\n autoplay && play();\n return {\n stop: () => {\n onStop === null || onStop === void 0 ? void 0 : onStop();\n driverControls.stop();\n },\n };\n}\n\nexport { animate };\n"],"x_google_ignoreList":[0],"mappings":";;;;;;AAMA,IAAM,aAAa,WAAW;CAC1B,MAAM,iBAAiB,EAAE,YAAY,OAAO,KAAK;CACjD,OAAO;EACH,aAAa,KAAK,OAAO,eAAe,IAAI;EAC5C,YAAY,WAAW,OAAO,aAAa;CAC/C;AACJ;AACA,SAAS,QAAQ,IAAI;CACjB,IAAI,IAAI;CACR,IAAI,EAAE,MAA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