@johnmorrisdotca/dougu-sports 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -1
- package/LICENSES/Apache-2.0.txt +202 -55
- package/LICENSES/CC-BY-3.0.txt +319 -0
- package/LICENSES/README.md +4 -3
- package/LICENSES/upstream/game-icons.license.txt +45 -0
- package/LICENSES/upstream/noto-emoji-2D-svg.LICENSE +13 -0
- package/LICENSES/upstream/pictogrammers-mdi.LICENSE +20 -0
- package/NOTICE.md +92 -3
- package/README.md +104 -69
- package/dist/emblems/award/badge.d.ts +2 -0
- package/dist/emblems/award/badge.js +5 -0
- package/dist/emblems/award/crown.d.ts +2 -0
- package/dist/emblems/award/crown.js +5 -0
- package/dist/emblems/award/medal.d.ts +2 -2
- package/dist/emblems/award/medal.js +5 -19
- package/dist/emblems/award/shield.d.ts +2 -0
- package/dist/emblems/award/shield.js +5 -0
- package/dist/emblems/award/star.d.ts +2 -0
- package/dist/emblems/award/star.js +5 -0
- package/dist/emblems/ball/ball.afl.d.ts +1 -0
- package/dist/emblems/ball/ball.afl.js +24 -0
- package/dist/emblems/ball/ball.baseball.d.ts +1 -0
- package/dist/emblems/ball/ball.baseball.js +14 -0
- package/dist/emblems/ball/ball.basketball.d.ts +7 -0
- package/dist/emblems/ball/ball.basketball.js +32 -0
- package/dist/emblems/ball/ball.basketball3x3.d.ts +1 -0
- package/dist/emblems/ball/ball.basketball3x3.js +10 -0
- package/dist/emblems/ball/ball.basketball6.d.ts +1 -0
- package/dist/emblems/ball/ball.basketball6.js +10 -0
- package/dist/emblems/ball/ball.core.d.ts +105 -0
- package/dist/emblems/ball/ball.core.js +66 -0
- package/dist/emblems/ball/ball.cricket.d.ts +5 -0
- package/dist/emblems/ball/ball.cricket.js +31 -0
- package/dist/emblems/ball/ball.curlingstone.d.ts +3 -0
- package/dist/emblems/ball/ball.curlingstone.js +46 -0
- package/dist/emblems/ball/ball.discus.d.ts +1 -0
- package/dist/emblems/ball/ball.discus.js +24 -0
- package/dist/emblems/ball/ball.engine.d.ts +114 -0
- package/dist/emblems/ball/ball.engine.js +342 -0
- package/dist/emblems/ball/ball.family.dotted.d.ts +27 -0
- package/dist/emblems/ball/ball.family.dotted.js +20 -0
- package/dist/emblems/ball/ball.family.panelled.d.ts +7 -0
- package/dist/emblems/ball/ball.family.panelled.js +60 -0
- package/dist/emblems/ball/ball.family.prolate.d.ts +16 -0
- package/dist/emblems/ball/ball.family.prolate.js +29 -0
- package/dist/emblems/ball/ball.family.seamed.d.ts +31 -0
- package/dist/emblems/ball/ball.family.seamed.js +26 -0
- package/dist/emblems/ball/ball.fieldhockey.d.ts +1 -0
- package/dist/emblems/ball/ball.fieldhockey.js +15 -0
- package/dist/emblems/ball/ball.football.d.ts +3 -0
- package/dist/emblems/ball/ball.football.js +51 -0
- package/dist/emblems/ball/ball.gaelic.d.ts +2 -0
- package/dist/emblems/ball/ball.gaelic.js +30 -0
- package/dist/emblems/ball/ball.golf.d.ts +1 -0
- package/dist/emblems/ball/ball.golf.js +15 -0
- package/dist/emblems/ball/ball.hammer.d.ts +1 -0
- package/dist/emblems/ball/ball.hammer.js +31 -0
- package/dist/emblems/ball/ball.handball.d.ts +1 -0
- package/dist/emblems/ball/ball.handball.js +25 -0
- package/dist/emblems/ball/ball.index.d.ts +48 -0
- package/dist/emblems/ball/ball.index.js +103 -0
- package/dist/emblems/ball/ball.math.d.ts +38 -0
- package/dist/emblems/ball/ball.math.js +105 -0
- package/dist/emblems/ball/ball.object.d.ts +38 -0
- package/dist/emblems/ball/ball.object.js +20 -0
- package/dist/emblems/ball/ball.padel.d.ts +1 -0
- package/dist/emblems/ball/ball.padel.js +13 -0
- package/dist/emblems/ball/ball.pickleball.d.ts +2 -0
- package/dist/emblems/ball/ball.pickleball.js +26 -0
- package/dist/emblems/ball/ball.polyhedra.d.ts +15 -0
- package/dist/emblems/ball/ball.polyhedra.js +63 -0
- package/dist/emblems/ball/ball.puck.d.ts +3 -0
- package/dist/emblems/ball/ball.puck.js +22 -0
- package/dist/emblems/ball/ball.roundnet.d.ts +1 -0
- package/dist/emblems/ball/ball.roundnet.js +15 -0
- package/dist/emblems/ball/ball.rugby.d.ts +1 -0
- package/dist/emblems/ball/ball.rugby.js +35 -0
- package/dist/emblems/ball/ball.sepaktakraw.d.ts +1 -0
- package/dist/emblems/ball/ball.sepaktakraw.js +48 -0
- package/dist/emblems/ball/ball.shuttlecock.d.ts +6 -0
- package/dist/emblems/ball/ball.shuttlecock.js +93 -0
- package/dist/emblems/ball/ball.sliotar.d.ts +1 -0
- package/dist/emblems/ball/ball.sliotar.js +14 -0
- package/dist/emblems/ball/ball.smooth.d.ts +4 -0
- package/dist/emblems/ball/ball.smooth.js +51 -0
- package/dist/emblems/ball/ball.soccer.d.ts +2 -0
- package/dist/emblems/ball/ball.soccer.js +54 -0
- package/dist/emblems/ball/ball.softball.d.ts +1 -0
- package/dist/emblems/ball/ball.softball.js +14 -0
- package/dist/emblems/ball/ball.squash.d.ts +7 -0
- package/dist/emblems/ball/ball.squash.js +27 -0
- package/dist/emblems/ball/ball.stack.d.ts +48 -0
- package/dist/emblems/ball/ball.stack.js +127 -0
- package/dist/emblems/ball/ball.stitch.d.ts +10 -0
- package/dist/emblems/ball/ball.stitch.js +59 -0
- package/dist/emblems/ball/ball.tennis.d.ts +1 -0
- package/dist/emblems/ball/ball.tennis.js +13 -0
- package/dist/emblems/ball/ball.teqball.d.ts +1 -0
- package/dist/emblems/ball/ball.teqball.js +27 -0
- package/dist/emblems/ball/ball.volleyball.d.ts +3 -0
- package/dist/emblems/ball/ball.volleyball.js +56 -0
- package/dist/emblems/ball/ball.waterpolo.d.ts +1 -0
- package/dist/emblems/ball/ball.waterpolo.js +31 -0
- package/dist/emblems/crest/diamond.d.ts +2 -0
- package/dist/emblems/crest/diamond.js +18 -0
- package/dist/emblems/crest/pennant.d.ts +2 -0
- package/dist/emblems/crest/pennant.js +18 -0
- package/dist/emblems/crest/roundel.d.ts +2 -0
- package/dist/emblems/crest/roundel.js +18 -0
- package/dist/emblems/crest/shield.d.ts +2 -0
- package/dist/emblems/crest/shield.js +17 -0
- package/dist/emblems/emblem.api.d.ts +39 -9
- package/dist/emblems/emblem.api.js +38 -10
- package/dist/emblems/emblem.core.d.ts +42 -6
- package/dist/emblems/emblem.core.js +55 -11
- package/dist/emblems/emblem.ids.d.ts +33 -27
- package/dist/emblems/emblem.ids.js +35 -16
- package/dist/emblems/emblem.lathe.d.ts +59 -0
- package/dist/emblems/emblem.lathe.js +404 -0
- package/dist/emblems/emblem.material.d.ts +9 -0
- package/dist/emblems/emblem.material.data.d.ts +34 -0
- package/dist/emblems/emblem.material.data.js +85 -0
- package/dist/emblems/emblem.material.js +23 -0
- package/dist/emblems/emblem.medal.d.ts +6 -0
- package/dist/emblems/emblem.medal.js +38 -0
- package/dist/emblems/emblem.registry.js +142 -4
- package/dist/emblems/emblem.shapes.d.ts +31 -12
- package/dist/emblems/emblem.shapes.js +99 -33
- package/dist/emblems/gear/gear.badmintonracket.d.ts +1 -0
- package/dist/emblems/gear/gear.badmintonracket.js +15 -0
- package/dist/emblems/gear/gear.baseballglove.d.ts +1 -0
- package/dist/emblems/gear/gear.baseballglove.js +15 -0
- package/dist/emblems/gear/gear.core.d.ts +83 -0
- package/dist/emblems/gear/gear.core.js +120 -0
- package/dist/emblems/gear/gear.cricketbat.d.ts +1 -0
- package/dist/emblems/gear/gear.cricketbat.js +15 -0
- package/dist/emblems/gear/gear.field.d.ts +6 -0
- package/dist/emblems/gear/gear.field.js +81 -0
- package/dist/emblems/gear/gear.fieldhockeystick.d.ts +1 -0
- package/dist/emblems/gear/gear.fieldhockeystick.js +15 -0
- package/dist/emblems/gear/gear.footballhelmet.d.ts +1 -0
- package/dist/emblems/gear/gear.footballhelmet.js +15 -0
- package/dist/emblems/gear/gear.goaliemask.d.ts +1 -0
- package/dist/emblems/gear/gear.goaliemask.js +17 -0
- package/dist/emblems/gear/gear.goalnet.d.ts +1 -0
- package/dist/emblems/gear/gear.goalnet.js +15 -0
- package/dist/emblems/gear/gear.hockeystick.d.ts +1 -0
- package/dist/emblems/gear/gear.hockeystick.js +15 -0
- package/dist/emblems/gear/gear.index.d.ts +22 -0
- package/dist/emblems/gear/gear.index.js +45 -0
- package/dist/emblems/gear/gear.lacrossestick.d.ts +1 -0
- package/dist/emblems/gear/gear.lacrossestick.js +15 -0
- package/dist/emblems/gear/gear.rackets.d.ts +4 -0
- package/dist/emblems/gear/gear.rackets.js +60 -0
- package/dist/emblems/gear/gear.skates.d.ts +3 -0
- package/dist/emblems/gear/gear.skates.js +39 -0
- package/dist/emblems/gear/gear.sticks.d.ts +3 -0
- package/dist/emblems/gear/gear.sticks.js +34 -0
- package/dist/emblems/gear/gear.tabletennispaddle.d.ts +1 -0
- package/dist/emblems/gear/gear.tabletennispaddle.js +15 -0
- package/dist/emblems/gear/gear.tennisracket.d.ts +1 -0
- package/dist/emblems/gear/gear.tennisracket.js +15 -0
- package/dist/emblems/gear/gear.track.d.ts +4 -0
- package/dist/emblems/gear/gear.track.js +45 -0
- package/dist/emblems/gear/gear.water.d.ts +2 -0
- package/dist/emblems/gear/gear.water.js +25 -0
- package/dist/emblems/medal/bronze.d.ts +2 -0
- package/dist/emblems/medal/bronze.js +4 -0
- package/dist/emblems/medal/gold.d.ts +2 -0
- package/dist/emblems/medal/gold.js +4 -0
- package/dist/emblems/medal/place-1.d.ts +2 -0
- package/dist/emblems/medal/place-1.js +4 -0
- package/dist/emblems/medal/place-2.d.ts +2 -0
- package/dist/emblems/medal/place-2.js +4 -0
- package/dist/emblems/medal/place-3.d.ts +2 -0
- package/dist/emblems/medal/place-3.js +4 -0
- package/dist/emblems/medal/silver.d.ts +2 -0
- package/dist/emblems/medal/silver.js +4 -0
- package/dist/emblems/sport/afl.d.ts +2 -0
- package/dist/emblems/sport/afl.js +12 -0
- package/dist/emblems/sport/artisticswimming.d.ts +2 -0
- package/dist/emblems/sport/artisticswimming.js +16 -0
- package/dist/emblems/sport/athletics.d.ts +2 -0
- package/dist/emblems/sport/athletics.js +12 -0
- package/dist/emblems/sport/badminton.d.ts +2 -0
- package/dist/emblems/sport/badminton.js +13 -0
- package/dist/emblems/sport/cfl.d.ts +2 -0
- package/dist/emblems/sport/cfl.js +5 -0
- package/dist/emblems/sport/cricket.d.ts +2 -0
- package/dist/emblems/sport/cricket.js +5 -0
- package/dist/emblems/sport/curling.d.ts +2 -0
- package/dist/emblems/sport/curling.js +14 -0
- package/dist/emblems/sport/diving.d.ts +2 -0
- package/dist/emblems/sport/diving.js +18 -0
- package/dist/emblems/sport/fieldhockey.d.ts +2 -0
- package/dist/emblems/sport/fieldhockey.js +11 -0
- package/dist/emblems/sport/gaelic.d.ts +2 -0
- package/dist/emblems/sport/gaelic.js +11 -0
- package/dist/emblems/sport/handball.d.ts +2 -0
- package/dist/emblems/sport/handball.js +5 -0
- package/dist/emblems/sport/ifaf.d.ts +2 -0
- package/dist/emblems/sport/ifaf.js +5 -0
- package/dist/emblems/sport/lacrosse.d.ts +2 -0
- package/dist/emblems/sport/lacrosse.js +13 -0
- package/dist/emblems/sport/mlb.d.ts +2 -0
- package/dist/emblems/sport/mlb.js +5 -0
- package/dist/emblems/sport/nba.d.ts +2 -0
- package/dist/emblems/sport/nba.js +5 -0
- package/dist/emblems/sport/netball.d.ts +2 -0
- package/dist/emblems/sport/netball.js +14 -0
- package/dist/emblems/sport/nfl.d.ts +2 -0
- package/dist/emblems/sport/nfl.js +5 -0
- package/dist/emblems/sport/nhl.d.ts +2 -0
- package/dist/emblems/sport/nhl.js +5 -0
- package/dist/emblems/sport/padel.d.ts +2 -0
- package/dist/emblems/sport/padel.js +14 -0
- package/dist/emblems/sport/pickleball.d.ts +2 -0
- package/dist/emblems/sport/pickleball.js +13 -0
- package/dist/emblems/sport/racquetball.d.ts +2 -0
- package/dist/emblems/sport/racquetball.js +13 -0
- package/dist/emblems/sport/roundnet.d.ts +2 -0
- package/dist/emblems/sport/roundnet.js +15 -0
- package/dist/emblems/sport/rugby.d.ts +2 -0
- package/dist/emblems/sport/rugby.js +5 -0
- package/dist/emblems/sport/sepaktakraw.d.ts +2 -0
- package/dist/emblems/sport/sepaktakraw.js +11 -0
- package/dist/emblems/sport/skating.d.ts +2 -0
- package/dist/emblems/sport/skating.js +14 -0
- package/dist/emblems/sport/soccer.d.ts +2 -0
- package/dist/emblems/sport/soccer.js +5 -0
- package/dist/emblems/sport/squash.d.ts +2 -0
- package/dist/emblems/sport/squash.js +15 -0
- package/dist/emblems/sport/swimming.d.ts +2 -0
- package/dist/emblems/sport/swimming.js +15 -0
- package/dist/emblems/sport/tabletennis.d.ts +2 -0
- package/dist/emblems/sport/tabletennis.js +12 -0
- package/dist/emblems/sport/tennis.d.ts +2 -0
- package/dist/emblems/sport/tennis.js +5 -0
- package/dist/emblems/sport/teqball.d.ts +2 -0
- package/dist/emblems/sport/teqball.js +15 -0
- package/dist/emblems/sport/volleyball.d.ts +2 -0
- package/dist/emblems/sport/volleyball.js +5 -0
- package/dist/emblems/sport/waterpolo.d.ts +2 -0
- package/dist/emblems/sport/waterpolo.js +15 -0
- package/dist/emblems/trophy/baseball.d.ts +2 -0
- package/dist/emblems/trophy/baseball.js +14 -0
- package/dist/emblems/trophy/basketball.d.ts +2 -0
- package/dist/emblems/trophy/basketball.js +16 -0
- package/dist/emblems/trophy/belt.d.ts +2 -0
- package/dist/emblems/trophy/belt.js +16 -0
- package/dist/emblems/trophy/bowl.d.ts +2 -0
- package/dist/emblems/trophy/bowl.js +7 -0
- package/dist/emblems/trophy/canadian-bowl.d.ts +2 -0
- package/dist/emblems/trophy/canadian-bowl.js +22 -0
- package/dist/emblems/trophy/cricket-urn.d.ts +2 -0
- package/dist/emblems/trophy/cricket-urn.js +22 -0
- package/dist/emblems/trophy/cup.d.ts +2 -0
- package/dist/emblems/trophy/cup.js +5 -0
- package/dist/emblems/trophy/football.d.ts +2 -0
- package/dist/emblems/trophy/football.js +10 -0
- package/dist/emblems/trophy/globe.d.ts +2 -0
- package/dist/emblems/trophy/globe.js +8 -0
- package/dist/emblems/trophy/hockey-cup.d.ts +2 -0
- package/dist/emblems/trophy/hockey-cup.js +21 -0
- package/dist/emblems/trophy/laurel.d.ts +2 -0
- package/dist/emblems/trophy/laurel.js +40 -0
- package/dist/emblems/trophy/lidded-cup.d.ts +2 -0
- package/dist/emblems/trophy/lidded-cup.js +20 -0
- package/dist/emblems/trophy/plaque.d.ts +2 -0
- package/dist/emblems/trophy/plaque.js +16 -0
- package/dist/emblems/trophy/rosette.d.ts +2 -0
- package/dist/emblems/trophy/rosette.js +27 -0
- package/dist/emblems/trophy/rugby-cup.d.ts +2 -0
- package/dist/emblems/trophy/rugby-cup.js +22 -0
- package/dist/emblems/trophy/salver.d.ts +2 -0
- package/dist/emblems/trophy/salver.js +8 -0
- package/dist/emblems/trophy/soccer-ball.d.ts +2 -0
- package/dist/emblems/trophy/soccer-ball.js +8 -0
- package/dist/emblems/trophy/soccer-globe.d.ts +2 -0
- package/dist/emblems/trophy/soccer-globe.js +17 -0
- package/dist/emblems/trophy/tennis-cup.d.ts +2 -0
- package/dist/emblems/trophy/tennis-cup.js +23 -0
- package/dist/emblems/trophy/tennis-plate.d.ts +2 -0
- package/dist/emblems/trophy/tennis-plate.js +15 -0
- package/dist/emblems-entry.d.ts +10 -6
- package/dist/emblems-entry.js +3 -2
- package/dist/index.d.ts +114 -1
- package/dist/index.js +116 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +28 -8
- package/LICENSES/CC-BY-3.0.md +0 -15
- package/dist/emblems/ball/soccer.d.ts +0 -2
- package/dist/emblems/ball/soccer.js +0 -9
- package/dist/emblems/emblem.ball.d.ts +0 -28
- package/dist/emblems/emblem.ball.js +0 -70
|
@@ -35,14 +35,26 @@ export function resolve(o) {
|
|
|
35
35
|
const size = typeof o?.size === "number" && Number.isFinite(o.size) && o.size > 0 ? Math.min(Math.round(o.size * 100) / 100, 4096) : 64;
|
|
36
36
|
const theme = o?.theme === "auto" || o?.theme === "light" || o?.theme === "dark" ? o.theme : "inherit";
|
|
37
37
|
const style = o?.style === "line" || o?.style === "color" ? o.style : "metal";
|
|
38
|
-
|
|
38
|
+
const accent = readColour(o?.accent);
|
|
39
|
+
const initials = typeof o?.initials === "string" ? [...o.initials.trim()].slice(0, 3).join("").toUpperCase() : "";
|
|
40
|
+
return { style, size, theme, tint: readColour(o?.tint), accent: accent === undefined ? undefined : hexOf(accent), initials };
|
|
39
41
|
}
|
|
40
42
|
/** The main colour of a metal, or the tint when there is one. */
|
|
41
|
-
export const mainOf = (metal, tint) => tint ?? readColour(METALS[metal]);
|
|
43
|
+
export const mainOf = (metal, tint) => tint ?? readColour(metal === "flat" ? "#8a949e" : METALS[metal]);
|
|
44
|
+
/** The relative luminance of a colour, 0 to 1. */
|
|
45
|
+
export function lum(rgb) {
|
|
46
|
+
const [r, g, b] = rgb.map((c) => {
|
|
47
|
+
const k = c / 255;
|
|
48
|
+
return k <= 0.03928 ? k / 12.92 : ((k + 0.055) / 1.055) ** 2.4;
|
|
49
|
+
});
|
|
50
|
+
return 0.2126 * r + 0.7152 * g + 0.0722 * b;
|
|
51
|
+
}
|
|
52
|
+
/** Black or white, whichever reads better on a colour. */
|
|
53
|
+
export const onColour = (rgb) => ((lum(rgb) + 0.05) / 0.05 > 1.05 / (lum(rgb) + 0.05) ? "#000000" : "#ffffff");
|
|
42
54
|
/** A turn in degrees, as a finite number (0 for anything else). */
|
|
43
55
|
export const degrees = (value) => (typeof value === "number" && Number.isFinite(value) ? value % 360 : 0);
|
|
44
|
-
/** The paint
|
|
45
|
-
export function paintFor(style, main
|
|
56
|
+
/** The paint of a ball: a radial gradient in the metal style. The gradient's id names the colour, so two of one colour in a page agree. */
|
|
57
|
+
export function paintFor(style, main) {
|
|
46
58
|
if (style === "line")
|
|
47
59
|
return { main: "none", shade: "none", light: "none", ribbon: "none", defs: "" };
|
|
48
60
|
const shade = mix(main, -0.28);
|
|
@@ -50,18 +62,50 @@ export function paintFor(style, main, kind = "linear") {
|
|
|
50
62
|
const ribbon = "#b3362b";
|
|
51
63
|
if (style === "color")
|
|
52
64
|
return { main: hexOf(main), shade, light, ribbon, defs: "" };
|
|
53
|
-
const id = `
|
|
54
|
-
const
|
|
55
|
-
const defs = kind === "linear"
|
|
56
|
-
? `<defs><linearGradient id="${id}" x2="1" y2="0.2">${stops}</linearGradient></defs>`
|
|
57
|
-
: `<defs><radialGradient id="${id}" cx="0.36" cy="0.3" r="0.8"><stop offset="0" stop-color="${light}"/><stop offset="0.55" stop-color="${hexOf(main)}"/><stop offset="1" stop-color="${mix(main, -0.38)}"/></radialGradient></defs>`;
|
|
65
|
+
const id = `dgsr${hexOf(main).slice(1)}`;
|
|
66
|
+
const defs = `<defs><radialGradient id="${id}" cx="0.36" cy="0.3" r="0.8"><stop offset="0" stop-color="${light}"/><stop offset="0.55" stop-color="${hexOf(main)}"/><stop offset="1" stop-color="${mix(main, -0.38)}"/></radialGradient></defs>`;
|
|
58
67
|
return { main: `url(#${id})`, shade, light, ribbon, defs };
|
|
59
68
|
}
|
|
69
|
+
const stops = (list) => list.map(([at, colour]) => `<stop offset="${n2(at).replace(/^0\./, ".")}" stop-color="${colour}"/>`).join("");
|
|
70
|
+
/**
|
|
71
|
+
* The shading of a round metal body: a dark edge, a bright band left of the middle, the metal, a darker side, and a faint light from the rim on the far edge, as polished metal throws it. `shift` slides the bright
|
|
72
|
+
* band (a turn). The id names the colour and the shift, so two bodies of one colour in a page share one definition.
|
|
73
|
+
*/
|
|
74
|
+
export function cylinderGradient(main, shift = 0) {
|
|
75
|
+
const h = Math.max(0.14, Math.min(0.5, 0.3 + shift));
|
|
76
|
+
const id = `dgsc${hexOf(main).slice(1)}${shift === 0 ? "" : `s${Math.round(shift * 100) + 100}`}`;
|
|
77
|
+
const list = [[0, mix(main, -0.5)], [0.1, mix(main, -0.16)], [h, mix(main, 0.62)], [h + 0.26, mix(main, 0.08)], [0.84, mix(main, -0.36)], [0.95, mix(main, -0.1)], [1, mix(main, -0.52)]];
|
|
78
|
+
return { id, def: `<linearGradient id="${id}">${stops(list)}</linearGradient>`, fill: `url(#${id})` };
|
|
79
|
+
}
|
|
80
|
+
/** The shading of a round flat or a ball: light from the top left, the metal, then dark at the far edge. */
|
|
81
|
+
export function orbGradient(main) {
|
|
82
|
+
const id = `dgso${hexOf(main).slice(1)}`;
|
|
83
|
+
return { id, def: `<radialGradient id="${id}" cx="0.36" cy="0.3" r="0.82">${stops([[0, mix(main, 0.7)], [0.3, mix(main, 0.2)], [0.62, hexOf(main)], [1, mix(main, -0.42)]])}</radialGradient>`, fill: `url(#${id})` };
|
|
84
|
+
}
|
|
85
|
+
/** The shading of a flat sheet of metal, from a bright corner to a dark one. */
|
|
86
|
+
export function sheetGradient(main) {
|
|
87
|
+
const id = `dgsd${hexOf(main).slice(1)}`;
|
|
88
|
+
return { id, def: `<linearGradient id="${id}" x2="1" y2="1">${stops([[0, mix(main, 0.55)], [0.35, mix(main, 0.12)], [0.6, hexOf(main)], [1, mix(main, -0.4)]])}</linearGradient>`, fill: `url(#${id})` };
|
|
89
|
+
}
|
|
90
|
+
/** The shading of a raised rim: bright on the top left, dark on the bottom right, as a bevel catches the light (or the other way round, for a groove). */
|
|
91
|
+
export function bevelGradient(main, groove = false) {
|
|
92
|
+
const id = `dgse${hexOf(main).slice(1)}${groove ? "g" : ""}`;
|
|
93
|
+
const [a, b] = groove ? [mix(main, -0.45), mix(main, 0.6)] : [mix(main, 0.65), mix(main, -0.5)];
|
|
94
|
+
return { id, def: `<linearGradient id="${id}" x2="1" y2="1">${stops([[0, a], [0.5, hexOf(main)], [1, b]])}</linearGradient>`, fill: `url(#${id})` };
|
|
95
|
+
}
|
|
96
|
+
/** The gradients' definitions as one `<defs>`, with none twice. */
|
|
97
|
+
export const defsOf = (gradients) => {
|
|
98
|
+
const seen = new Set();
|
|
99
|
+
const list = gradients.filter((g) => !seen.has(g.id) && seen.add(g.id));
|
|
100
|
+
return list.length === 0 ? "" : `<defs>${list.map((g) => g.def).join("")}</defs>`;
|
|
101
|
+
};
|
|
60
102
|
/** A drawing wrapped into a document: the title, the outline's colour for the theme, and the group that strokes it. */
|
|
61
103
|
export function wrap(o) {
|
|
62
104
|
const colour = o.theme === "dark" ? EMBLEM_INK.dark : o.theme === "inherit" ? "" : EMBLEM_INK.light;
|
|
63
105
|
const auto = o.theme === "auto" ? `<style>@media(prefers-color-scheme:dark){svg{color:${EMBLEM_INK.dark}}}</style>` : "";
|
|
64
|
-
|
|
106
|
+
// `edge` is a colour of the drawing's own for the outline (a metal's darker tone); without it the outline is the page's ink. The `line` style is always the page's ink.
|
|
107
|
+
const ink = o.edge !== undefined && o.style !== "line" ? o.edge : "currentColor";
|
|
108
|
+
const stroke = o.width ?? (o.style === "line" ? 2.6 : 2.2);
|
|
65
109
|
return (`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${o.box ?? "0 0 64 64"}" width="${o.size}" height="${o.size}" role="img"${colour === "" ? "" : ` color="${colour}"`}>` +
|
|
66
|
-
`<title>${escape(o.title)}</title>${auto}${o.defs ?? ""}<g fill="none" stroke="
|
|
110
|
+
`<title>${escape(o.title)}</title>${auto}${o.defs ?? ""}<g fill="none" stroke="${ink}" stroke-width="${n2(stroke)}" stroke-linejoin="round" stroke-linecap="round">${o.body}</g></svg>`);
|
|
67
111
|
}
|
|
@@ -1,49 +1,55 @@
|
|
|
1
1
|
/** The thirty-three sports the emblems are made for: the names that `ball:<sport>`, `gear:<sport>` and `sport:<sport>` use. */
|
|
2
2
|
export declare const SPORT_NAMES: readonly ["nfl", "cfl", "ifaf", "nhl", "nba", "mlb", "soccer", "curling", "tennis", "volleyball", "badminton", "pickleball", "tabletennis", "padel", "squash", "racquetball", "sepaktakraw", "teqball", "roundnet", "netball", "swimming", "waterpolo", "diving", "artisticswimming", "lacrosse", "rugby", "afl", "gaelic", "cricket", "fieldhockey", "handball", "athletics", "skating"];
|
|
3
3
|
export type SportName = (typeof SPORT_NAMES)[number];
|
|
4
|
-
/** The awards: a medal on a ribbon,
|
|
5
|
-
export declare const AWARD_IDS: readonly ["award:medal"];
|
|
4
|
+
/** The awards, drawn from Material Symbols: a medal on a ribbon, a badge, a crown, a star and a shield. */
|
|
5
|
+
export declare const AWARD_IDS: readonly ["award:medal", "award:badge", "award:crown", "award:star", "award:shield"];
|
|
6
6
|
export type AwardId = (typeof AWARD_IDS)[number];
|
|
7
|
-
/** The trophies. */
|
|
8
|
-
export declare const TROPHY_IDS: readonly [];
|
|
7
|
+
/** The trophies: a cup for each league's champion in a descriptive, generic form, the plain cups and dishes, and the flat plaque, belt, wreath and rosette. */
|
|
8
|
+
export declare const TROPHY_IDS: readonly ["trophy:cup", "trophy:lidded-cup", "trophy:bowl", "trophy:salver", "trophy:globe", "trophy:hockey-cup", "trophy:basketball", "trophy:baseball", "trophy:football", "trophy:canadian-bowl", "trophy:soccer-ball", "trophy:soccer-globe", "trophy:tennis-plate", "trophy:tennis-cup", "trophy:cricket-urn", "trophy:rugby-cup", "trophy:plaque", "trophy:belt", "trophy:laurel", "trophy:rosette"];
|
|
9
9
|
export type TrophyId = (typeof TROPHY_IDS)[number];
|
|
10
|
-
/** The medals
|
|
11
|
-
export declare const
|
|
10
|
+
/** The medals on a ribbon, and the badges for the first three places. */
|
|
11
|
+
export declare const MEDAL_KINDS: readonly ["gold", "silver", "bronze"];
|
|
12
|
+
export type MedalKind = (typeof MEDAL_KINDS)[number];
|
|
13
|
+
export declare const MEDAL_IDS: readonly ["medal:gold", "medal:silver", "medal:bronze", "medal:place-1", "medal:place-2", "medal:place-3"];
|
|
12
14
|
export type MedalId = (typeof MEDAL_IDS)[number];
|
|
13
|
-
/** The crests. */
|
|
14
|
-
export declare const
|
|
15
|
+
/** The generic crests: tinted by a team's colours, with the team's letters on them when it has any. */
|
|
16
|
+
export declare const CREST_SHAPES: readonly ["shield", "roundel", "diamond", "pennant"];
|
|
17
|
+
export type CrestShape = (typeof CREST_SHAPES)[number];
|
|
18
|
+
export declare const CREST_IDS: readonly ["crest:shield", "crest:roundel", "crest:diamond", "crest:pennant"];
|
|
15
19
|
export type CrestId = (typeof CREST_IDS)[number];
|
|
16
|
-
/** The balls. */
|
|
17
|
-
export declare const BALL_IDS: readonly ["ball:soccer"];
|
|
20
|
+
/** The balls: one for each ball and implement the sports use, in 3D, with the official size it comes from. The balls of one family (the three crickets, the five squash balls) share a module. */
|
|
21
|
+
export declare const BALL_IDS: readonly ["ball:soccer", "ball:soccer-colour", "ball:teqball", "ball:basketball", "ball:basketball-6", "ball:basketball-3x3", "ball:baseball", "ball:softball", "ball:tennis", "ball:padel", "ball:sliotar", "ball:volleyball", "ball:volleyball-8", "ball:beach-volleyball", "ball:cricket-red", "ball:cricket-white", "ball:cricket-pink", "ball:football", "ball:football-cfl", "ball:football-ifaf", "ball:rugby", "ball:afl", "ball:gaelic-football", "ball:netball", "ball:pickleball-outdoor", "ball:pickleball-indoor", "ball:squash", "ball:squash-yellow", "ball:squash-green", "ball:squash-red", "ball:squash-blue", "ball:racquetball", "ball:lacrosse", "ball:field-hockey", "ball:table-tennis", "ball:handball", "ball:water-polo", "ball:golf", "ball:puck", "ball:curling-stone", "ball:shot", "ball:discus", "ball:hammer", "ball:sepak-takraw", "ball:roundnet", "ball:shuttlecock-feather", "ball:shuttlecock-nylon"];
|
|
18
22
|
export type BallId = (typeof BALL_IDS)[number];
|
|
19
|
-
/** The pieces of gear. */
|
|
20
|
-
export declare const GEAR_IDS: readonly [];
|
|
23
|
+
/** The pieces of gear: a piece of equipment for each sport, flat, drawn here or copied from open icon sets (NOTICE.md says which). */
|
|
24
|
+
export declare const GEAR_IDS: readonly ["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"];
|
|
21
25
|
export type GearId = (typeof GEAR_IDS)[number];
|
|
22
|
-
/** The sports' own emblems. */
|
|
23
|
-
export
|
|
24
|
-
export
|
|
26
|
+
/** The sports' own emblems: one pictogram for each of the thirty-three. */
|
|
27
|
+
export type SportEmblemId = `sport:${SportName}`;
|
|
28
|
+
export declare const SPORT_IDS: readonly SportEmblemId[];
|
|
25
29
|
/** Every emblem id. */
|
|
26
30
|
export type EmblemId = AwardId | TrophyId | MedalId | CrestId | BallId | GearId | SportEmblemId;
|
|
27
31
|
/** The groups of ids, in the order a gallery shows them. */
|
|
28
32
|
export declare const EMBLEM_GROUPS: {
|
|
29
|
-
readonly award: readonly ["award:medal"];
|
|
30
|
-
readonly trophy: readonly [];
|
|
31
|
-
readonly medal: readonly [];
|
|
32
|
-
readonly crest: readonly [];
|
|
33
|
-
readonly ball: readonly ["ball:soccer"];
|
|
34
|
-
readonly gear: readonly [];
|
|
35
|
-
readonly sport: readonly [];
|
|
33
|
+
readonly award: readonly ["award:medal", "award:badge", "award:crown", "award:star", "award:shield"];
|
|
34
|
+
readonly trophy: readonly ["trophy:cup", "trophy:lidded-cup", "trophy:bowl", "trophy:salver", "trophy:globe", "trophy:hockey-cup", "trophy:basketball", "trophy:baseball", "trophy:football", "trophy:canadian-bowl", "trophy:soccer-ball", "trophy:soccer-globe", "trophy:tennis-plate", "trophy:tennis-cup", "trophy:cricket-urn", "trophy:rugby-cup", "trophy:plaque", "trophy:belt", "trophy:laurel", "trophy:rosette"];
|
|
35
|
+
readonly medal: readonly ["medal:gold", "medal:silver", "medal:bronze", "medal:place-1", "medal:place-2", "medal:place-3"];
|
|
36
|
+
readonly crest: readonly ["crest:shield", "crest:roundel", "crest:diamond", "crest:pennant"];
|
|
37
|
+
readonly ball: readonly ["ball:soccer", "ball:soccer-colour", "ball:teqball", "ball:basketball", "ball:basketball-6", "ball:basketball-3x3", "ball:baseball", "ball:softball", "ball:tennis", "ball:padel", "ball:sliotar", "ball:volleyball", "ball:volleyball-8", "ball:beach-volleyball", "ball:cricket-red", "ball:cricket-white", "ball:cricket-pink", "ball:football", "ball:football-cfl", "ball:football-ifaf", "ball:rugby", "ball:afl", "ball:gaelic-football", "ball:netball", "ball:pickleball-outdoor", "ball:pickleball-indoor", "ball:squash", "ball:squash-yellow", "ball:squash-green", "ball:squash-red", "ball:squash-blue", "ball:racquetball", "ball:lacrosse", "ball:field-hockey", "ball:table-tennis", "ball:handball", "ball:water-polo", "ball:golf", "ball:puck", "ball:curling-stone", "ball:shot", "ball:discus", "ball:hammer", "ball:sepak-takraw", "ball:roundnet", "ball:shuttlecock-feather", "ball:shuttlecock-nylon"];
|
|
38
|
+
readonly gear: readonly ["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"];
|
|
39
|
+
readonly sport: readonly ("sport:nfl" | "sport:cfl" | "sport:ifaf" | "sport:nhl" | "sport:nba" | "sport:mlb" | "sport:soccer" | "sport:curling" | "sport:tennis" | "sport:volleyball" | "sport:badminton" | "sport:pickleball" | "sport:tabletennis" | "sport:padel" | "sport:squash" | "sport:racquetball" | "sport:sepaktakraw" | "sport:teqball" | "sport:roundnet" | "sport:netball" | "sport:swimming" | "sport:waterpolo" | "sport:diving" | "sport:artisticswimming" | "sport:lacrosse" | "sport:rugby" | "sport:afl" | "sport:gaelic" | "sport:cricket" | "sport:fieldhockey" | "sport:handball" | "sport:athletics" | "sport:skating")[];
|
|
36
40
|
};
|
|
37
41
|
export type EmblemGroup = keyof typeof EMBLEM_GROUPS;
|
|
38
42
|
/** Every id, in group order. */
|
|
39
43
|
export declare const EMBLEM_IDS: readonly EmblemId[];
|
|
40
|
-
/** The folder under `src/emblems/` that holds a group's art, one module per item named by the id's last part: `ball:soccer` is `ball/soccer.ts`.
|
|
44
|
+
/** The folder under `src/emblems/` that holds a group's art, one module per item named by the id's last part: `trophy:hockey-cup` is `trophy/hockey-cup.ts`, `ball:soccer` is `ball/soccer.ts`. Each group has a folder of its own, so no two ids share a file name. */
|
|
41
45
|
export declare const EMBLEM_FOLDERS: {
|
|
42
46
|
readonly award: "award";
|
|
43
|
-
readonly trophy: "
|
|
44
|
-
readonly medal: "
|
|
45
|
-
readonly crest: "
|
|
47
|
+
readonly trophy: "trophy";
|
|
48
|
+
readonly medal: "medal";
|
|
49
|
+
readonly crest: "crest";
|
|
46
50
|
readonly ball: "ball";
|
|
47
51
|
readonly gear: "gear";
|
|
48
|
-
readonly sport: "
|
|
52
|
+
readonly sport: "sport";
|
|
49
53
|
};
|
|
54
|
+
/** The short names of the trophies and awards that stand for a full id: `"cup"` is `"trophy:cup"` and `"crown"` is `"award:crown"`. */
|
|
55
|
+
export declare const EMBLEM_ALIASES: Readonly<Record<string, EmblemId>>;
|
|
@@ -5,20 +5,37 @@ export const SPORT_NAMES = [
|
|
|
5
5
|
"nfl", "cfl", "ifaf", "nhl", "nba", "mlb", "soccer", "curling", "tennis", "volleyball", "badminton", "pickleball", "tabletennis", "padel", "squash", "racquetball", "sepaktakraw", "teqball", "roundnet", "netball",
|
|
6
6
|
"swimming", "waterpolo", "diving", "artisticswimming", "lacrosse", "rugby", "afl", "gaelic", "cricket", "fieldhockey", "handball", "athletics", "skating",
|
|
7
7
|
];
|
|
8
|
-
/** The awards: a medal on a ribbon,
|
|
9
|
-
export const AWARD_IDS = ["award:medal"];
|
|
10
|
-
/** The trophies. */
|
|
11
|
-
export const TROPHY_IDS = [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export const
|
|
20
|
-
/** The
|
|
21
|
-
export const
|
|
8
|
+
/** The awards, drawn from Material Symbols: a medal on a ribbon, a badge, a crown, a star and a shield. */
|
|
9
|
+
export const AWARD_IDS = ["award:medal", "award:badge", "award:crown", "award:star", "award:shield"];
|
|
10
|
+
/** The trophies: a cup for each league's champion in a descriptive, generic form, the plain cups and dishes, and the flat plaque, belt, wreath and rosette. */
|
|
11
|
+
export const TROPHY_IDS = [
|
|
12
|
+
"trophy:cup", "trophy:lidded-cup", "trophy:bowl", "trophy:salver", "trophy:globe",
|
|
13
|
+
"trophy:hockey-cup", "trophy:basketball", "trophy:baseball", "trophy:football", "trophy:canadian-bowl", "trophy:soccer-ball", "trophy:soccer-globe",
|
|
14
|
+
"trophy:tennis-plate", "trophy:tennis-cup", "trophy:cricket-urn", "trophy:rugby-cup",
|
|
15
|
+
"trophy:plaque", "trophy:belt", "trophy:laurel", "trophy:rosette",
|
|
16
|
+
];
|
|
17
|
+
/** The medals on a ribbon, and the badges for the first three places. */
|
|
18
|
+
export const MEDAL_KINDS = ["gold", "silver", "bronze"];
|
|
19
|
+
export const MEDAL_IDS = ["medal:gold", "medal:silver", "medal:bronze", "medal:place-1", "medal:place-2", "medal:place-3"];
|
|
20
|
+
/** The generic crests: tinted by a team's colours, with the team's letters on them when it has any. */
|
|
21
|
+
export const CREST_SHAPES = ["shield", "roundel", "diamond", "pennant"];
|
|
22
|
+
export const CREST_IDS = ["crest:shield", "crest:roundel", "crest:diamond", "crest:pennant"];
|
|
23
|
+
/** The balls: one for each ball and implement the sports use, in 3D, with the official size it comes from. The balls of one family (the three crickets, the five squash balls) share a module. */
|
|
24
|
+
export const BALL_IDS = [
|
|
25
|
+
"ball:soccer", "ball:soccer-colour", "ball:teqball", "ball:basketball", "ball:basketball-6", "ball:basketball-3x3", "ball:baseball", "ball:softball", "ball:tennis", "ball:padel",
|
|
26
|
+
"ball:sliotar", "ball:volleyball", "ball:volleyball-8", "ball:beach-volleyball", "ball:cricket-red", "ball:cricket-white", "ball:cricket-pink", "ball:football", "ball:football-cfl",
|
|
27
|
+
"ball:football-ifaf", "ball:rugby", "ball:afl", "ball:gaelic-football", "ball:netball", "ball:pickleball-outdoor", "ball:pickleball-indoor", "ball:squash", "ball:squash-yellow",
|
|
28
|
+
"ball:squash-green", "ball:squash-red", "ball:squash-blue", "ball:racquetball", "ball:lacrosse", "ball:field-hockey", "ball:table-tennis", "ball:handball", "ball:water-polo", "ball:golf",
|
|
29
|
+
"ball:puck", "ball:curling-stone", "ball:shot", "ball:discus", "ball:hammer", "ball:sepak-takraw", "ball:roundnet", "ball:shuttlecock-feather", "ball:shuttlecock-nylon"
|
|
30
|
+
];
|
|
31
|
+
/** The pieces of gear: a piece of equipment for each sport, flat, drawn here or copied from open icon sets (NOTICE.md says which). */
|
|
32
|
+
export const GEAR_IDS = [
|
|
33
|
+
"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",
|
|
34
|
+
"gear:table-tennis-paddle", "gear:badminton-racket", "gear:tennis-racket", "gear:squash-racket", "gear:racquetball-racket", "gear:padel-racket", "gear:pickleball-paddle",
|
|
35
|
+
"gear:roundnet-set", "gear:volleyball-net", "gear:basketball-hoop", "gear:baseball-bat", "gear:baseball-glove", "gear:football-helmet", "gear:goalposts", "gear:hurley",
|
|
36
|
+
"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"
|
|
37
|
+
];
|
|
38
|
+
export const SPORT_IDS = SPORT_NAMES.map((name) => `sport:${name}`);
|
|
22
39
|
/** The groups of ids, in the order a gallery shows them. */
|
|
23
40
|
export const EMBLEM_GROUPS = {
|
|
24
41
|
award: AWARD_IDS,
|
|
@@ -31,5 +48,7 @@ export const EMBLEM_GROUPS = {
|
|
|
31
48
|
};
|
|
32
49
|
/** Every id, in group order. */
|
|
33
50
|
export const EMBLEM_IDS = Object.values(EMBLEM_GROUPS).flat();
|
|
34
|
-
/** The folder under `src/emblems/` that holds a group's art, one module per item named by the id's last part: `ball:soccer` is `ball/soccer.ts`.
|
|
35
|
-
export const EMBLEM_FOLDERS = { award: "award", trophy: "
|
|
51
|
+
/** The folder under `src/emblems/` that holds a group's art, one module per item named by the id's last part: `trophy:hockey-cup` is `trophy/hockey-cup.ts`, `ball:soccer` is `ball/soccer.ts`. Each group has a folder of its own, so no two ids share a file name. */
|
|
52
|
+
export const EMBLEM_FOLDERS = { award: "award", trophy: "trophy", medal: "medal", crest: "crest", ball: "ball", gear: "gear", sport: "sport" };
|
|
53
|
+
/** The short names of the trophies and awards that stand for a full id: `"cup"` is `"trophy:cup"` and `"crown"` is `"award:crown"`. */
|
|
54
|
+
export const EMBLEM_ALIASES = Object.fromEntries([...TROPHY_IDS, ...AWARD_IDS].map((id) => [id.slice(id.indexOf(":") + 1), id]));
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { type Emblem, type EmblemSource, type Metal } from "./emblem.core.ts";
|
|
2
|
+
/** A point of the profile: the height `y` (0 at the top of the 64 unit box), the radius `r` from the axis (x = 32), 1 for a sharp corner (a smooth run of points ends at one), and the tone of the piece that starts here. */
|
|
3
|
+
export type Pt = readonly [y: number, r: number, corner?: 0 | 1, tone?: string];
|
|
4
|
+
/** Something drawn on the surface, by height and angle (90 degrees is the right side, 0 faces the eye): a `ring` round the body at a height; `mer`idians from one height to another; `helix` strands that wind `turns` times; a diamond `net`; `dots` (beads) round at a height with a size; on an open top, a `disc` of a tone out to a radius and `pills`, short rounded marks, round a radius. */
|
|
5
|
+
export type Decor = readonly ["ring", y: number] | readonly ["mer", y0: number, y1: number, n: number, off?: number] | readonly ["helix", y0: number, y1: number, n: number, turns: number] | readonly ["net", y0: number, y1: number, n: number] | readonly ["dots", y: number, n: number, size: number, off?: number] | readonly ["disc", rho: number, tone: string] | readonly ["pills", rho: number, n: number, length: number, width: number, tone: string];
|
|
6
|
+
/** One solid of revolution: a profile from the top down, whether its top is an open rim, how many flat sides it has (none: round) and what is drawn on it. */
|
|
7
|
+
export interface Solid {
|
|
8
|
+
p: readonly Pt[];
|
|
9
|
+
open?: boolean;
|
|
10
|
+
sides?: number;
|
|
11
|
+
tone?: string;
|
|
12
|
+
decor?: readonly Decor[];
|
|
13
|
+
}
|
|
14
|
+
/** A handle: a curve through points `[r, y]` (the distance from the axis and the height) in the plane of the azimuth `a`, drawn as a tube `w` thick. The handle of the other side is `a + 180`. */
|
|
15
|
+
export interface Handle {
|
|
16
|
+
a: number;
|
|
17
|
+
pts: readonly (readonly [r: number, y: number])[];
|
|
18
|
+
w?: number;
|
|
19
|
+
tone?: string;
|
|
20
|
+
}
|
|
21
|
+
export type BallKind = "plain" | "basket" | "soccer" | "base" | "globe" | "football" | "pine";
|
|
22
|
+
/** A ball on the body: `cy` its centre, `r` its radius (and `ry` when it is longer than it is wide), `rot` the lean of a football in degrees. */
|
|
23
|
+
export interface Ball {
|
|
24
|
+
kind: BallKind;
|
|
25
|
+
cx?: number;
|
|
26
|
+
cy: number;
|
|
27
|
+
r: number;
|
|
28
|
+
ry?: number;
|
|
29
|
+
rot?: number;
|
|
30
|
+
tone?: string;
|
|
31
|
+
}
|
|
32
|
+
/** A ring of `n` poles that stand from a ring of radius `r0` at `y0` up to a ring of radius `r1`, their tops stepping from the height `top1` down to `top2` once round, each with a pennant `size` tall. */
|
|
33
|
+
export interface Poles {
|
|
34
|
+
n: number;
|
|
35
|
+
y0: number;
|
|
36
|
+
r0: number;
|
|
37
|
+
r1: number;
|
|
38
|
+
top1: number;
|
|
39
|
+
top2: number;
|
|
40
|
+
size: number;
|
|
41
|
+
}
|
|
42
|
+
/** What a body of revolution is made of. All of it is in the 64 by 64 box with the axis at x = 32. */
|
|
43
|
+
export interface LatheModel {
|
|
44
|
+
metal: Metal;
|
|
45
|
+
/** The main colour when the caller gives no tint and the metal is `flat` (the clay of an urn). */
|
|
46
|
+
color?: string;
|
|
47
|
+
/** The colours of the other tones the profile names (`gilt`, `dark`, `green`...). The `accent` option replaces the tone named `accent`. */
|
|
48
|
+
tones?: Readonly<Record<string, string>>;
|
|
49
|
+
/** The elevation of the eye in degrees at rest: how much of the top of a rim shows. */
|
|
50
|
+
tilt?: number;
|
|
51
|
+
solids: readonly Solid[];
|
|
52
|
+
handles?: readonly Handle[];
|
|
53
|
+
balls?: readonly Ball[];
|
|
54
|
+
poles?: Poles;
|
|
55
|
+
}
|
|
56
|
+
/** The radius of the body at a height. */
|
|
57
|
+
export declare function radiusAt(profile: readonly Pt[], y: number): number;
|
|
58
|
+
/** A lathe emblem: the object with its names and its model, the still drawing and the turned one. */
|
|
59
|
+
export declare function defineLathe(id: string, en: string, ja: string, source: EmblemSource, model: LatheModel): Emblem<LatheModel>;
|