@johnmorrisdotca/dougu-sports 0.1.0 → 0.2.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 +38 -1
- package/NOTICE.md +9 -58
- package/README.md +168 -32
- package/dist/emblems/award/badge.d.ts +2 -2
- package/dist/emblems/award/badge.js +14 -5
- package/dist/emblems/award/crown.d.ts +1 -1
- package/dist/emblems/award/crown.js +14 -4
- package/dist/emblems/award/medal.d.ts +2 -2
- package/dist/emblems/award/medal.js +14 -5
- package/dist/emblems/award/shield.d.ts +1 -1
- package/dist/emblems/award/shield.js +10 -4
- package/dist/emblems/award/star.d.ts +1 -1
- package/dist/emblems/award/star.js +10 -4
- package/dist/emblems/ball/ball.afl.js +1 -1
- package/dist/emblems/ball/ball.basketball6.js +1 -1
- package/dist/emblems/ball/ball.core.d.ts +9 -3
- package/dist/emblems/ball/ball.core.js +13 -0
- package/dist/emblems/ball/ball.cricket.js +1 -1
- package/dist/emblems/ball/ball.engine.js +3 -3
- package/dist/emblems/ball/ball.football.js +3 -3
- package/dist/emblems/ball/ball.gaelic.js +1 -1
- package/dist/emblems/ball/ball.object.js +2 -2
- package/dist/emblems/ball/ball.shuttlecock.js +2 -2
- package/dist/emblems/ball/ball.squash.js +5 -5
- package/dist/emblems/emblem.api.d.ts +39 -1
- package/dist/emblems/emblem.api.js +20 -2
- package/dist/emblems/emblem.compose.d.ts +31 -0
- package/dist/emblems/emblem.compose.js +91 -0
- package/dist/emblems/emblem.core.d.ts +48 -2
- package/dist/emblems/emblem.core.js +30 -0
- package/dist/emblems/emblem.descriptions.d.ts +7 -0
- package/dist/emblems/emblem.descriptions.js +60 -0
- package/dist/emblems/emblem.display.d.ts +75 -0
- package/dist/emblems/emblem.display.js +214 -0
- package/dist/emblems/emblem.engrave.d.ts +50 -0
- package/dist/emblems/emblem.engrave.js +145 -0
- package/dist/emblems/emblem.equipment.d.ts +24 -0
- package/dist/emblems/emblem.equipment.js +57 -0
- package/dist/emblems/emblem.flip.d.ts +10 -0
- package/dist/emblems/emblem.flip.js +45 -0
- package/dist/emblems/emblem.ids.d.ts +19 -11
- package/dist/emblems/emblem.ids.js +21 -6
- package/dist/emblems/emblem.lathe.d.ts +3 -0
- package/dist/emblems/emblem.lathe.js +26 -4
- package/dist/emblems/emblem.medal.js +4 -4
- package/dist/emblems/emblem.pennant.d.ts +3 -0
- package/dist/emblems/emblem.pennant.js +79 -0
- package/dist/emblems/emblem.registry.js +20 -0
- package/dist/emblems/emblem.shapes.d.ts +19 -2
- package/dist/emblems/emblem.shapes.js +53 -12
- package/dist/emblems/emblem.sprite.d.ts +38 -0
- package/dist/emblems/emblem.sprite.js +65 -0
- package/dist/emblems/emblem.uri.d.ts +22 -0
- package/dist/emblems/emblem.uri.js +29 -0
- package/dist/emblems/gear/gear.badmintonracket.d.ts +1 -1
- package/dist/emblems/gear/gear.badmintonracket.js +18 -14
- package/dist/emblems/gear/gear.baseballglove.d.ts +1 -1
- package/dist/emblems/gear/gear.baseballglove.js +20 -14
- package/dist/emblems/gear/gear.budo.d.ts +17 -0
- package/dist/emblems/gear/gear.budo.js +60 -0
- package/dist/emblems/gear/gear.core.d.ts +12 -31
- package/dist/emblems/gear/gear.core.js +61 -54
- package/dist/emblems/gear/gear.cricketbat.d.ts +1 -1
- package/dist/emblems/gear/gear.cricketbat.js +16 -14
- package/dist/emblems/gear/gear.fieldhockeystick.d.ts +1 -1
- package/dist/emblems/gear/gear.fieldhockeystick.js +15 -14
- package/dist/emblems/gear/gear.footballhelmet.d.ts +1 -1
- package/dist/emblems/gear/gear.footballhelmet.js +15 -14
- package/dist/emblems/gear/gear.goaliemask.d.ts +1 -1
- package/dist/emblems/gear/gear.goaliemask.js +22 -16
- package/dist/emblems/gear/gear.goalnet.d.ts +1 -1
- package/dist/emblems/gear/gear.goalnet.js +24 -14
- package/dist/emblems/gear/gear.hockeystick.d.ts +1 -1
- package/dist/emblems/gear/gear.hockeystick.js +14 -14
- package/dist/emblems/gear/gear.index.js +5 -1
- package/dist/emblems/gear/gear.kendo.d.ts +2 -0
- package/dist/emblems/gear/gear.kendo.js +41 -0
- package/dist/emblems/gear/gear.kyudo.d.ts +2 -0
- package/dist/emblems/gear/gear.kyudo.js +31 -0
- package/dist/emblems/gear/gear.lacrossestick.d.ts +1 -1
- package/dist/emblems/gear/gear.lacrossestick.js +25 -14
- package/dist/emblems/gear/gear.skates.js +1 -1
- package/dist/emblems/gear/gear.sticks.js +2 -2
- package/dist/emblems/gear/gear.sumo.d.ts +2 -0
- package/dist/emblems/gear/gear.sumo.js +43 -0
- package/dist/emblems/gear/gear.tabletennispaddle.d.ts +1 -1
- package/dist/emblems/gear/gear.tabletennispaddle.js +15 -14
- package/dist/emblems/gear/gear.tennisracket.d.ts +1 -1
- package/dist/emblems/gear/gear.tennisracket.js +16 -14
- package/dist/emblems/pennant/championship.d.ts +2 -0
- package/dist/emblems/pennant/championship.js +4 -0
- package/dist/emblems/sport/afl.js +1 -1
- package/dist/emblems/sport/artisticswimming.js +1 -1
- package/dist/emblems/sport/cfl.d.ts +1 -1
- package/dist/emblems/sport/cfl.js +4 -4
- package/dist/emblems/sport/cricket.d.ts +1 -1
- package/dist/emblems/sport/cricket.js +13 -4
- package/dist/emblems/sport/fieldhockey.js +1 -1
- package/dist/emblems/sport/gaelic.js +1 -1
- package/dist/emblems/sport/handball.d.ts +1 -1
- package/dist/emblems/sport/handball.js +14 -4
- package/dist/emblems/sport/ifaf.d.ts +1 -1
- package/dist/emblems/sport/ifaf.js +4 -4
- package/dist/emblems/sport/judo.d.ts +2 -0
- package/dist/emblems/sport/judo.js +13 -0
- package/dist/emblems/sport/karate.d.ts +2 -0
- package/dist/emblems/sport/karate.js +13 -0
- package/dist/emblems/sport/kendo.d.ts +2 -0
- package/dist/emblems/sport/kendo.js +14 -0
- package/dist/emblems/sport/kyudo.d.ts +2 -0
- package/dist/emblems/sport/kyudo.js +15 -0
- package/dist/emblems/sport/mlb.d.ts +1 -1
- package/dist/emblems/sport/mlb.js +27 -4
- package/dist/emblems/sport/nba.d.ts +1 -1
- package/dist/emblems/sport/nba.js +11 -4
- package/dist/emblems/sport/netball.js +1 -1
- package/dist/emblems/sport/nfl.d.ts +2 -1
- package/dist/emblems/sport/nfl.js +14 -4
- package/dist/emblems/sport/nhl.d.ts +1 -1
- package/dist/emblems/sport/nhl.js +12 -4
- package/dist/emblems/sport/pickleball.js +1 -1
- package/dist/emblems/sport/racquetball.js +1 -1
- package/dist/emblems/sport/roundnet.js +1 -1
- package/dist/emblems/sport/rugby.d.ts +1 -1
- package/dist/emblems/sport/rugby.js +11 -4
- package/dist/emblems/sport/sepaktakraw.js +1 -1
- package/dist/emblems/sport/soccer.d.ts +1 -1
- package/dist/emblems/sport/soccer.js +30 -4
- package/dist/emblems/sport/squash.js +1 -1
- package/dist/emblems/sport/sumo.d.ts +2 -0
- package/dist/emblems/sport/sumo.js +15 -0
- package/dist/emblems/sport/tabletennis.js +1 -1
- package/dist/emblems/sport/tennis.d.ts +1 -1
- package/dist/emblems/sport/tennis.js +14 -4
- package/dist/emblems/sport/teqball.js +1 -1
- package/dist/emblems/sport/volleyball.d.ts +1 -1
- package/dist/emblems/sport/volleyball.js +24 -4
- package/dist/emblems/trophy/banner.d.ts +2 -0
- package/dist/emblems/trophy/banner.js +20 -0
- package/dist/emblems/trophy/baseball.js +1 -0
- package/dist/emblems/trophy/basketball.js +1 -0
- package/dist/emblems/trophy/belt.js +2 -1
- package/dist/emblems/trophy/bowl.js +1 -0
- package/dist/emblems/trophy/canadian-bowl.js +1 -0
- package/dist/emblems/trophy/championship-banner.d.ts +2 -0
- package/dist/emblems/trophy/championship-banner.js +67 -0
- package/dist/emblems/trophy/cricket-urn.js +1 -0
- package/dist/emblems/trophy/cup.d.ts +1 -1
- package/dist/emblems/trophy/cup.js +15 -4
- package/dist/emblems/trophy/football.js +2 -1
- package/dist/emblems/trophy/globe.js +1 -0
- package/dist/emblems/trophy/hockey-cup.js +2 -1
- package/dist/emblems/trophy/lidded-cup.js +1 -0
- package/dist/emblems/trophy/plaque.js +2 -1
- package/dist/emblems/trophy/ring.d.ts +2 -0
- package/dist/emblems/trophy/ring.js +30 -0
- package/dist/emblems/trophy/rugby-cup.js +1 -0
- package/dist/emblems/trophy/salver.js +1 -0
- package/dist/emblems/trophy/soccer-ball.js +2 -1
- package/dist/emblems/trophy/soccer-globe.js +1 -0
- package/dist/emblems/trophy/sumo-cup.d.ts +2 -0
- package/dist/emblems/trophy/sumo-cup.js +28 -0
- package/dist/emblems/trophy/tennis-cup.js +2 -1
- package/dist/emblems/trophy/tennis-plate.js +1 -0
- package/dist/emblems-entry.d.ts +15 -6
- package/dist/emblems-entry.js +7 -2
- package/dist/index.d.ts +17 -0
- package/dist/index.js +15 -0
- package/dist/turn-control.d.ts +101 -0
- package/dist/turn-control.js +363 -0
- package/dist/turn-entry.d.ts +2 -0
- package/dist/turn-entry.js +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +7 -1
- package/LICENSES/Apache-2.0.txt +0 -202
- package/LICENSES/CC-BY-3.0.txt +0 -319
- package/LICENSES/upstream/game-icons.license.txt +0 -45
- package/LICENSES/upstream/noto-emoji-2D-svg.LICENSE +0 -13
- package/LICENSES/upstream/pictogrammers-mdi.LICENSE +0 -20
- package/dist/emblems/emblem.material.d.ts +0 -9
- package/dist/emblems/emblem.material.data.d.ts +0 -34
- package/dist/emblems/emblem.material.data.js +0 -85
- package/dist/emblems/emblem.material.js +0 -23
|
@@ -1,27 +1,35 @@
|
|
|
1
|
-
// Gear: pieces of equipment drawn flat
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
// Gear: pieces of equipment drawn flat from a list of parts (a path, a colour, how it reads as a line), in the same three styles as the trophies: `metal` (a fill shaded across and along, edged in a darker tone
|
|
2
|
+
// of itself), `color` (flat fills with the same edges) and `line` (`currentColor`). A piece turns like a coin through the one turn every flat drawing shares (emblem.flip.ts): squeezed by the cosine of the yaw,
|
|
3
|
+
// its back mirrored, with a thin rim. Self-contained: it imports only the shared option and colour helpers of the ball folder and the coin-flip turn.
|
|
4
|
+
import { flipSvg } from "../emblem.flip.js";
|
|
5
|
+
import { escape, hashOf, labelled, mix, num, readColour, resolveOptions, wrapPiece } from "../ball/ball.core.js";
|
|
6
|
+
/** A turn in degrees, as a finite number (0 for anything else). */
|
|
7
|
+
const turn = (value) => (typeof value === "number" && Number.isFinite(value) ? value % 360 : 0);
|
|
8
|
+
/** A piece of gear turned like a coin: a flat cut-out with a front, a mirrored back and a thin rim. */
|
|
9
|
+
const flip = (draw) => (o) => flipSvg(draw(o), { yaw: turn(o?.yaw), pitch: turn(o?.pitch), line: o?.style === "line", thick: 0.025 });
|
|
10
|
+
/** A piece of gear from its drawing function. Turned, it flips like a coin (`flipSvg`): the front, then its mirrored back, with a thin rim. */
|
|
6
11
|
export function defineGear(def) {
|
|
7
|
-
return { id: def.id, en: def.en, ja: def.ja, source: def.source, kind: "gear", model: def.model, size: def.size, svg: (o) => def.draw(o), frame: (
|
|
12
|
+
return { id: def.id, en: def.en, ja: def.ja, source: def.source, kind: "gear", model: def.model, size: def.size, svg: labelled(def.en, def.ja, (o) => def.draw(o)), frame: labelled(def.en, def.ja, flip(def.draw)) };
|
|
8
13
|
}
|
|
9
|
-
/** A drawn piece: its parts become a document in
|
|
14
|
+
/** A drawn piece: its parts become a document in the metal, color or line style, whole or turned (the turn is `flipSvg`'s). */
|
|
10
15
|
export function drawGear(id, title, spec, options) {
|
|
11
16
|
const o = resolveOptions(options);
|
|
12
17
|
const line = o.style === "line";
|
|
18
|
+
const flat = options?.style === "color";
|
|
13
19
|
const main = o.tint ?? spec.main;
|
|
14
20
|
const accent = o.accent ?? spec.accent ?? mix(main, -0.3);
|
|
15
21
|
const gid = `g${hashOf(`${id}|${o.tint ?? ""}|${o.accent ?? ""}`)}`;
|
|
16
22
|
const resolve = (c) => (c === "$main" ? main : c === "$accent" ? accent : c);
|
|
17
23
|
let body = "";
|
|
24
|
+
let across = false;
|
|
25
|
+
let along = false;
|
|
18
26
|
for (const p of spec.parts) {
|
|
19
27
|
const t = p.t === undefined ? "" : ` transform="${escape(p.t)}"`;
|
|
20
28
|
const fill = resolve(p.fill);
|
|
21
29
|
const hasFill = fill !== undefined && fill !== "none";
|
|
22
30
|
if (line) {
|
|
23
31
|
const mode = p.line ?? "stroke";
|
|
24
|
-
if (mode === "none")
|
|
32
|
+
if (mode === "none" || p.fx === true)
|
|
25
33
|
continue;
|
|
26
34
|
if (mode === "ink" && hasFill)
|
|
27
35
|
body += `<path d="${p.d}" fill="currentColor"${t}/>`;
|
|
@@ -31,16 +39,31 @@ export function drawGear(id, title, spec, options) {
|
|
|
31
39
|
body += `<path d="${p.d}" fill="none" stroke="currentColor" stroke-width="${num(Math.max(p.w ?? 2, 1.6), 2)}"${t}/>`;
|
|
32
40
|
continue;
|
|
33
41
|
}
|
|
42
|
+
const op = p.op === undefined ? "" : ` opacity="${p.op}"`;
|
|
43
|
+
if (p.fx === true) {
|
|
44
|
+
if (!flat)
|
|
45
|
+
body += `<path d="${p.d}" fill="${fill}"${op}${t}/>`;
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
34
48
|
const stroke = resolve(p.stroke) ?? (hasFill ? mix(readColour(fill) === undefined ? "#888888" : fill, -0.45) : "none");
|
|
35
49
|
const w = p.w ?? 0.9;
|
|
36
|
-
const op = p.op === undefined ? "" : ` opacity="${p.op}"`;
|
|
37
50
|
body += `<path d="${p.d}" fill="${hasFill ? fill : "none"}" stroke="${stroke}" stroke-width="${num(w, 2)}"${hasFill || stroke === "none" ? ` stroke-linejoin="round"` : ` stroke-linecap="round"`}${op}${t}/>`;
|
|
38
|
-
if (hasFill &&
|
|
39
|
-
|
|
51
|
+
if (hasFill && !flat) {
|
|
52
|
+
if (p.shade !== 0) {
|
|
53
|
+
along = true;
|
|
54
|
+
body += `<path d="${p.d}" fill="url(#${gid})"${p.shade === undefined ? "" : ` opacity="${p.shade}"`}${t}/>`;
|
|
55
|
+
}
|
|
56
|
+
if (p.cyl !== undefined && p.cyl > 0) {
|
|
57
|
+
across = true;
|
|
58
|
+
body += `<path d="${p.d}" fill="url(#${gid}c)"${p.cyl === 1 ? "" : ` opacity="${p.cyl}"`}${t}/>`;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
40
61
|
}
|
|
41
|
-
const defs =
|
|
42
|
-
|
|
43
|
-
|
|
62
|
+
const defs = (along ? `<linearGradient id="${gid}" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#fff" stop-opacity=".42"/><stop offset=".5" stop-color="#fff" stop-opacity="0"/><stop offset="1" stop-color="#000" stop-opacity=".3"/></linearGradient>` : "") +
|
|
63
|
+
(across ? `<linearGradient id="${gid}c" x2="1"><stop offset="0" stop-color="#000" stop-opacity=".34"/><stop offset=".26" stop-color="#fff" stop-opacity=".5"/><stop offset=".55" stop-color="#fff" stop-opacity="0"/><stop offset=".88" stop-color="#000" stop-opacity=".22"/><stop offset="1" stop-color="#000" stop-opacity=".4"/></linearGradient>` : "");
|
|
64
|
+
const box = spec.box ?? "0 0 64 64";
|
|
65
|
+
const inner = line ? `<g stroke-linecap="round" stroke-linejoin="round">${body}</g>` : `<g stroke-linecap="round">${body}</g>`;
|
|
66
|
+
return wrapPiece({ title: escape(title), size: o.size, theme: o.theme, defs, body: inner, box });
|
|
44
67
|
}
|
|
45
68
|
/** The pieces' drawing helpers: shapes written as path strings. */
|
|
46
69
|
export const rect = (x, y, w, h, r = 0) => r === 0 ? `M${x} ${y}h${w}v${h}h${-w}z` : `M${x + r} ${y}h${w - 2 * r}a${r} ${r} 0 0 1 ${r} ${r}v${h - 2 * r}a${r} ${r} 0 0 1 ${-r} ${r}h${-(w - 2 * r)}a${r} ${r} 0 0 1 ${-r} ${-r}v${-(h - 2 * r)}a${r} ${r} 0 0 1 ${r} ${-r}z`;
|
|
@@ -58,25 +81,6 @@ export function capsule(x1, y1, x2, y2, w) {
|
|
|
58
81
|
const f = (n) => String(Math.round(n * 100) / 100);
|
|
59
82
|
return `M${f(x1 + nx)} ${f(y1 + ny)}L${f(x2 + nx)} ${f(y2 + ny)}A${r} ${r} 0 0 0 ${f(x2 - nx)} ${f(y2 - ny)}L${f(x1 - nx)} ${f(y1 - ny)}A${r} ${r} 0 0 0 ${f(x1 + nx)} ${f(y1 + ny)}z`;
|
|
60
83
|
}
|
|
61
|
-
/** The ink of a copied colour drawing worked out as a line drawing: dark fills and strokes become `currentColor`, light ones are left out, the rest are a faint tint of it. Used where no other line artwork exists. */
|
|
62
|
-
export function monoOf(markup) {
|
|
63
|
-
const lum = (c) => {
|
|
64
|
-
const rgb = readColour(c);
|
|
65
|
-
if (rgb === undefined)
|
|
66
|
-
return 0.5;
|
|
67
|
-
const [r, g, b] = rgb.map((v) => v / 255);
|
|
68
|
-
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
69
|
-
};
|
|
70
|
-
return markup
|
|
71
|
-
.replace(/<(linearGradient|radialGradient)[\s\S]*?<\/\1>/g, "")
|
|
72
|
-
.replace(/(fill|stroke)="(#[0-9a-fA-F]{3,6})"/g, (_m, attr, c) => {
|
|
73
|
-
const l = lum(c);
|
|
74
|
-
if (attr === "stroke")
|
|
75
|
-
return `stroke="currentColor"`;
|
|
76
|
-
return l < 0.5 ? `fill="currentColor"` : l > 0.86 ? `fill="none"` : `fill="currentColor" fill-opacity=".4"`;
|
|
77
|
-
})
|
|
78
|
-
.replace(/(fill|stroke)="url\(#[^)]*\)"/g, (_m, attr) => (attr === "fill" ? `fill="currentColor" fill-opacity=".25"` : `stroke="currentColor"`));
|
|
79
|
-
}
|
|
80
84
|
/** A piece we drew: the common case of `defineGear`. */
|
|
81
85
|
export function drawn(id, en, ja, spec, size) {
|
|
82
86
|
return defineGear({ id, en, ja, source: "drawn", size, model: spec, draw: (o) => drawGear(id, en, spec, o) });
|
|
@@ -95,26 +99,29 @@ export function strings(cx, cy, rx, ry, step) {
|
|
|
95
99
|
}
|
|
96
100
|
return d;
|
|
97
101
|
}
|
|
98
|
-
/**
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
return wrapPiece({ title: escape(spec.en), desc, size: o.size, theme: o.theme, box: spec.line.box, body: `<path d="${spec.line.d}" fill="currentColor"/>` });
|
|
107
|
-
}
|
|
108
|
-
if (spec.leather !== undefined) {
|
|
109
|
-
const gid = `g${hashOf(spec.id)}`;
|
|
110
|
-
const leather = o.tint ?? spec.leather;
|
|
111
|
-
const defs = `<linearGradient id="${gid}" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#fff" stop-opacity=".4"/><stop offset=".5" stop-color="#fff" stop-opacity="0"/><stop offset="1" stop-color="#000" stop-opacity=".35"/></linearGradient>`;
|
|
112
|
-
const body = `<path d="${spec.colour}" fill="${leather}" stroke="${mix(leather, -0.5)}" stroke-width="${num(Number(spec.box.split(" ")[2]) / 200, 2)}"/><path d="${spec.colour}" fill="url(#${gid})"/>`;
|
|
113
|
-
return wrapPiece({ title: escape(spec.en), desc, size: o.size, theme: o.theme, box: spec.box, defs, body });
|
|
114
|
-
}
|
|
115
|
-
const under = spec.underlay === undefined ? "" : `<path d="${spec.underlay}" fill="#f4f1ea" stroke="#9aa3ae" stroke-width="1.2"/>`;
|
|
116
|
-
const body = spec.ink === undefined ? spec.colour : `<g fill="${o.tint ?? spec.ink}">${spec.colour}</g>`;
|
|
117
|
-
return wrapPiece({ title: escape(spec.en), desc, size: o.size, theme: o.theme, box: spec.box, body: under + body });
|
|
102
|
+
/**
|
|
103
|
+
* A shape of varying width along a curve, as a closed path: a cubic Bezier from `a` to `b` through the controls `c1` and `c2`, drawn `width(t)` wide at the fraction `t` of the way along. A bow, a blade or a feather
|
|
104
|
+
* is one of these. `steps` is how many segments each side has.
|
|
105
|
+
*/
|
|
106
|
+
export function swell(a, c1, c2, b, width, steps = 14) {
|
|
107
|
+
const at = (t) => {
|
|
108
|
+
const u = 1 - t;
|
|
109
|
+
return [u * u * u * a[0] + 3 * u * u * t * c1[0] + 3 * u * t * t * c2[0] + t * t * t * b[0], u * u * u * a[1] + 3 * u * u * t * c1[1] + 3 * u * t * t * c2[1] + t * t * t * b[1]];
|
|
118
110
|
};
|
|
119
|
-
|
|
111
|
+
const f = (n) => String(Math.round(n * 10) / 10);
|
|
112
|
+
const left = [];
|
|
113
|
+
const right = [];
|
|
114
|
+
for (let i = 0; i <= steps; i++) {
|
|
115
|
+
const t = i / steps;
|
|
116
|
+
const p = at(t);
|
|
117
|
+
const q = at(Math.min(1, t + 0.01));
|
|
118
|
+
const r = at(Math.max(0, t - 0.01));
|
|
119
|
+
const dx = q[0] - r[0];
|
|
120
|
+
const dy = q[1] - r[1];
|
|
121
|
+
const l = Math.hypot(dx, dy) || 1;
|
|
122
|
+
const h = width(t) / 2;
|
|
123
|
+
left.push(`${f(p[0] - (dy / l) * h)} ${f(p[1] + (dx / l) * h)}`);
|
|
124
|
+
right.push(`${f(p[0] + (dy / l) * h)} ${f(p[1] - (dx / l) * h)}`);
|
|
125
|
+
}
|
|
126
|
+
return `M${left.join("L")}L${right.reverse().join("L")}z`;
|
|
120
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GEAR_CRICKET_BAT: import("./gear.index.ts").Piece<import("./gear.core.ts").
|
|
1
|
+
export declare const GEAR_CRICKET_BAT: import("./gear.index.ts").Piece<import("./gear.core.ts").GearSpec>;
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// A cricket bat and a ball, drawn for this package: a broad willow blade with a ridge down the back, a cane handle with a grip, and a red ball with its seam.
|
|
2
|
+
import { capsule, circle, drawn } from "./gear.core.js";
|
|
3
|
+
const T = "rotate(34 32 32)";
|
|
4
|
+
export const GEAR_CRICKET_BAT = /* @__PURE__ */ drawn("gear:cricket-bat", "Cricket bat", "クリケットのバット", {
|
|
5
|
+
main: "#e6b96e",
|
|
6
|
+
accent: "#2a2f38",
|
|
7
|
+
parts: [
|
|
8
|
+
{ d: capsule(32, 2, 32, 26, 3.4), fill: "#c99a58", t: T, cyl: 1, shade: 0 },
|
|
9
|
+
{ d: capsule(32, 2, 32, 16, 4.4), fill: "$accent", t: T, cyl: 0.7, shade: 0 },
|
|
10
|
+
{ d: "M25.8 24.4h12.4L40.2 30V57a3 3 0 0 1-3 3H26.8a3 3 0 0 1-3-3V30z", fill: "$main", t: T, cyl: 0.9, shade: 0 },
|
|
11
|
+
{ d: "M32 31v27", fill: "none", stroke: "#b88540", w: 0.9, t: T, op: 0.9, line: "none", fx: true },
|
|
12
|
+
{ d: "M25 50.5h14", fill: "none", stroke: "#b88540", w: 0.8, t: T, line: "none", fx: true },
|
|
13
|
+
{ d: "M28.4 25.4L26.2 30.4", fill: "none", stroke: "#fff", w: 1.1, t: T, op: 0.5, line: "none", fx: true },
|
|
14
|
+
{ d: circle(53, 52.6, 6), fill: "#c4262e", stroke: "#6e1217", cyl: 0, shade: 0.7 },
|
|
15
|
+
{ d: "M48.6 48.6Q52 53 48.4 57M57.4 48.2Q54 52.6 57.6 57", fill: "none", stroke: "#f4ece0", w: 0.9, op: 0.9, line: "none" },
|
|
16
|
+
],
|
|
15
17
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GEAR_FIELD_HOCKEY_STICK: import("./gear.index.ts").Piece<import("./gear.core.ts").
|
|
1
|
+
export declare const GEAR_FIELD_HOCKEY_STICK: import("./gear.index.ts").Piece<import("./gear.core.ts").GearSpec>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// A field hockey stick and ball, drawn for this package: a long taped shaft and a head that hooks round at the foot, with a flat face, beside a white ball.
|
|
2
|
+
import { capsule, circle, drawn } from "./gear.core.js";
|
|
3
|
+
const T = "rotate(24 32 32)";
|
|
4
|
+
export const GEAR_FIELD_HOCKEY_STICK = /* @__PURE__ */ drawn("gear:field-hockey-stick", "Field hockey stick", "ホッケーのスティック", {
|
|
5
|
+
main: "#dcb06a",
|
|
6
|
+
accent: "#2a2f38",
|
|
7
|
+
parts: [
|
|
8
|
+
{ d: capsule(32, 1.5, 32, 44, 3.6), fill: "$main", t: T, cyl: 1, shade: 0 },
|
|
9
|
+
{ d: capsule(32, 1.5, 32, 16, 4.2), fill: "$accent", t: T, cyl: 0.7, shade: 0 },
|
|
10
|
+
{ d: "M24.2 41.2L29.8 43.6Q29.4 50.4 33.2 52.2H43.6Q46.6 52.4 46.6 55.6Q46.6 58.8 43.6 58.8H32.4Q22.8 58 23.4 48.4Q23.6 44.6 24.2 41.2Z", fill: "$main", cyl: 0.9, shade: 0 },
|
|
11
|
+
{ d: "M25.4 47.4Q25.6 55 33 56.6", fill: "none", stroke: "#fff", w: 1.1, op: 0.55, line: "none", fx: true },
|
|
12
|
+
{ d: capsule(31.5, 22.4, 31.5, 27.4, 4.2).replace(/^/, ""), fill: "$accent", t: T, line: "none", shade: 0.3 },
|
|
13
|
+
{ d: circle(54.5, 54.6, 4.8), fill: "#f4f2ee", stroke: "#8f98a3", shade: 0.9 },
|
|
14
|
+
{ d: "M51.4 51.8a4.6 4.6 0 0 1 3-1", fill: "none", stroke: "#fff", w: 1, line: "none", fx: true },
|
|
15
|
+
],
|
|
15
16
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GEAR_FOOTBALL_HELMET: import("./gear.index.ts").Piece<import("./gear.core.ts").
|
|
1
|
+
export declare const GEAR_FOOTBALL_HELMET: import("./gear.index.ts").Piece<import("./gear.core.ts").GearSpec>;
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// A football helmet, drawn for this package: a glossy shell seen from the side with a stripe over the crown, an ear hole, and a cage of bars across the face opening.
|
|
2
|
+
import { drawn, ellipse } from "./gear.core.js";
|
|
3
|
+
export const GEAR_FOOTBALL_HELMET = /* @__PURE__ */ drawn("gear:football-helmet", "Football helmet", "アメフトのヘルメット", {
|
|
4
|
+
main: "#cfd6de",
|
|
5
|
+
accent: "#c8202c",
|
|
6
|
+
parts: [
|
|
7
|
+
{ d: "M6 38C3 21 15 7 32 7C45 7 53 15 53 27V33L48.6 36L45.6 46C41.6 55 29.6 57 19.6 54C11.6 51 7 46 6 38Z", fill: "$main", cyl: 0.6 },
|
|
8
|
+
{ d: "M45 11.6Q22 9.4 12 31", fill: "none", stroke: "$accent", w: 4.4, line: "none" },
|
|
9
|
+
{ d: ellipse(25.5, 39, 6, 7.2), fill: "#2a2f38", stroke: "#1b1f27", shade: 0.5 },
|
|
10
|
+
{ d: "M21 33Q25 30.4 30 33", fill: "none", stroke: "#fff", w: 1, op: 0.45, line: "none", fx: true },
|
|
11
|
+
{ d: "M13 18Q21 9.6 33 10", fill: "none", stroke: "#fff", w: 2, op: 0.55, line: "none", fx: true },
|
|
12
|
+
{ d: "M52.6 28Q62 29.6 61 38L57 47Q54 52 46 52.4", fill: "none", stroke: "#4a5362", w: 2.6 },
|
|
13
|
+
{ d: "M50.4 35H60.4M49.2 41.6H58.4M47 47.4H55.4", fill: "none", stroke: "#4a5362", w: 2 },
|
|
14
|
+
{ d: "M45.6 46L50 52.4M38.6 55.4Q43 54.4 46 52.4", fill: "none", stroke: "#2a2f38", w: 2, line: "none" },
|
|
15
|
+
],
|
|
15
16
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GEAR_GOALIE_MASK: import("./gear.index.ts").Piece<import("./gear.core.ts").
|
|
1
|
+
export declare const GEAR_GOALIE_MASK: import("./gear.index.ts").Piece<import("./gear.core.ts").GearSpec>;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
1
|
+
// A goalie mask, drawn for this package: a pale moulded shell with a caged face opening, painted brow, side pieces over the ears and a chin guard.
|
|
2
|
+
import { drawn, ellipse, seg } from "./gear.core.js";
|
|
3
|
+
/** The cage: bars across the face opening. */
|
|
4
|
+
const CAGE = (() => {
|
|
5
|
+
let d = "";
|
|
6
|
+
for (const x of [26.5, 32, 37.5])
|
|
7
|
+
d += seg(x, 15, x, 53);
|
|
8
|
+
for (const y of [24, 35, 46])
|
|
9
|
+
d += `M${32 - 12.4 * Math.sqrt(1 - ((y - 34) / 20) ** 2)} ${y}H${32 + 12.4 * Math.sqrt(1 - ((y - 34) / 20) ** 2)}`;
|
|
10
|
+
return d;
|
|
11
|
+
})();
|
|
12
|
+
export const GEAR_GOALIE_MASK = /* @__PURE__ */ drawn("gear:goalie-mask", "Goalie mask", "ゴールキーパーマスク", {
|
|
13
|
+
main: "#eef0f2",
|
|
14
|
+
accent: "#c8202c",
|
|
15
|
+
parts: [
|
|
16
|
+
{ d: "M32 3C46 3 53 14 53 29C53 41 48 51 41 58Q32 63 23 58C16 51 11 41 11 29C11 14 18 3 32 3Z", fill: "$main", cyl: 0.7 },
|
|
17
|
+
{ d: "M14 20Q32 6 50 20L48 25Q32 13 16 25Z", fill: "$accent", stroke: "none", shade: 0.6, line: "none" },
|
|
18
|
+
{ d: ellipse(32, 34, 13.6, 20.4), fill: "#2b3038", stroke: "#1b1f27", shade: 0, line: "stroke" },
|
|
19
|
+
{ d: CAGE, fill: "none", stroke: "#cfd6de", w: 1.5 },
|
|
20
|
+
{ d: "M11.6 30Q10.6 40 13.6 47L18 44Q15.4 38 16.4 30ZM52.4 30Q53.4 40 50.4 47L46 44Q48.6 38 47.6 30Z", fill: "$main", cyl: 0.6, line: "none" },
|
|
21
|
+
{ d: "M18 8Q24 4.8 29 4.4", fill: "none", stroke: "#fff", w: 1.8, op: 0.8, line: "none", fx: true },
|
|
22
|
+
],
|
|
17
23
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GEAR_GOAL_NET: import("./gear.index.ts").Piece<import("./gear.core.ts").
|
|
1
|
+
export declare const GEAR_GOAL_NET: import("./gear.index.ts").Piece<import("./gear.core.ts").GearSpec>;
|
|
@@ -1,15 +1,25 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// A goal with a net, drawn for this package: a frame of round posts seen from the front and a little above, the back bar and the sloping top and sides, and a mesh of strings.
|
|
2
|
+
import { drawn, seg } from "./gear.core.js";
|
|
3
|
+
/** The mesh: the back panel, the top, and the two sides, as strings. */
|
|
4
|
+
const MESH = (() => {
|
|
5
|
+
let d = "";
|
|
6
|
+
for (let x = 16; x <= 48; x += 4)
|
|
7
|
+
d += seg(x, 20, x, 42);
|
|
8
|
+
for (let y = 24; y <= 40; y += 4)
|
|
9
|
+
d += seg(14, y, 50, y);
|
|
10
|
+
d += seg(7, 13, 14, 20) + seg(57, 13, 50, 20) + seg(7, 44, 14, 42) + seg(57, 44, 50, 42);
|
|
11
|
+
return d;
|
|
12
|
+
})();
|
|
13
|
+
export const GEAR_GOAL_NET = /* @__PURE__ */ drawn("gear:goal-net", "Goal net", "ゴールネット", {
|
|
14
|
+
main: "#d62b2b",
|
|
15
|
+
accent: "#dfe4ea",
|
|
16
|
+
parts: [
|
|
17
|
+
{ d: "M7 12H57L50 20H14z", fill: "$accent", stroke: "none", op: 0.45, shade: 0, line: "none" },
|
|
18
|
+
{ d: "M7 12L14 20V42L7 46zM57 12L50 20V42L57 46z", fill: "$accent", stroke: "none", op: 0.28, shade: 0, line: "none" },
|
|
19
|
+
{ d: MESH, fill: "none", stroke: "#8f98a3", w: 0.6 },
|
|
20
|
+
{ d: "M14 20H50M14 20V42H50V20", fill: "none", stroke: "#aeb6c0", w: 1.4, line: "stroke" },
|
|
21
|
+
{ d: "M7 46V12H57V46", fill: "none", stroke: "$main", w: 4.2 },
|
|
22
|
+
{ d: "M7 46V12H57V46", fill: "none", stroke: "#fff", w: 1, op: 0.35, fx: true, line: "none", t: "translate(-.7 .4)" },
|
|
23
|
+
{ d: "M4.6 49H59.4", fill: "none", stroke: "#8f98a3", w: 3.2 },
|
|
24
|
+
],
|
|
15
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const GEAR_HOCKEY_STICK: import("./gear.index.ts").Piece<import("./gear.core.ts").
|
|
1
|
+
export declare const GEAR_HOCKEY_STICK: import("./gear.index.ts").Piece<import("./gear.core.ts").GearSpec>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
//
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
// An ice hockey stick and a puck, drawn for this package: a long shaft taped at the top, and a blade with a heel and a toe lying flat on the ice.
|
|
2
|
+
import { capsule, drawn } from "./gear.core.js";
|
|
3
|
+
const T = "rotate(28 32 32)";
|
|
4
|
+
export const GEAR_HOCKEY_STICK = /* @__PURE__ */ drawn("gear:hockey-stick", "Hockey stick and puck", "スティックとパック", {
|
|
5
|
+
main: "#c8202c",
|
|
6
|
+
accent: "#f2efe8",
|
|
7
|
+
parts: [
|
|
8
|
+
{ d: capsule(32, 1.5, 32, 47, 4.2), fill: "$main", t: T, cyl: 1, shade: 0 },
|
|
9
|
+
{ d: capsule(32, 1.5, 32, 11, 4.4), fill: "$accent", t: T, cyl: 0.8, shade: 0 },
|
|
10
|
+
{ d: "M23.2 41.6L29.4 44.4C29 49 31 51.6 35.6 51.6H43.4Q46.8 51.8 46.4 54.8Q46 58 42.4 58H19.8Q16.4 58 17 54.4C17.8 49.6 20 45 23.2 41.6Z", fill: "#dcb97b", cyl: 0.7, shade: 0 },
|
|
11
|
+
{ d: "M19 52.4L25 49.6L26.6 58H18ZM33.6 51.6H38.4L37.6 58H32.6Z", fill: "$accent", stroke: "none", op: 0.92, shade: 0, line: "none" },
|
|
12
|
+
{ d: "M48.6 52.4v3.2a5.4 2.3 0 0 0 10.8 0v-3.2a5.4 2.3 0 0 0-10.8 0z", fill: "#3a414b", cyl: 0.8, shade: 0 },
|
|
13
|
+
{ d: "M48.6 52.4a5.4 2.3 0 0 0 10.8 0a5.4 2.3 0 0 0-10.8 0z", fill: "#6b7480", shade: 0, line: "none" },
|
|
14
|
+
],
|
|
15
15
|
});
|
|
@@ -15,8 +15,12 @@ import { GEAR_TABLE_TENNIS_PADDLE } from "./gear.tabletennispaddle.js";
|
|
|
15
15
|
import { GEAR_TENNIS_RACKET } from "./gear.tennisracket.js";
|
|
16
16
|
import { GEAR_STARTING_BLOCKS, GEAR_RELAY_BATON, GEAR_JAVELIN, GEAR_HURDLES } from "./gear.track.js";
|
|
17
17
|
import { GEAR_DIVING_BOARD, GEAR_SWIM_GOGGLES } from "./gear.water.js";
|
|
18
|
+
import { GEAR_GUNBAI, GEAR_MAWASHI } from "./gear.sumo.js";
|
|
19
|
+
import { GEAR_SHINAI, GEAR_KENDO_MEN } from "./gear.kendo.js";
|
|
20
|
+
import { GEAR_JUDOGI, GEAR_KARATE_GI, GEAR_OBI } from "./gear.budo.js";
|
|
21
|
+
import { GEAR_YUMI, GEAR_YA } from "./gear.kyudo.js";
|
|
18
22
|
/** Every piece of gear, in the order a gallery shows them. */
|
|
19
|
-
export const GEARS = [GEAR_HOCKEY_STICK, GEAR_GOALIE_STICK, GEAR_HOCKEY_SKATE, GEAR_GOALIE_MASK, GEAR_GOAL_NET, GEAR_FIELD_HOCKEY_STICK, GEAR_LACROSSE_STICK, GEAR_CRICKET_BAT, GEAR_WICKET, GEAR_TABLE_TENNIS_PADDLE, GEAR_BADMINTON_RACKET, GEAR_TENNIS_RACKET, GEAR_SQUASH_RACKET, GEAR_RACQUETBALL_RACKET, GEAR_PADEL_RACKET, GEAR_PICKLEBALL_PADDLE, GEAR_ROUNDNET_SET, GEAR_VOLLEYBALL_NET, GEAR_BASKETBALL_HOOP, GEAR_BASEBALL_BAT, GEAR_BASEBALL_GLOVE, GEAR_FOOTBALL_HELMET, GEAR_GOALPOSTS, GEAR_HURLEY, GEAR_CURLING_BROOM, GEAR_FIGURE_SKATE, GEAR_SPEED_SKATE, GEAR_DIVING_BOARD, GEAR_SWIM_GOGGLES, GEAR_STARTING_BLOCKS, GEAR_RELAY_BATON, GEAR_JAVELIN, GEAR_HURDLES];
|
|
23
|
+
export const GEARS = [GEAR_HOCKEY_STICK, GEAR_GOALIE_STICK, GEAR_HOCKEY_SKATE, GEAR_GOALIE_MASK, GEAR_GOAL_NET, GEAR_FIELD_HOCKEY_STICK, GEAR_LACROSSE_STICK, GEAR_CRICKET_BAT, GEAR_WICKET, GEAR_TABLE_TENNIS_PADDLE, GEAR_BADMINTON_RACKET, GEAR_TENNIS_RACKET, GEAR_SQUASH_RACKET, GEAR_RACQUETBALL_RACKET, GEAR_PADEL_RACKET, GEAR_PICKLEBALL_PADDLE, GEAR_ROUNDNET_SET, GEAR_VOLLEYBALL_NET, GEAR_BASKETBALL_HOOP, GEAR_BASEBALL_BAT, GEAR_BASEBALL_GLOVE, GEAR_FOOTBALL_HELMET, GEAR_GOALPOSTS, GEAR_HURLEY, GEAR_CURLING_BROOM, GEAR_FIGURE_SKATE, GEAR_SPEED_SKATE, GEAR_DIVING_BOARD, GEAR_SWIM_GOGGLES, GEAR_STARTING_BLOCKS, GEAR_RELAY_BATON, GEAR_JAVELIN, GEAR_HURDLES, GEAR_GUNBAI, GEAR_MAWASHI, GEAR_SHINAI, GEAR_KENDO_MEN, GEAR_JUDOGI, GEAR_OBI, GEAR_YUMI, GEAR_YA, GEAR_KARATE_GI];
|
|
20
24
|
/** The id of every piece of gear: `"gear:hockey-stick"`. */
|
|
21
25
|
export const GEAR_IDS = GEARS.map((g) => g.id);
|
|
22
26
|
const TABLE = new Map(GEARS.map((g) => [g.id, g]));
|