hys-ui 0.3.0 → 0.5.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 +27 -0
- package/README.md +68 -73
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber.vue.js +5 -41
- package/dist/components/HysAnimatedNumber/HysAnimatedNumber2.vue.js +467 -2
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas2.vue.js +166 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.js +7 -0
- package/dist/components/HysAnimatedNumber/NumberDigits/NumberDigits2.vue.js +105 -0
- package/dist/components/HysAnimatedNumber/animation/digital.js +186 -0
- package/dist/components/HysAnimatedNumber/animation/morph.js +110 -0
- package/dist/components/HysAnimatedNumber/animation/paint.js +34 -0
- package/dist/components/HysAnimatedNumber/animation/particles.js +51 -0
- package/dist/components/HysAnimatedNumber/animation/paths.js +165 -0
- package/dist/components/HysAnimatedNumber/animation/physics.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/render.js +89 -0
- package/dist/components/HysAnimatedNumber/animation/reveal.js +125 -0
- package/dist/components/HysAnimatedNumber/animation/rolling.js +66 -0
- package/dist/components/HysAnimatedNumber/animation/scenarios.js +217 -0
- package/dist/components/HysAnimatedNumber/animation/spatial.js +112 -0
- package/dist/components/HysAnimatedNumber/useNumberCountdown.js +58 -0
- package/dist/components/HysAnimatedNumber/useNumberVisuals.js +60 -0
- package/dist/components/HysButton/HysButton.vue.js +2 -2
- package/dist/components/HysButton/HysButton2.vue.js +227 -60
- package/dist/components/HysButtonGroup/HysButtonGroup.vue.js +7 -0
- package/dist/components/HysButtonGroup/HysButtonGroup2.vue.js +51 -0
- package/dist/components/HysFormItem/HysFormItem.vue.js +1 -1
- package/dist/components/HysFormItem/HysFormItem2.vue.js +231 -229
- package/dist/components/HysInput/HysInput.vue.js +2 -2
- package/dist/components/HysInput/HysInput2.vue.js +327 -274
- package/dist/components/HysMention/HysMention.vue.js +1 -1
- package/dist/components/HysMention/HysMention2.vue.js +1092 -154
- package/dist/components/HysModal/HysModal.vue.js +3 -3
- package/dist/components/HysModal/HysModal2.vue.js +81 -80
- package/dist/components/HysPagination/HysPagination.vue.js +2 -2
- package/dist/components/HysPagination/HysPagination2.vue.js +243 -180
- package/dist/components/HysSearch/HysSearch.vue.js +5 -82
- package/dist/components/HysSearch/HysSearch2.vue.js +176 -2
- package/dist/components/HysSelect/HysSelect.vue.js +2 -2
- package/dist/components/HysSelect/HysSelect2.vue.js +472 -443
- package/dist/components/HysSplitPane/HysSplitPane.vue.js +315 -58
- package/dist/components/HysSplitPane/HysSplitPane3.vue.js +5 -0
- package/dist/components/HysTable/HysTable.vue.js +2 -2
- package/dist/components/HysTable/HysTable2.vue.js +1418 -1150
- package/dist/components/HysTextarea/HysTextarea.vue.js +56 -32
- package/dist/components/HysTour/HysTour.vue.js +291 -67
- package/dist/components/HysTour/HysTour3.vue.js +5 -0
- package/dist/composables/animatedNumberDigits.js +106 -0
- package/dist/composables/animatedNumberFormat.js +222 -0
- package/dist/composables/animatedNumberTiming.js +66 -0
- package/dist/composables/buttonGroup.js +12 -0
- package/dist/composables/floatingPosition.js +18 -0
- package/dist/composables/mentionDocument.js +79 -0
- package/dist/composables/mentionEditor.js +58 -0
- package/dist/composables/numberAnimation.js +72 -0
- package/dist/composables/numberAnimationCatalog.js +301 -0
- package/dist/composables/numberAnimationSequence.js +45 -0
- package/dist/composables/selectOptions.js +44 -38
- package/dist/composables/splitPaneSizes.js +58 -0
- package/dist/composables/table.js +128 -105
- package/dist/composables/textInput.js +23 -14
- package/dist/composables/useDialog.js +50 -50
- package/dist/composables/useFloating.js +107 -103
- package/dist/composables/useHysAnimatedNumber.js +264 -0
- package/dist/composables/useHysNumberAnimationGroup.js +23 -0
- package/dist/composables/useMentionCaret.js +81 -0
- package/dist/composables/useMentionList.js +81 -0
- package/dist/composables/useMentionModel.js +90 -0
- package/dist/composables/useMentionOptions.js +421 -0
- package/dist/composables/useSplitPaneDrag.js +52 -0
- package/dist/composables/useSplitPaneStorage.js +38 -0
- package/dist/composables/useTable.js +344 -312
- package/dist/composables/useTableSticky.js +79 -0
- package/dist/composables/useTextareaSize.js +62 -46
- package/dist/composables/useTourLayout.js +129 -0
- package/dist/config.js +11 -11
- package/dist/index.js +183 -152
- package/dist/internal/MultiSplitPane.vue.js +305 -0
- package/dist/internal/MultiSplitPane2.vue.js +4 -0
- package/dist/style.css +1 -1
- package/dist/types/components/HysAnimatedNumber/HysAnimatedNumber.vue.d.ts +99 -6
- package/dist/types/components/HysAnimatedNumber/NumberAnimationCanvas/NumberAnimationCanvas.vue.d.ts +19 -0
- package/dist/types/components/HysAnimatedNumber/NumberDigits/NumberDigits.vue.d.ts +31 -0
- package/dist/types/components/HysAnimatedNumber/animation/digital.d.ts +3 -0
- package/dist/types/components/HysAnimatedNumber/animation/morph.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/paint.d.ts +44 -0
- package/dist/types/components/HysAnimatedNumber/animation/particles.d.ts +5 -0
- package/dist/types/components/HysAnimatedNumber/animation/paths.d.ts +12 -0
- package/dist/types/components/HysAnimatedNumber/animation/physics.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/render.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/reveal.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/rolling.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/animation/scenarios.d.ts +4 -0
- package/dist/types/components/HysAnimatedNumber/animation/spatial.d.ts +2 -0
- package/dist/types/components/HysAnimatedNumber/useNumberCountdown.d.ts +8 -0
- package/dist/types/components/HysAnimatedNumber/useNumberVisuals.d.ts +12 -0
- package/dist/types/components/HysAutocomplete/HysAutocomplete.vue.d.ts +12 -3
- package/dist/types/components/HysAvatarGroup/HysAvatarGroup.vue.d.ts +2 -2
- package/dist/types/components/HysButton/HysButton.vue.d.ts +82 -22
- package/dist/types/components/HysButtonGroup/HysButtonGroup.vue.d.ts +30 -0
- package/dist/types/components/HysCard/HysCard.vue.d.ts +1 -1
- package/dist/types/components/HysCascader/HysCascader.vue.d.ts +3 -3
- package/dist/types/components/HysCascader/HysCascaderColumn.vue.d.ts +3 -3
- package/dist/types/components/HysColorPicker/HysColorPicker.vue.d.ts +3 -3
- package/dist/types/components/HysContextMenu/HysMenuPanel.vue.d.ts +2 -2
- package/dist/types/components/HysDatePicker/HysDatePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDatePicker/HysDatePickerControl.vue.d.ts +6 -6
- package/dist/types/components/HysDateRangePicker/HysDateRangePicker.vue.d.ts +3 -3
- package/dist/types/components/HysDrawer/HysDrawer.vue.d.ts +2 -2
- package/dist/types/components/HysFormItem/HysFormItem.vue.d.ts +1 -1
- package/dist/types/components/HysInput/HysInput.vue.d.ts +13 -1
- package/dist/types/components/HysMention/HysMention.vue.d.ts +91 -40
- package/dist/types/components/HysModal/HysModal.vue.d.ts +1 -1
- package/dist/types/components/HysNumberInput/HysNumberInput.vue.d.ts +2 -2
- package/dist/types/components/HysPagination/HysPagination.vue.d.ts +55 -4
- package/dist/types/components/HysPopover/HysPopover.vue.d.ts +1 -1
- package/dist/types/components/HysRating/HysRating.vue.d.ts +1 -1
- package/dist/types/components/HysSearch/HysSearch.vue.d.ts +46 -8
- package/dist/types/components/HysSelect/HysSelect.vue.d.ts +6 -1
- package/dist/types/components/HysSkeleton/HysSkeleton.vue.d.ts +2 -2
- package/dist/types/components/HysSplitPane/HysSplitPane.vue.d.ts +125 -14
- package/dist/types/components/HysSteps/HysSteps.vue.d.ts +1 -1
- package/dist/types/components/HysTable/HysTable.vue.d.ts +1740 -3
- package/dist/types/components/HysTabs/HysTabs.vue.d.ts +1 -1
- package/dist/types/components/HysTagInput/HysTagInput.vue.d.ts +1 -1
- package/dist/types/components/HysTextarea/HysTextarea.vue.d.ts +13 -2
- package/dist/types/components/HysToast/HysToast.vue.d.ts +1 -1
- package/dist/types/components/HysTooltip/HysTooltip.vue.d.ts +1 -1
- package/dist/types/components/HysTour/HysTour.vue.d.ts +46 -9
- package/dist/types/components/HysTreeSelect/HysTreeSelect.vue.d.ts +3 -3
- package/dist/types/components/HysUpload/HysUpload.vue.d.ts +2 -2
- package/dist/types/composables/animatedNumber.d.ts +220 -0
- package/dist/types/composables/animatedNumberDigits.d.ts +32 -0
- package/dist/types/composables/animatedNumberFormat.d.ts +16 -0
- package/dist/types/composables/animatedNumberTiming.d.ts +21 -0
- package/dist/types/composables/buttonGroup.d.ts +9 -0
- package/dist/types/composables/drawer.d.ts +1 -1
- package/dist/types/composables/floatingPosition.d.ts +14 -0
- package/dist/types/composables/mention.d.ts +284 -0
- package/dist/types/composables/mentionDocument.d.ts +15 -0
- package/dist/types/composables/mentionEditor.d.ts +7 -0
- package/dist/types/composables/modal.d.ts +2 -0
- package/dist/types/composables/numberAnimation.d.ts +29 -0
- package/dist/types/composables/numberAnimationCatalog.d.ts +58 -0
- package/dist/types/composables/numberAnimationSequence.d.ts +13 -0
- package/dist/types/composables/selectOptions.d.ts +5 -0
- package/dist/types/composables/splitPaneSizes.d.ts +11 -0
- package/dist/types/composables/table.d.ts +116 -6
- package/dist/types/composables/textInput.d.ts +39 -4
- package/dist/types/composables/tour.d.ts +68 -0
- package/dist/types/composables/useFloating.d.ts +1 -1
- package/dist/types/composables/useHysAnimatedNumber.d.ts +37 -0
- package/dist/types/composables/useHysNumberAnimationGroup.d.ts +4 -0
- package/dist/types/composables/useMentionCaret.d.ts +6 -0
- package/dist/types/composables/useMentionList.d.ts +23 -0
- package/dist/types/composables/useMentionModel.d.ts +14 -0
- package/dist/types/composables/useMentionOptions.d.ts +26 -0
- package/dist/types/composables/useSplitPaneDrag.d.ts +14 -0
- package/dist/types/composables/useSplitPaneStorage.d.ts +4 -0
- package/dist/types/composables/useTable.d.ts +7 -3
- package/dist/types/composables/useTableSticky.d.ts +22 -0
- package/dist/types/composables/useTextareaSize.d.ts +5 -2
- package/dist/types/composables/useTourLayout.d.ts +33 -0
- package/dist/types/config.d.ts +1 -0
- package/dist/types/index.d.ts +46 -1
- package/dist/types/internal/MultiSplitPane.vue.d.ts +54 -0
- package/package.json +3 -2
- package/dist/components/HysSplitPane/HysSplitPane2.vue.js +0 -4
- package/dist/components/HysTour/HysTour2.vue.js +0 -4
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { defineComponent as z, useSlots as A, computed as l, openBlock as r, createElementBlock as c, Fragment as b, renderList as I, normalizeStyle as L, renderSlot as j, mergeProps as w, createElementVNode as P, toDisplayString as g, normalizeClass as G } from "vue";
|
|
2
|
+
import { digitCount as v, numberTokens as R, createDigitTracks as V, digitMotion as X } from "../../../composables/animatedNumberDigits.js";
|
|
3
|
+
import { bounded as u } from "../../../composables/animatedNumberFormat.js";
|
|
4
|
+
const $ = ["role", "aria-label", "data-effect", "data-axis", "data-timer-motion"], q = { class: "hys-number-face hys-number-face-first" }, H = { class: "hys-number-face hys-number-face-second" }, Q = /* @__PURE__ */ z({
|
|
5
|
+
__name: "NumberDigits",
|
|
6
|
+
props: {
|
|
7
|
+
current: {},
|
|
8
|
+
start: {},
|
|
9
|
+
end: {},
|
|
10
|
+
glyphs: {},
|
|
11
|
+
context: {},
|
|
12
|
+
effect: {},
|
|
13
|
+
axis: {},
|
|
14
|
+
order: {},
|
|
15
|
+
stagger: {},
|
|
16
|
+
duration: {},
|
|
17
|
+
digitDuration: {},
|
|
18
|
+
motion: { type: Boolean },
|
|
19
|
+
timer: { type: Boolean },
|
|
20
|
+
accessible: { type: Boolean },
|
|
21
|
+
split: { type: Boolean }
|
|
22
|
+
},
|
|
23
|
+
setup(s) {
|
|
24
|
+
const e = s, p = A(), x = l(
|
|
25
|
+
() => e.motion && !e.timer && e.context.progress < 1 && ["delayed", "playing", "paused"].includes(e.context.status)
|
|
26
|
+
), S = l(
|
|
27
|
+
() => e.effect === "appear" || e.effect === "disappear"
|
|
28
|
+
), C = l(
|
|
29
|
+
() => v(e.start.parts) > v(e.end.parts) ? e.start : e.end
|
|
30
|
+
), B = l(() => {
|
|
31
|
+
const n = x.value && S.value && !p.digit ? C.value : e.current;
|
|
32
|
+
return R(
|
|
33
|
+
n.parts,
|
|
34
|
+
v(n.parts) <= 48 && (!!e.effect || !!p.digit || e.split)
|
|
35
|
+
);
|
|
36
|
+
}), D = l(
|
|
37
|
+
() => e.effect && !e.timer && V(e.start, e.end, e.glyphs)
|
|
38
|
+
), F = l(() => {
|
|
39
|
+
const n = B.value.filter((t) => t.section).length;
|
|
40
|
+
let E = 0;
|
|
41
|
+
return B.value.map((t) => {
|
|
42
|
+
if (!t.section) return { token: t };
|
|
43
|
+
const o = E++, y = e.order === "low-to-high" ? n - 1 - o : o, i = u(e.duration, 650, 1, Number.MAX_SAFE_INTEGER), m = u(e.stagger, 0, 0, i / Math.max(1, n)), h = y * m, M = u(
|
|
44
|
+
e.digitDuration,
|
|
45
|
+
i - h,
|
|
46
|
+
1,
|
|
47
|
+
i - h
|
|
48
|
+
), N = e.context.progress, f = m || e.digitDuration !== void 0 ? u((N * i - h) / M, 0, 0, 1) : u(e.context.easedProgress, N, 0, 1), d = x.value && D.value ? D.value(t) : void 0, a = d && (f < 1 || S.value) && e.effect ? X(e.effect, d, f, o, e.glyphs) : void 0, T = {
|
|
49
|
+
...e.context,
|
|
50
|
+
digit: t.text,
|
|
51
|
+
index: o,
|
|
52
|
+
position: t.position,
|
|
53
|
+
section: t.section,
|
|
54
|
+
digitProgress: f
|
|
55
|
+
};
|
|
56
|
+
return {
|
|
57
|
+
token: t,
|
|
58
|
+
context: T,
|
|
59
|
+
face: d && f === 1 && d.toPresent ? e.glyphs[d.destination] : t.text,
|
|
60
|
+
track: a != null && a.changed ? a : void 0,
|
|
61
|
+
style: a ? {
|
|
62
|
+
"--number-phase": a.phase,
|
|
63
|
+
"--number-direction": a.direction
|
|
64
|
+
} : void 0
|
|
65
|
+
};
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
return (n, E) => (r(), c("span", {
|
|
69
|
+
class: "hys-number-digits",
|
|
70
|
+
role: s.accessible ? "img" : void 0,
|
|
71
|
+
"aria-label": s.accessible ? s.current.parts.map(({ value: t }) => t).join("") : void 0,
|
|
72
|
+
"data-effect": s.effect,
|
|
73
|
+
"data-axis": s.axis,
|
|
74
|
+
"data-timer-motion": s.timer && s.motion && s.effect ? "" : void 0
|
|
75
|
+
}, [
|
|
76
|
+
(r(!0), c(b, null, I(F.value, ({ token: t, context: o, face: y, track: i, style: m }) => (r(), c(b, {
|
|
77
|
+
key: t.key
|
|
78
|
+
}, [
|
|
79
|
+
o ? (r(), c("span", {
|
|
80
|
+
key: 0,
|
|
81
|
+
class: "hys-ui-motion-number-digit",
|
|
82
|
+
style: L(m)
|
|
83
|
+
}, [
|
|
84
|
+
p.digit ? j(n.$slots, "digit", w({ ref_for: !0 }, o), void 0, !0, 0) : i ? (r(), c(b, { key: 1 }, [
|
|
85
|
+
P("span", q, g(i.first), 1),
|
|
86
|
+
P("span", H, g(i.second), 1)
|
|
87
|
+
], 64)) : (r(), c("span", {
|
|
88
|
+
key: s.timer ? t.text : void 0,
|
|
89
|
+
class: "hys-number-face hys-number-timer-face"
|
|
90
|
+
}, g(y), 1))
|
|
91
|
+
], 4)) : (r(), c("span", {
|
|
92
|
+
key: 1,
|
|
93
|
+
class: G({
|
|
94
|
+
"hys-ui-motion-number-separator": t.type === "group" || t.type === "decimal",
|
|
95
|
+
"hys-ui-motion-number-currency": t.type === "currency",
|
|
96
|
+
"hys-ui-motion-number-sign": t.type === "plusSign" || t.type === "minusSign"
|
|
97
|
+
})
|
|
98
|
+
}, g(t.text), 3))
|
|
99
|
+
], 64))), 128))
|
|
100
|
+
], 8, $));
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
export {
|
|
104
|
+
Q as default
|
|
105
|
+
};
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
import { rollingGlyph as I, noise as k, glyph as d, rectangle as S, wave as W, smooth as _ } from "./paint.js";
|
|
2
|
+
import { glyphMask as C } from "./particles.js";
|
|
3
|
+
import { tracePath as E, digitPath as R } from "./paths.js";
|
|
4
|
+
const Z = [
|
|
5
|
+
"abcdef",
|
|
6
|
+
"bc",
|
|
7
|
+
"abged",
|
|
8
|
+
"abgcd",
|
|
9
|
+
"fgbc",
|
|
10
|
+
"afgcd",
|
|
11
|
+
"afgecd",
|
|
12
|
+
"abc",
|
|
13
|
+
"abcdefg",
|
|
14
|
+
"abfgcd"
|
|
15
|
+
], j = {
|
|
16
|
+
a: [-0.2, -0.41, 0.2, -0.41],
|
|
17
|
+
b: [0.22, -0.37, 0.22, -0.04],
|
|
18
|
+
c: [0.22, 0.04, 0.22, 0.37],
|
|
19
|
+
d: [-0.2, 0.41, 0.2, 0.41],
|
|
20
|
+
e: [-0.22, 0.04, -0.22, 0.37],
|
|
21
|
+
f: [-0.22, -0.37, -0.22, -0.04],
|
|
22
|
+
g: [-0.2, 0, 0.2, 0]
|
|
23
|
+
};
|
|
24
|
+
function q(s, l, e) {
|
|
25
|
+
const { ctx: o, size: h, color: p, accent: f } = s;
|
|
26
|
+
o.save(), o.lineWidth = (e === 3 ? 0.045 : 0.075) * h, o.lineCap = e === 3 ? "butt" : "round";
|
|
27
|
+
const c = Z[l] ?? "";
|
|
28
|
+
for (const [b, [t, y, r, u]] of Object.entries(j))
|
|
29
|
+
o.globalAlpha = c.includes(b) ? 1 : 0.14, o.strokeStyle = e === 3 ? p : f, o.beginPath(), o.moveTo(t * h, y * h), e === 1 && y === u && (o.lineTo(-0.022 * h, u * h), o.moveTo(0.022 * h, u * h)), o.lineTo(r * h, u * h), o.stroke();
|
|
30
|
+
e === 1 && (o.lineWidth = 0.035 * h, [
|
|
31
|
+
[-0.18, -0.35, -0.025, -0.05],
|
|
32
|
+
[0.18, -0.35, 0.025, -0.05],
|
|
33
|
+
[-0.18, 0.35, -0.025, 0.05],
|
|
34
|
+
[0.18, 0.35, 0.025, 0.05],
|
|
35
|
+
[0, -0.37, 0, -0.05],
|
|
36
|
+
[0, 0.05, 0, 0.37]
|
|
37
|
+
].forEach(([t, y, r, u], n) => {
|
|
38
|
+
o.globalAlpha = (l + n) % 4 === 0 ? 0.65 : 0.12, o.beginPath(), o.moveTo(t * h, y * h), o.lineTo(r * h, u * h), o.stroke();
|
|
39
|
+
})), o.restore();
|
|
40
|
+
}
|
|
41
|
+
function B(s, l, e) {
|
|
42
|
+
const { p: o, width: h, size: p, ctx: f, accent: c } = s, b = h / p / 2;
|
|
43
|
+
d(s, e, {
|
|
44
|
+
alpha: l === 14 ? 0.78 : 0.9,
|
|
45
|
+
color: l === 14 ? c : void 0
|
|
46
|
+
});
|
|
47
|
+
for (let t = 0; t < (l === 20 ? 12 : 8); t++) {
|
|
48
|
+
const y = -0.54 + t * (l === 20 ? 0.09 : 0.135);
|
|
49
|
+
(l !== 20 || Math.floor(o * 12) > t) && S(
|
|
50
|
+
s,
|
|
51
|
+
-b,
|
|
52
|
+
y,
|
|
53
|
+
b * 2,
|
|
54
|
+
0.035,
|
|
55
|
+
() => d(s, e, { color: c, alpha: 0.55, glow: 0.09 })
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
S(
|
|
59
|
+
s,
|
|
60
|
+
-b,
|
|
61
|
+
-0.58 + o * 1.16,
|
|
62
|
+
b * 2,
|
|
63
|
+
0.05,
|
|
64
|
+
() => d(s, e, { color: c, glow: 0.2 })
|
|
65
|
+
), l === 19 && (f.save(), f.strokeStyle = c, f.globalAlpha *= 0.7 * W(o), f.lineWidth = 0.025 * p, f.beginPath(), f.arc(0, 0, 0.43 * p, 0, o * Math.PI * 2), f.stroke(), f.restore());
|
|
66
|
+
}
|
|
67
|
+
function X(s, l) {
|
|
68
|
+
const {
|
|
69
|
+
ctx: e,
|
|
70
|
+
p: o,
|
|
71
|
+
from: h,
|
|
72
|
+
to: p,
|
|
73
|
+
toIndex: f,
|
|
74
|
+
size: c,
|
|
75
|
+
width: b,
|
|
76
|
+
accent: t,
|
|
77
|
+
color: y,
|
|
78
|
+
seed: r,
|
|
79
|
+
strength: u
|
|
80
|
+
} = s, n = W(o) * u, w = o > 0.85 ? 1 : Math.floor(o * 28), T = Math.floor(k(r, w) * 10), P = o >= 0.84 ? p : I(s, T);
|
|
81
|
+
if (l <= 3) {
|
|
82
|
+
const x = o === 1 ? f : o < 0.24 ? s.fromIndex : o < 0.68 ? T : f;
|
|
83
|
+
if (l !== 2) q(s, x, l);
|
|
84
|
+
else {
|
|
85
|
+
e.save(), e.fillStyle = t;
|
|
86
|
+
for (const [g, i] of C(
|
|
87
|
+
I(s, x),
|
|
88
|
+
e.font,
|
|
89
|
+
c,
|
|
90
|
+
5
|
|
91
|
+
))
|
|
92
|
+
e.beginPath(), e.arc(g * c, i * c, c * 0.038, 0, Math.PI * 2), e.fill();
|
|
93
|
+
e.restore();
|
|
94
|
+
}
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if ([6, 7, 8, 9, 22, 23, 24, 25].includes(l)) {
|
|
98
|
+
const g = {
|
|
99
|
+
6: "0101ヲヌ",
|
|
100
|
+
7: "01",
|
|
101
|
+
8: "ABCDEF0123456789",
|
|
102
|
+
9: "#@?&XYZ",
|
|
103
|
+
22: "9876543210",
|
|
104
|
+
23: "01Zフォ",
|
|
105
|
+
24: ">_0123456789",
|
|
106
|
+
25: "_"
|
|
107
|
+
}[l], i = g[Math.floor(k(r + 6, w) * g.length)], M = o < (l === 24 ? 0.58 : 0.84) ? i : p;
|
|
108
|
+
(l === 23 || l === 22 || l === 6) && d(s, i, {
|
|
109
|
+
y: -0.5 + o * 0.55,
|
|
110
|
+
alpha: 0.35 * n,
|
|
111
|
+
color: t
|
|
112
|
+
}), d(s, M, {
|
|
113
|
+
color: t,
|
|
114
|
+
glow: 0.08 * n,
|
|
115
|
+
x: l === 22 ? -0.35 * (1 - o) : 0
|
|
116
|
+
}), l === 25 && w % 2 === 0 && d(s, "_", { x: 0.32, y: 0.04, alpha: n, color: t });
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
if ([5, 13, 14, 19, 20, 21, 26, 29].includes(l)) {
|
|
120
|
+
if (B(s, l, o < 0.28 ? h : p), l === 5 && d(s, p, {
|
|
121
|
+
y: -0.08 * n,
|
|
122
|
+
sx: 0.92,
|
|
123
|
+
alpha: 0.45 * n,
|
|
124
|
+
color: t,
|
|
125
|
+
glow: 0.13
|
|
126
|
+
}), l === 21 || l === 29) {
|
|
127
|
+
e.save(), e.fillStyle = t, e.globalAlpha *= 0.24 * n;
|
|
128
|
+
const x = b / c / 5;
|
|
129
|
+
for (let g = 0; g < 8; g++)
|
|
130
|
+
for (let i = 0; i < 5; i++) {
|
|
131
|
+
const M = l === 21 ? g / 8 + i * 0.025 < o : k(r + i, g) < o, z = l === 29 ? (k(r + g, i) - 0.5) * 0.7 * (1 - o) : 0, D = l === 29 ? (k(r + i + 9, g) - 0.5) * 0.8 * (1 - o) : 0;
|
|
132
|
+
M && e.fillRect(
|
|
133
|
+
((i - 2.5) * x + z) * c,
|
|
134
|
+
((g - 4) * 0.13 + D) * c,
|
|
135
|
+
x * c - 1,
|
|
136
|
+
0.13 * c - 1
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
e.restore();
|
|
140
|
+
}
|
|
141
|
+
l === 26 && (e.save(), e.strokeStyle = t, e.lineWidth = 0.018 * c, e.globalAlpha *= 0.6, e.strokeRect(-b * 0.5, -0.54 * c, b, 1.08 * c), e.restore());
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if ([10, 11, 12].includes(l)) {
|
|
145
|
+
d(s, P);
|
|
146
|
+
const x = (k(r, w) - 0.5) * n * 0.35;
|
|
147
|
+
if (l === 12)
|
|
148
|
+
d(s, P, { color: "#ff416b", x: -n * 0.09, alpha: 0.66 * n }), d(s, P, { color: "#04b7ff", x: n * 0.09, alpha: 0.7 * n });
|
|
149
|
+
else {
|
|
150
|
+
const g = b / c;
|
|
151
|
+
for (let i = 0; i < 4; i++)
|
|
152
|
+
S(s, -g, -0.46 + i * 0.24, g * 2, 0.1, () => {
|
|
153
|
+
d(s, l === 10 ? P : p, {
|
|
154
|
+
color: t,
|
|
155
|
+
alpha: 0.75 * n,
|
|
156
|
+
x: x * (i % 2 ? 1 : -1)
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
(l === 28 || l === 16) && E(s, R(f), _(o), {
|
|
163
|
+
color: t,
|
|
164
|
+
alpha: 0.8 * n,
|
|
165
|
+
width: l === 28 ? 0.023 : 0.036
|
|
166
|
+
});
|
|
167
|
+
const A = l === 17 ? o : l === 18 ? 1 - o : n;
|
|
168
|
+
d(s, h, { alpha: (1 - o) ** 3 }), d(s, p, {
|
|
169
|
+
alpha: 0.4 + 0.6 * o,
|
|
170
|
+
color: l === 4 ? t : y,
|
|
171
|
+
glow: (l === 4 ? 0.18 : 0.28 * A) * u
|
|
172
|
+
}), [15, 17, 18, 27].includes(l) && (e.save(), e.strokeStyle = t, e.globalAlpha *= 0.65 * n, e.lineWidth = 0.021 * c, e.beginPath(), e.ellipse(
|
|
173
|
+
0,
|
|
174
|
+
0,
|
|
175
|
+
(0.25 + 0.23 * A) * c,
|
|
176
|
+
(0.37 + 0.25 * A) * c,
|
|
177
|
+
0,
|
|
178
|
+
0,
|
|
179
|
+
Math.PI * 2 * (l === 27 ? 1 : A)
|
|
180
|
+
), e.stroke(), e.restore());
|
|
181
|
+
}
|
|
182
|
+
const Y = (s) => [0, 1, 2, 3, 4, 14, 26].includes(s);
|
|
183
|
+
export {
|
|
184
|
+
X as paintDigital,
|
|
185
|
+
Y as persistentDisplay
|
|
186
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { mix as d, noise as I, glyph as i, clamp as P, smooth as B, wave as z } from "./paint.js";
|
|
2
|
+
import { digitPath as _, tracePath as x } from "./paths.js";
|
|
3
|
+
function E(c, n) {
|
|
4
|
+
const { fromIndex: j, toIndex: k, from: g, to: w, p: o, strength: q, ctx: p, size: m, seed: y } = c, h = [8, 9, 16].includes(n) ? B(o) : o, t = z(h) * q, A = _(j), b = _(k), a = A.map(([u, M], r) => {
|
|
5
|
+
const s = d(u, b[r][0], h), e = d(M, b[r][1], h), f = I(y, r) - 0.5;
|
|
6
|
+
switch (n) {
|
|
7
|
+
case 3:
|
|
8
|
+
return [s + f * t * 0.25, e + (r % 3 - 1) * t * 0.1];
|
|
9
|
+
case 4:
|
|
10
|
+
return [s * (1 - t * 0.75), e];
|
|
11
|
+
case 5:
|
|
12
|
+
return [
|
|
13
|
+
s + Math.sin(e * 10 - h * 8) * 0.17 * t,
|
|
14
|
+
e + Math.cos(s * 8 + h * 6) * 0.12 * t
|
|
15
|
+
];
|
|
16
|
+
case 6:
|
|
17
|
+
return [
|
|
18
|
+
s * (1 + t * 0.45),
|
|
19
|
+
e * (1 - t * 0.3) + Math.sin(r * 0.5) * 0.055 * t
|
|
20
|
+
];
|
|
21
|
+
case 7:
|
|
22
|
+
return [s * (1 + t * 0.25), e + (e + 0.4) ** 2 * t * 0.52];
|
|
23
|
+
case 8:
|
|
24
|
+
return [s * (1 - t * 0.22), e * (1 + t * 0.55)];
|
|
25
|
+
case 9:
|
|
26
|
+
return [s * (1 + t * 0.43), e * (1 - t * 0.52)];
|
|
27
|
+
case 10:
|
|
28
|
+
return [s + Math.sin(e * 6) * 0.36 * t, e - s * 0.2 * t];
|
|
29
|
+
case 11:
|
|
30
|
+
return [
|
|
31
|
+
s * Math.cos(t) - e * Math.sin(t),
|
|
32
|
+
s * Math.sin(t) + e * Math.cos(t)
|
|
33
|
+
];
|
|
34
|
+
case 12:
|
|
35
|
+
return [
|
|
36
|
+
s + 0.8 * f * t,
|
|
37
|
+
e + 0.5 * (I(y + 1, r) - 0.5) * t
|
|
38
|
+
];
|
|
39
|
+
case 13:
|
|
40
|
+
return [
|
|
41
|
+
d(s, Math.round(s * 4) / 4, t),
|
|
42
|
+
d(e, Math.round(e * 4) / 4, t)
|
|
43
|
+
];
|
|
44
|
+
case 14:
|
|
45
|
+
return [s + 0.06 * (r % 2 ? -1 : 1) * t, e];
|
|
46
|
+
case 15:
|
|
47
|
+
return [
|
|
48
|
+
s + e ** 2 * t * 0.85,
|
|
49
|
+
e + Math.sin(s * 10) * 0.1 * t
|
|
50
|
+
];
|
|
51
|
+
case 16:
|
|
52
|
+
return [
|
|
53
|
+
s + Math.sin(r * 0.24) * t * 0.035,
|
|
54
|
+
e + Math.cos(r * 0.24) * t * 0.035
|
|
55
|
+
];
|
|
56
|
+
case 17:
|
|
57
|
+
return [s + Math.sign(s) * t * 0.26, e];
|
|
58
|
+
case 19:
|
|
59
|
+
return [
|
|
60
|
+
s + Math.sin(r / 3 - h * 15) * 0.08 * t,
|
|
61
|
+
e + Math.cos(r / 3 - h * 15) * 0.08 * t
|
|
62
|
+
];
|
|
63
|
+
default:
|
|
64
|
+
return [s, e];
|
|
65
|
+
}
|
|
66
|
+
}), l = Math.min(1, z(o) * 4);
|
|
67
|
+
if (i(c, g, { alpha: P(1 - o * 5) }), i(c, w, { alpha: P((o - 0.8) * 5) }), n === 12 || n === 3) {
|
|
68
|
+
for (let u = 0; u < a.length - 2; u += 3)
|
|
69
|
+
x(c, a.slice(u, u + 3), 1, {
|
|
70
|
+
alpha: l,
|
|
71
|
+
width: 0.065
|
|
72
|
+
});
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (n === 18) {
|
|
76
|
+
i(c, g, {
|
|
77
|
+
alpha: (1 - o) * l,
|
|
78
|
+
sx: 1 + t * 0.15,
|
|
79
|
+
color: c.accent,
|
|
80
|
+
blur: 0.035 * t
|
|
81
|
+
}), i(c, w, {
|
|
82
|
+
alpha: o * l,
|
|
83
|
+
sy: 1 - t * 0.25,
|
|
84
|
+
blur: 0.025 * t
|
|
85
|
+
});
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
if (n === 2 || n === 19) {
|
|
89
|
+
p.save(), p.translate(0.035 * m, 0), x(c, a, 1, {
|
|
90
|
+
alpha: l,
|
|
91
|
+
width: 0.035,
|
|
92
|
+
color: c.accent,
|
|
93
|
+
smooth: !0
|
|
94
|
+
}), p.translate(-0.07 * m, 0), x(c, a, 1, { alpha: l, width: 0.035, smooth: !0 }), p.restore();
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
x(
|
|
98
|
+
c,
|
|
99
|
+
n === 14 ? a.filter((u, M) => M % 4 === 0 || M === a.length - 1) : a,
|
|
100
|
+
1,
|
|
101
|
+
{
|
|
102
|
+
alpha: l,
|
|
103
|
+
width: n === 4 ? 0.035 : n === 6 ? 0.18 : n === 1 ? 0.075 : 0.11,
|
|
104
|
+
smooth: ![1, 13, 14].includes(n)
|
|
105
|
+
}
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
export {
|
|
109
|
+
E as paintMorph
|
|
110
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const s = (t) => Math.min(1, Math.max(0, t)), M = (t, l, n) => t + (l - t) * n, p = (t) => Math.sin(Math.PI * s(t)), y = (t) => s(t) ** 2 * (3 - 2 * s(t)), b = (t, l) => ((Math.imul(l + 13, 2246822507) ^ Math.imul(t + 37, 3266489909)) >>> 0) / 4294967296;
|
|
2
|
+
function d(t, l, n = {}) {
|
|
3
|
+
const { ctx: o, color: r, size: a } = t, {
|
|
4
|
+
x: e = 0,
|
|
5
|
+
y: i = 0,
|
|
6
|
+
sx: c = 1,
|
|
7
|
+
sy: h = 1,
|
|
8
|
+
angle: u = 0,
|
|
9
|
+
alpha: x = 1,
|
|
10
|
+
blur: f = 0,
|
|
11
|
+
stroke: g = 0,
|
|
12
|
+
glow: m = 0
|
|
13
|
+
} = n;
|
|
14
|
+
!l || x <= 0 || c <= 0 || h <= 0 || (o.save(), o.globalAlpha *= s(x), o.translate(e * a, i * a), u && o.rotate(u), o.scale(c, h), o.fillStyle = o.strokeStyle = n.color ?? r, f && (o.filter = `blur(${a * f}px)`), m && (o.shadowBlur = a * m, o.shadowColor = n.color ?? r), g ? (o.lineJoin = "round", o.lineWidth = a * g, o.strokeText(l, 0, 0)) : o.fillText(l, 0, 0), o.restore());
|
|
15
|
+
}
|
|
16
|
+
function w(t, l, n, o, r, a) {
|
|
17
|
+
const { ctx: e, size: i } = t;
|
|
18
|
+
e.save(), e.beginPath(), e.rect(l * i, n * i, Math.max(0, o) * i, Math.max(0, r) * i), e.clip(), a(), e.restore();
|
|
19
|
+
}
|
|
20
|
+
function k(t, l, n, o) {
|
|
21
|
+
return s((t - l / Math.max(1, n - 1) * o) / (1 - o));
|
|
22
|
+
}
|
|
23
|
+
const v = (t, l) => t.glyphs[(l % 10 + 10) % 10] ?? t.digit;
|
|
24
|
+
export {
|
|
25
|
+
s as clamp,
|
|
26
|
+
d as glyph,
|
|
27
|
+
k as localProgress,
|
|
28
|
+
M as mix,
|
|
29
|
+
b as noise,
|
|
30
|
+
w as rectangle,
|
|
31
|
+
v as rollingGlyph,
|
|
32
|
+
y as smooth,
|
|
33
|
+
p as wave
|
|
34
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { glyph as S, clamp as P, mix as q, wave as D, noise as I, smooth as H } from "./paint.js";
|
|
2
|
+
const u = /* @__PURE__ */ new Map();
|
|
3
|
+
function E(i, t, d, p = 3) {
|
|
4
|
+
const o = t.replace(/\d+(?:\.\d+)?px/, "40px"), s = `${i}/${o}/${p}`, x = u.get(s);
|
|
5
|
+
if (x) return x;
|
|
6
|
+
const c = document.createElement("canvas");
|
|
7
|
+
c.width = c.height = 60;
|
|
8
|
+
const e = c.getContext("2d", { willReadFrequently: !0 });
|
|
9
|
+
if (!e || !d) return [];
|
|
10
|
+
e.font = o, e.textAlign = "center", e.textBaseline = "middle", e.fillText(i, 30, 30);
|
|
11
|
+
const f = e.getImageData(0, 0, 60, 60).data, a = [];
|
|
12
|
+
for (let g = 2; g < 59; g += p)
|
|
13
|
+
for (let n = 2; n < 59; n += p)
|
|
14
|
+
f[(g * 60 + n) * 4 + 3] > 110 && a.push([(n - 30) / 40, (g - 30) / 40]);
|
|
15
|
+
return u.size >= 128 && u.delete(u.keys().next().value), u.set(s, a), a;
|
|
16
|
+
}
|
|
17
|
+
function K(i, t) {
|
|
18
|
+
const { from: d, to: p, p: o, size: s, strength: x, seed: c, ctx: e, accent: f, color: a } = i, n = ![1, 4, 6, 9, 14, 18, 19].includes(t), T = n ? o : 1 - o, h = (1 - H(T)) * x, W = n ? p : d, m = [3, 4, 5, 6, 7].includes(t), z = [10, 11, 12, 13, 14, 15].includes(t), A = [16, 17, 18, 19].includes(t);
|
|
19
|
+
S(i, d, {
|
|
20
|
+
alpha: n ? (1 - o) ** 4 : P(1 - o * 5),
|
|
21
|
+
blur: t === 10 ? 0.07 : 0
|
|
22
|
+
}), S(i, p, { alpha: n ? P((o - 0.63) / 0.37) : o ** 3 });
|
|
23
|
+
const $ = E(
|
|
24
|
+
W,
|
|
25
|
+
e.font,
|
|
26
|
+
s,
|
|
27
|
+
t === 5 ? 7 : m ? 5 : 3
|
|
28
|
+
), j = P(D(o) * 2.5), B = [2, 5, 15].includes(t) ? E(d, e.font, s, m ? 5 : 3) : [];
|
|
29
|
+
for (let l = 0; l < $.length; l++) {
|
|
30
|
+
const [w, k] = $[l], b = I(c + t * 31, l) * 2 * Math.PI, C = 0.28 + I(c + 79, l) * 0.73, G = t === 9 ? 0.94 * o ** 2 : t === 8 ? -0.62 * h : 0, y = z ? Math.sin(w * 11 + k * 4 + o * 8) * h * 0.28 : 0, M = B[l % B.length], F = M ? q(M[0], w, o) + y : w + Math.cos(b) * C * h * (t === 19 ? 1.8 : 1) + y, R = M ? q(M[1], k, o) - y : k + Math.sin(b) * C * h + G - y, r = m ? t === 5 ? 0.09 : 0.057 : z ? 0.034 + 0.025 * h : 0.02 + I(c + 11, l) * 0.024;
|
|
31
|
+
e.save(), e.globalAlpha *= j * (t === 17 ? 0.55 + 0.45 * Math.sin(o * 16 + l) ** 2 : 1), e.fillStyle = A || l % 6 === 0 ? f : a, A && (e.shadowColor = f, e.shadowBlur = s * 0.11), m ? (e.translate(F * s, R * s), (t === 6 || t === 7) && e.rotate(b * h), e.fillRect(-r * s / 2, -r * s / 2, r * s, r * s)) : (e.beginPath(), e.ellipse(
|
|
32
|
+
F * s,
|
|
33
|
+
R * s,
|
|
34
|
+
r * s,
|
|
35
|
+
r * s * (t === 13 ? 2 : 1),
|
|
36
|
+
0,
|
|
37
|
+
0,
|
|
38
|
+
Math.PI * 2
|
|
39
|
+
), e.fill()), e.restore();
|
|
40
|
+
}
|
|
41
|
+
if (t === 11 || t === 19) {
|
|
42
|
+
e.save(), e.strokeStyle = f, e.globalAlpha *= 0.5 * D(o), e.lineWidth = 0.018 * s;
|
|
43
|
+
for (let l = 0; l < (t === 11 ? 3 : 1); l++)
|
|
44
|
+
e.beginPath(), e.arc(0, 0, (0.1 + o * (0.63 + l * 0.21)) * s, 0, Math.PI * 2), e.stroke();
|
|
45
|
+
e.restore();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
E as glyphMask,
|
|
50
|
+
K as paintParticles
|
|
51
|
+
};
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { clamp as g, mix as u } from "./paint.js";
|
|
2
|
+
const d = [
|
|
3
|
+
[
|
|
4
|
+
[0, -0.39],
|
|
5
|
+
[0.18, -0.35],
|
|
6
|
+
[0.25, -0.18],
|
|
7
|
+
[0.25, 0.2],
|
|
8
|
+
[0.16, 0.38],
|
|
9
|
+
[0, 0.42],
|
|
10
|
+
[-0.18, 0.36],
|
|
11
|
+
[-0.25, 0.17],
|
|
12
|
+
[-0.25, -0.19],
|
|
13
|
+
[-0.16, -0.35],
|
|
14
|
+
[0, -0.39]
|
|
15
|
+
],
|
|
16
|
+
[
|
|
17
|
+
[-0.17, -0.25],
|
|
18
|
+
[0.04, -0.39],
|
|
19
|
+
[0.04, 0.39],
|
|
20
|
+
[-0.19, 0.39],
|
|
21
|
+
[0.23, 0.39]
|
|
22
|
+
],
|
|
23
|
+
[
|
|
24
|
+
[-0.22, -0.24],
|
|
25
|
+
[-0.14, -0.36],
|
|
26
|
+
[0.04, -0.39],
|
|
27
|
+
[0.22, -0.3],
|
|
28
|
+
[0.23, -0.16],
|
|
29
|
+
[0.12, -0.01],
|
|
30
|
+
[-0.22, 0.33],
|
|
31
|
+
[-0.23, 0.39],
|
|
32
|
+
[0.24, 0.39]
|
|
33
|
+
],
|
|
34
|
+
[
|
|
35
|
+
[-0.22, -0.33],
|
|
36
|
+
[0.06, -0.39],
|
|
37
|
+
[0.23, -0.29],
|
|
38
|
+
[0.22, -0.15],
|
|
39
|
+
[0.05, -0.02],
|
|
40
|
+
[-0.05, 0],
|
|
41
|
+
[0.17, 0.03],
|
|
42
|
+
[0.25, 0.16],
|
|
43
|
+
[0.22, 0.32],
|
|
44
|
+
[0.05, 0.41],
|
|
45
|
+
[-0.18, 0.36],
|
|
46
|
+
[-0.25, 0.27]
|
|
47
|
+
],
|
|
48
|
+
[
|
|
49
|
+
[0.16, 0.41],
|
|
50
|
+
[0.16, -0.39],
|
|
51
|
+
[-0.26, 0.15],
|
|
52
|
+
[0.27, 0.15]
|
|
53
|
+
],
|
|
54
|
+
[
|
|
55
|
+
[0.23, -0.39],
|
|
56
|
+
[-0.2, -0.39],
|
|
57
|
+
[-0.22, -0.02],
|
|
58
|
+
[0.04, -0.06],
|
|
59
|
+
[0.21, 0.03],
|
|
60
|
+
[0.25, 0.2],
|
|
61
|
+
[0.19, 0.36],
|
|
62
|
+
[0, 0.42],
|
|
63
|
+
[-0.2, 0.34],
|
|
64
|
+
[-0.24, 0.23]
|
|
65
|
+
],
|
|
66
|
+
[
|
|
67
|
+
[0.21, -0.37],
|
|
68
|
+
[0.01, -0.4],
|
|
69
|
+
[-0.17, -0.25],
|
|
70
|
+
[-0.24, -0.02],
|
|
71
|
+
[-0.24, 0.24],
|
|
72
|
+
[-0.13, 0.38],
|
|
73
|
+
[0.04, 0.42],
|
|
74
|
+
[0.21, 0.32],
|
|
75
|
+
[0.24, 0.16],
|
|
76
|
+
[0.16, 0.01],
|
|
77
|
+
[-0.02, -0.05],
|
|
78
|
+
[-0.23, 0.05]
|
|
79
|
+
],
|
|
80
|
+
[
|
|
81
|
+
[-0.25, -0.39],
|
|
82
|
+
[0.25, -0.39],
|
|
83
|
+
[0.09, -0.14],
|
|
84
|
+
[-0.03, 0.12],
|
|
85
|
+
[-0.11, 0.41]
|
|
86
|
+
],
|
|
87
|
+
[
|
|
88
|
+
[0, -0.02],
|
|
89
|
+
[-0.21, -0.16],
|
|
90
|
+
[-0.21, -0.29],
|
|
91
|
+
[-0.06, -0.39],
|
|
92
|
+
[0.12, -0.37],
|
|
93
|
+
[0.23, -0.24],
|
|
94
|
+
[0.16, -0.1],
|
|
95
|
+
[0, -0.02],
|
|
96
|
+
[-0.2, 0.09],
|
|
97
|
+
[-0.25, 0.26],
|
|
98
|
+
[-0.12, 0.39],
|
|
99
|
+
[0.1, 0.4],
|
|
100
|
+
[0.24, 0.29],
|
|
101
|
+
[0.24, 0.13],
|
|
102
|
+
[0, -0.02]
|
|
103
|
+
],
|
|
104
|
+
[
|
|
105
|
+
[0.24, -0.06],
|
|
106
|
+
[0.13, 0.05],
|
|
107
|
+
[-0.06, 0.05],
|
|
108
|
+
[-0.22, -0.04],
|
|
109
|
+
[-0.24, -0.22],
|
|
110
|
+
[-0.15, -0.36],
|
|
111
|
+
[0.04, -0.4],
|
|
112
|
+
[0.2, -0.31],
|
|
113
|
+
[0.24, -0.13],
|
|
114
|
+
[0.22, 0.15],
|
|
115
|
+
[0.11, 0.35],
|
|
116
|
+
[-0.08, 0.42],
|
|
117
|
+
[-0.2, 0.34]
|
|
118
|
+
]
|
|
119
|
+
];
|
|
120
|
+
function x(n) {
|
|
121
|
+
const l = [0];
|
|
122
|
+
for (let t = 1; t < n.length; t++)
|
|
123
|
+
l.push(
|
|
124
|
+
l[t - 1] + Math.hypot(n[t][0] - n[t - 1][0], n[t][1] - n[t - 1][1])
|
|
125
|
+
);
|
|
126
|
+
let r = 1;
|
|
127
|
+
return Array.from({ length: 35 }, (t, e) => {
|
|
128
|
+
const c = l[l.length - 1] * e / 34;
|
|
129
|
+
for (; c > l[r] && r < n.length - 1; ) r++;
|
|
130
|
+
const i = (c - l[r - 1]) / (l[r] - l[r - 1]);
|
|
131
|
+
return [
|
|
132
|
+
u(n[r - 1][0], n[r][0], i),
|
|
133
|
+
u(n[r - 1][1], n[r][1], i)
|
|
134
|
+
];
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
const m = d.map(x);
|
|
138
|
+
function P(n) {
|
|
139
|
+
return m[n] ?? m[0];
|
|
140
|
+
}
|
|
141
|
+
function v(n, l, r = 1, t = {}) {
|
|
142
|
+
if (r <= 0) return;
|
|
143
|
+
const { ctx: e, size: c, color: i } = n, h = Math.min(
|
|
144
|
+
l.length,
|
|
145
|
+
Math.ceil(g(r) * (l.length - 1)) + 1
|
|
146
|
+
);
|
|
147
|
+
e.save(), e.strokeStyle = e.fillStyle = t.color ?? i, e.lineWidth = (t.width ?? 0.11) * c, e.lineCap = e.lineJoin = "round", e.globalAlpha *= t.alpha ?? 1, e.beginPath(), e.moveTo(l[0][0] * c, l[0][1] * c);
|
|
148
|
+
for (let o = 1; o < h; o++) {
|
|
149
|
+
const [a, f] = l[o];
|
|
150
|
+
if (t.smooth && o + 1 < h) {
|
|
151
|
+
const s = l[o + 1];
|
|
152
|
+
e.quadraticCurveTo(
|
|
153
|
+
a * c,
|
|
154
|
+
f * c,
|
|
155
|
+
(a + s[0]) * c / 2,
|
|
156
|
+
(f + s[1]) * c / 2
|
|
157
|
+
);
|
|
158
|
+
} else e.lineTo(a * c, f * c);
|
|
159
|
+
}
|
|
160
|
+
t.close && e.closePath(), t.fill ? e.fill() : e.stroke(), e.restore();
|
|
161
|
+
}
|
|
162
|
+
export {
|
|
163
|
+
P as digitPath,
|
|
164
|
+
v as tracePath
|
|
165
|
+
};
|