@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
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
// A body of revolution: the shape of a cup, a bowl, an urn, a column or a globe on a stand. A profile says the radius at each height; the parts that stand on it (handles, balls, flags, rings and
|
|
2
|
+
// grooves round the body, a pattern on a dish) are placed by the angle they are turned to. One model draws the still emblem (yaw 0) and the emblem turned (`frame`), so the 2D and the turning view
|
|
3
|
+
// come from the same data. The silhouette is the profile at every yaw; the light, the handles, the grooves and the seams move to where `sin(yaw)` puts them, and are drawn back to front. Plain SVG.
|
|
4
|
+
// Imports only the core.
|
|
5
|
+
import { cylinderGradient, defsOf, hexOf, mainOf, mix, orbGradient, readColour, resolve, wrap, } from "./emblem.core.js";
|
|
6
|
+
const CX = 32;
|
|
7
|
+
const RAD = Math.PI / 180;
|
|
8
|
+
const f = (n) => String(Math.round(n * 10) / 10 + 0);
|
|
9
|
+
const pt = (x, y) => `${f(x)} ${f(y)}`;
|
|
10
|
+
/** The radius of the body at a height. */
|
|
11
|
+
export function radiusAt(profile, y) {
|
|
12
|
+
if (y <= profile[0][0])
|
|
13
|
+
return profile[0][1];
|
|
14
|
+
for (let i = 1; i < profile.length; i++) {
|
|
15
|
+
const [y1, r1] = profile[i];
|
|
16
|
+
const [y0, r0] = profile[i - 1];
|
|
17
|
+
if (y <= y1)
|
|
18
|
+
return y1 === y0 ? r1 : r0 + ((r1 - r0) * (y - y0)) / (y1 - y0);
|
|
19
|
+
}
|
|
20
|
+
return profile[profile.length - 1][1];
|
|
21
|
+
}
|
|
22
|
+
/** The edge of the body on one side, smoothed through its vertices, as path segments that continue from the first point. */
|
|
23
|
+
function edge(points) {
|
|
24
|
+
let d = "";
|
|
25
|
+
let cur = points[0];
|
|
26
|
+
const last = points.length - 1;
|
|
27
|
+
for (let i = 1; i <= last; i++) {
|
|
28
|
+
const p = points[i];
|
|
29
|
+
if (i === last) {
|
|
30
|
+
d += `L${pt(p[0], p[1])}`;
|
|
31
|
+
break;
|
|
32
|
+
}
|
|
33
|
+
const before = points[i - 1];
|
|
34
|
+
const after = points[i + 1];
|
|
35
|
+
const m0 = [(before[0] + p[0]) / 2, (before[1] + p[1]) / 2];
|
|
36
|
+
const m1 = [(p[0] + after[0]) / 2, (p[1] + after[1]) / 2];
|
|
37
|
+
if (Math.abs(cur[0] - m0[0]) > 0.05 || Math.abs(cur[1] - m0[1]) > 0.05)
|
|
38
|
+
d += `L${pt(m0[0], m0[1])}`;
|
|
39
|
+
d += `Q${pt(p[0], p[1])} ${pt(m1[0], m1[1])}`;
|
|
40
|
+
cur = m1;
|
|
41
|
+
}
|
|
42
|
+
return d;
|
|
43
|
+
}
|
|
44
|
+
/** The pieces of a profile, as lists of vertex indexes: a new piece starts at a sharp corner and after a step (two points at one height). */
|
|
45
|
+
function piecesOf(p) {
|
|
46
|
+
const out = [];
|
|
47
|
+
let cur = [0];
|
|
48
|
+
for (let i = 1; i < p.length; i++) {
|
|
49
|
+
if (p[i][0] === p[i - 1][0]) {
|
|
50
|
+
out.push(cur);
|
|
51
|
+
cur = [i];
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
cur.push(i);
|
|
55
|
+
if (p[i][2] === 1 && i < p.length - 1 && p[i + 1][0] !== p[i][0]) {
|
|
56
|
+
out.push(cur);
|
|
57
|
+
cur = [i];
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
out.push(cur);
|
|
61
|
+
return out.filter((c) => c.length > 1);
|
|
62
|
+
}
|
|
63
|
+
/** A front arc of the rim of radius `r` at height `y`, from the right to the left, sagging toward the eye by `r * s`. */
|
|
64
|
+
const arc = (y, r, s, toLeft) => `Q${pt(CX, y + 2 * r * s)} ${pt(CX + (toLeft ? -r : r), y)}`;
|
|
65
|
+
const ellipse = (cx, cy, rx, ry, fill, extra = "") => `<ellipse cx="${f(cx)}" cy="${f(cy)}" rx="${f(rx)}" ry="${f(Math.max(ry, 0.25))}" fill="${fill}"${extra}/>`;
|
|
66
|
+
/** The geometry and paint of one drawing of the model at a yaw and a pitch. */
|
|
67
|
+
function draw(model, r, yaw, pitch) {
|
|
68
|
+
const line = r.style === "line";
|
|
69
|
+
const flat = r.style === "color";
|
|
70
|
+
const elevation = Math.max(0, Math.min(75, (model.tilt ?? 12) + pitch));
|
|
71
|
+
const s = Math.sin(elevation * RAD);
|
|
72
|
+
const spin = Math.sin(yaw * RAD);
|
|
73
|
+
const shift = 0.2 * spin;
|
|
74
|
+
const grads = [];
|
|
75
|
+
const tones = new Map();
|
|
76
|
+
const tone = (name = "main") => {
|
|
77
|
+
const known = tones.get(name);
|
|
78
|
+
if (known !== undefined)
|
|
79
|
+
return known;
|
|
80
|
+
const rgb = name === "main" ? (r.tint ?? readColour(model.color) ?? mainOf(model.metal, undefined)) : name === "accent" && r.accent !== undefined ? readColour(r.accent) : (readColour(model.tones?.[name]) ?? mainOf(model.metal, undefined));
|
|
81
|
+
const g = cylinderGradient(rgb, shift);
|
|
82
|
+
if (!line && !flat)
|
|
83
|
+
grads.push(g);
|
|
84
|
+
const made = { rgb, fill: line ? "none" : flat ? hexOf(rgb) : g.fill, light: line ? "none" : mix(rgb, 0.4), deep: line ? "none" : mix(rgb, -0.55), edge: mix(rgb, -0.55) };
|
|
85
|
+
tones.set(name, made);
|
|
86
|
+
return made;
|
|
87
|
+
};
|
|
88
|
+
const main = tone("main");
|
|
89
|
+
const back = [];
|
|
90
|
+
const mid = [];
|
|
91
|
+
const front = [];
|
|
92
|
+
const own = (t) => (t === main || line ? "" : ` stroke="${t.edge}"`);
|
|
93
|
+
// The point of the surface of a body of revolution at a radius, a height and an angle.
|
|
94
|
+
const at = (R, y, deg) => [CX + R * Math.sin(deg * RAD), y + s * R * Math.cos(deg * RAD), Math.cos(deg * RAD)];
|
|
95
|
+
const where = (R, y, deg) => pt(...at(R, y, deg).slice(0, 2));
|
|
96
|
+
for (const solid of model.solids) {
|
|
97
|
+
const p = solid.p;
|
|
98
|
+
const list = piecesOf(p);
|
|
99
|
+
const base = tone(solid.tone);
|
|
100
|
+
const top = p[0];
|
|
101
|
+
for (let k = list.length - 1; k >= 0; k--) {
|
|
102
|
+
const idx = list[k];
|
|
103
|
+
const a = p[idx[0]];
|
|
104
|
+
const b = p[idx[idx.length - 1]];
|
|
105
|
+
const t = tone(a[3] ?? solid.tone);
|
|
106
|
+
const rows = idx.map((i) => p[i]);
|
|
107
|
+
const right = rows.map((q) => [CX + q[1], q[0]]);
|
|
108
|
+
const left = rows.map((q) => [CX - q[1], q[0]]).reverse();
|
|
109
|
+
const height = b[0] - a[0];
|
|
110
|
+
if (solid.sides === undefined) {
|
|
111
|
+
// In the line style a piece is open at the top (the piece above, or the rim, draws that edge), and a small step between pieces is a short line, not a ring, so that a tall stack stays a clean outline.
|
|
112
|
+
const below = list[k + 1] === undefined ? undefined : p[list[k + 1][0]];
|
|
113
|
+
const small = below !== undefined && Math.abs(below[1] - b[1]) < 1.4 && height < 8;
|
|
114
|
+
const d = line
|
|
115
|
+
? `M${pt(right[0][0], right[0][1])}${edge(right)}${small ? `M${pt(CX - b[1], b[0])}` : arc(b[0], b[1], s, true)}${edge(left)}${k === 0 ? arc(a[0], a[1], s, false) : ""}${below !== undefined && below[1] !== b[1] ? `M${pt(CX + b[1], b[0])}H${f(CX + below[1])}M${pt(CX - b[1], b[0])}H${f(CX - below[1])}` : ""}`
|
|
116
|
+
: `M${pt(right[0][0], right[0][1])}${edge(right)}${arc(b[0], b[1], s, true)}${edge(left)}${arc(a[0], a[1], s, false)}z`;
|
|
117
|
+
mid.push(`<path d="${d}" fill="${t.fill}"${own(t)}/>`);
|
|
118
|
+
if (!line && height >= 6 && Math.min(a[1], b[1]) >= 2.2) {
|
|
119
|
+
const c = 0.4 - 2 * shift;
|
|
120
|
+
const l1 = rows.map((q) => pt(CX - (c + 0.09) * q[1], q[0] + 0.6));
|
|
121
|
+
const l2 = rows.map((q) => pt(CX - (c - 0.09) * q[1], q[0] + 0.6)).reverse();
|
|
122
|
+
if (!flat)
|
|
123
|
+
mid.push(`<path d="M${l1.join("L")}L${l2.join("L")}z" fill="#fff" fill-opacity=".34" stroke="none"/>`);
|
|
124
|
+
else {
|
|
125
|
+
const e1 = rows.map((q) => pt(CX + 0.3 * q[1], q[0]));
|
|
126
|
+
const e2 = rows.map((q) => pt(CX + 0.96 * q[1], q[0])).reverse();
|
|
127
|
+
mid.push(`<path d="M${e1.join("L")}L${e2.join("L")}z" fill="${mix(t.rgb, -0.22)}" stroke="none"/>`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
// A body with flat faces: each face that looks toward the eye is a quadrilateral, lit by which way it faces.
|
|
133
|
+
const n = solid.sides;
|
|
134
|
+
for (let face = 0; face < n; face++) {
|
|
135
|
+
const a0 = (360 * face) / n + yaw;
|
|
136
|
+
const a1 = (360 * (face + 1)) / n + yaw;
|
|
137
|
+
const m = (a0 + a1) / 2;
|
|
138
|
+
if (Math.cos(m * RAD) <= 0)
|
|
139
|
+
continue;
|
|
140
|
+
const lit = -Math.sin(m * RAD);
|
|
141
|
+
const colour = line ? "none" : mix(t.rgb, 0.18 + 0.36 * lit);
|
|
142
|
+
mid.push(`<path d="M${where(a[1], a[0], a0)}L${where(a[1], a[0], a1)}L${where(b[1], b[0], a1)}L${where(b[1], b[0], a0)}z" fill="${colour}"${own(t)}/>`);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
// The top of a piece that steps out beyond the one above it, or the cap of the body, shows as a lighter ring.
|
|
146
|
+
const above = k > 0 ? p[list[k - 1][list[k - 1].length - 1]] : undefined;
|
|
147
|
+
if (!line && ((above === undefined && solid.open !== true && a[1] > 1) || (above !== undefined && a[1] > above[1] + 0.3))) {
|
|
148
|
+
const sides = solid.sides;
|
|
149
|
+
mid.push(sides === undefined ? ellipse(CX, a[0], a[1], a[1] * s, t.light) : `<path d="M${Array.from({ length: sides }, (_, i) => where(a[1], a[0], (360 * i) / sides + yaw)).join("L")}z" fill="${t.light}"${own(t)}/>`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (solid.open === true) {
|
|
153
|
+
const lip = top[1];
|
|
154
|
+
const inner = Math.max(lip - 1.3, lip * 0.7);
|
|
155
|
+
mid.push(ellipse(CX, top[0], lip, lip * s, base.light));
|
|
156
|
+
mid.push(ellipse(CX, top[0] + 0.1, inner, inner * s, base.deep, ' stroke="none"'));
|
|
157
|
+
if (!line && s > 0.12)
|
|
158
|
+
mid.push(ellipse(CX, top[0] + inner * s * 0.35, inner * 0.8, inner * s * 0.55, mix(base.rgb, -0.3), ' stroke="none"'));
|
|
159
|
+
}
|
|
160
|
+
// What is drawn on the surface.
|
|
161
|
+
for (const d of solid.decor ?? []) {
|
|
162
|
+
const kind = d[0];
|
|
163
|
+
if (kind === "ring") {
|
|
164
|
+
const R = radiusAt(p, d[1]);
|
|
165
|
+
mid.push(`<path d="M${pt(CX - R, d[1])}${arc(d[1], R, s, false)}" stroke-width="${line ? 2 : 0.8}"/>`);
|
|
166
|
+
if (!line)
|
|
167
|
+
mid.push(`<path d="M${pt(CX - R, d[1] + 0.9)}${arc(d[1] + 0.9, R, s, false)}" stroke="${mix(base.rgb, 0.5)}" stroke-width=".6" stroke-opacity=".7"/>`);
|
|
168
|
+
}
|
|
169
|
+
else if (line) {
|
|
170
|
+
continue;
|
|
171
|
+
}
|
|
172
|
+
else if (kind === "mer") {
|
|
173
|
+
const [, y0, y1, n, off = 0] = d;
|
|
174
|
+
let m = "";
|
|
175
|
+
for (let i = 0; i < n; i++) {
|
|
176
|
+
const deg = yaw + off + (360 * i) / n;
|
|
177
|
+
if (Math.cos(deg * RAD) <= 0.08)
|
|
178
|
+
continue;
|
|
179
|
+
m += `M${where(radiusAt(p, y0), y0, deg)}L${where(radiusAt(p, y1), y1, deg)}`;
|
|
180
|
+
}
|
|
181
|
+
if (m !== "")
|
|
182
|
+
mid.push(`<path d="${m}" stroke-width=".7"/>`);
|
|
183
|
+
}
|
|
184
|
+
else if (kind === "helix") {
|
|
185
|
+
const [, y0, y1, n, turns] = d;
|
|
186
|
+
let m = "";
|
|
187
|
+
for (let i = 0; i < n; i++) {
|
|
188
|
+
let pen = false;
|
|
189
|
+
for (let j = 0; j <= 16; j++) {
|
|
190
|
+
const u = j / 16;
|
|
191
|
+
const y = y0 + (y1 - y0) * u;
|
|
192
|
+
const deg = yaw + (360 * i) / n + 360 * turns * u;
|
|
193
|
+
if (Math.cos(deg * RAD) <= 0.05) {
|
|
194
|
+
pen = false;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
m += `${pen ? "L" : "M"}${where(radiusAt(p, y), y, deg)}`;
|
|
198
|
+
pen = true;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (m !== "") {
|
|
202
|
+
mid.push(`<path d="${m}" stroke-width="1.3" stroke-opacity=".75"/>`);
|
|
203
|
+
mid.push(`<path d="${m}" transform="translate(.9 -.5)" stroke="${mix(base.rgb, 0.6)}" stroke-width=".8" stroke-opacity=".7"/>`);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else if (kind === "net") {
|
|
207
|
+
const [, y0, y1, n] = d;
|
|
208
|
+
let m = "";
|
|
209
|
+
for (let i = 0; i < n; i++) {
|
|
210
|
+
const deg = yaw + (360 * i) / n;
|
|
211
|
+
for (const to of [deg + 360 / n, deg - 360 / n])
|
|
212
|
+
if (Math.cos(((deg + to) / 2) * RAD) > 0.05)
|
|
213
|
+
m += `M${where(radiusAt(p, y0), y0, deg)}L${where(radiusAt(p, y1), y1, to)}`;
|
|
214
|
+
}
|
|
215
|
+
if (m !== "")
|
|
216
|
+
mid.push(`<path d="${m}" stroke-width=".7"/>`);
|
|
217
|
+
}
|
|
218
|
+
else if (kind === "dots") {
|
|
219
|
+
const [, y, n, size, off = 0] = d;
|
|
220
|
+
let m = "";
|
|
221
|
+
for (let i = 0; i < n; i++) {
|
|
222
|
+
const deg = yaw + off + (360 * i) / n;
|
|
223
|
+
if (Math.cos(deg * RAD) > 0.1)
|
|
224
|
+
m += `M${where(radiusAt(p, y), y, deg)}h0`;
|
|
225
|
+
}
|
|
226
|
+
if (m !== "")
|
|
227
|
+
mid.push(`<path d="${m}" stroke-width="${size}" stroke="${mix(base.rgb, 0.45)}"/>`);
|
|
228
|
+
}
|
|
229
|
+
else if (kind === "disc") {
|
|
230
|
+
const t = tone(d[2]);
|
|
231
|
+
mid.push(ellipse(CX, top[0], d[1], d[1] * s, t.fill, ` stroke="${t.edge}"`));
|
|
232
|
+
}
|
|
233
|
+
else if (kind === "pills") {
|
|
234
|
+
const [, rho, n, length, width, name] = d;
|
|
235
|
+
const t = tone(name);
|
|
236
|
+
let m = "";
|
|
237
|
+
for (let i = 0; i < n; i++) {
|
|
238
|
+
const deg = yaw + (360 * i) / n;
|
|
239
|
+
m += `M${where(rho, top[0], deg - length / 2)}L${where(rho, top[0], deg + length / 2)}`;
|
|
240
|
+
}
|
|
241
|
+
mid.push(`<path d="${m}" stroke-width="${width}" stroke="${t.edge}"/><path d="${m}" stroke-width="${width - 0.9}" stroke="${t.light}"/>`);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
// Handles: a tube through the points of its plane, behind the body when it is on the far side.
|
|
246
|
+
for (const h of model.handles ?? []) {
|
|
247
|
+
const deg = h.a + yaw;
|
|
248
|
+
const t = tone(h.tone);
|
|
249
|
+
const sin = Math.sin(deg * RAD);
|
|
250
|
+
const cos = Math.cos(deg * RAD);
|
|
251
|
+
if (Math.abs(cos) < 0.02 && Math.abs(sin) < 0.1)
|
|
252
|
+
continue;
|
|
253
|
+
const pts = h.pts.map(([R, y]) => [CX + R * sin, y + s * R * cos]);
|
|
254
|
+
let d = `M${pt(pts[0][0], pts[0][1])}`;
|
|
255
|
+
for (let i = 0; i < pts.length - 1; i++) {
|
|
256
|
+
const p0 = pts[Math.max(0, i - 1)];
|
|
257
|
+
const p1 = pts[i];
|
|
258
|
+
const p2 = pts[i + 1];
|
|
259
|
+
const p3 = pts[Math.min(pts.length - 1, i + 2)];
|
|
260
|
+
d += `C${pt(p1[0] + (p2[0] - p0[0]) / 6, p1[1] + (p2[1] - p0[1]) / 6)} ${pt(p2[0] - (p3[0] - p1[0]) / 6, p2[1] - (p3[1] - p1[1]) / 6)} ${pt(p2[0], p2[1])}`;
|
|
261
|
+
}
|
|
262
|
+
const w = h.w ?? 2.6;
|
|
263
|
+
const piece = line ? `<path d="${d}" stroke-width="${f(w + 0.6)}"/>` : `<path d="${d}" stroke-width="${f(w + 1.1)}"${own(t)}/><path d="${d}" stroke="${flat ? t.fill : mix(t.rgb, 0.05)}" stroke-width="${f(w)}"/>`;
|
|
264
|
+
(cos >= 0 ? front : back).push(piece);
|
|
265
|
+
}
|
|
266
|
+
// Poles standing round a ring, each with a pennant at its top: those on the far side behind, those on the near side in front.
|
|
267
|
+
if (model.poles !== undefined) {
|
|
268
|
+
const o = model.poles;
|
|
269
|
+
const pole = tone("pole");
|
|
270
|
+
const flag = tone("accent");
|
|
271
|
+
const lines = { back: "", front: "" };
|
|
272
|
+
const flags = { back: "", front: "" };
|
|
273
|
+
for (let i = 0; i < o.n; i++) {
|
|
274
|
+
const deg = yaw + (360 * i) / o.n;
|
|
275
|
+
const near = Math.cos(deg * RAD) >= 0 ? "front" : "back";
|
|
276
|
+
const topY = o.top1 + ((o.top2 - o.top1) * i) / o.n;
|
|
277
|
+
const [x0, y0] = at(o.r0, o.y0, deg);
|
|
278
|
+
const [x1, y1] = at(o.r1, topY, deg);
|
|
279
|
+
lines[near] += `M${pt(x0, y0)}L${pt(x1, y1)}`;
|
|
280
|
+
const dir = Math.cos(deg * RAD) >= 0 ? 1 : -1;
|
|
281
|
+
const len = o.size * (0.5 + 0.9 * Math.abs(Math.cos(deg * RAD)));
|
|
282
|
+
flags[near] += `M${pt(x1, y1 + 0.2)}l${f(dir * len)} ${f(o.size * 0.28)} ${f(-dir * len)} ${f(o.size * 0.28)}z`;
|
|
283
|
+
}
|
|
284
|
+
const stick = line ? 1.2 : 1;
|
|
285
|
+
for (const near of ["back", "front"]) {
|
|
286
|
+
const out = near === "back" ? back : front;
|
|
287
|
+
out.push(`<path d="${lines[near]}" stroke="${line ? "currentColor" : mix(pole.rgb, -0.12)}" stroke-width="${stick}"/>`);
|
|
288
|
+
out.push(`<path d="${flags[near]}" fill="${line ? "none" : flat ? flag.fill : flag.fill}" stroke-width="${line ? 1.2 : 0.5}"${line ? "" : ` stroke="${flag.edge}"`}/>`);
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
// Balls (and the pineapple): a sphere with its seams, which turn with the yaw.
|
|
292
|
+
for (const ball of model.balls ?? []) {
|
|
293
|
+
const t = tone(ball.tone);
|
|
294
|
+
const rx = ball.r;
|
|
295
|
+
const ry = ball.ry ?? ball.r;
|
|
296
|
+
const cx = ball.cx ?? CX;
|
|
297
|
+
const cy = ball.cy;
|
|
298
|
+
const spherical = line || flat || ball.kind === "pine" ? t.fill : (() => {
|
|
299
|
+
const g = orbGradient(t.rgb);
|
|
300
|
+
grads.push(g);
|
|
301
|
+
return g.fill;
|
|
302
|
+
})();
|
|
303
|
+
const parts = [];
|
|
304
|
+
if (ball.kind === "football") {
|
|
305
|
+
const k = 1.36;
|
|
306
|
+
const shape = `M0 ${f(-ry)}C${f(k * rx)} ${f(-0.25 * ry)} ${f(k * rx)} ${f(0.25 * ry)} 0 ${f(ry)}C${f(-k * rx)} ${f(0.25 * ry)} ${f(-k * rx)} ${f(-0.25 * ry)} 0 ${f(-ry)}z`;
|
|
307
|
+
const sx = Math.sin(yaw * RAD) * rx * 0.55;
|
|
308
|
+
const lit = Math.cos(yaw * RAD) > 0.1;
|
|
309
|
+
const laces = lit ? `M${f(sx)} ${f(-ry * 0.5)}V${f(ry * 0.5)}${[-2, -1, 0, 1, 2].map((i) => `M${f(sx - 1.3)} ${f(i * ry * 0.19)}h2.6`).join("")}` : "";
|
|
310
|
+
parts.push(`<g transform="translate(${f(cx)} ${f(cy)}) rotate(${f(ball.rot ?? 0)})"><path d="${shape}" fill="${spherical}"/>${line || flat ? "" : `<path d="M${f(-rx * 0.62)} ${f(-ry * 0.42)}Q${f(-rx * 0.5)} ${f(-ry * 0.1)} ${f(-rx * 0.54)} ${f(ry * 0.3)}" stroke="#fff" stroke-opacity=".5" stroke-width="1.6" fill="none"/>`}<path d="${laces}" stroke-width="1.1"/></g>`);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
parts.push(ellipse(cx, cy, rx, ry, spherical));
|
|
314
|
+
let seams = "";
|
|
315
|
+
const meridian = (lon) => {
|
|
316
|
+
const l = ((((lon + 90) % 360) + 360) % 360) - 90;
|
|
317
|
+
if (l >= 90 && l <= 270)
|
|
318
|
+
return "";
|
|
319
|
+
const a = l > 90 ? l - 360 : l;
|
|
320
|
+
const sin = Math.sin(a * RAD);
|
|
321
|
+
return `M${pt(cx, cy - ry)}A${f(Math.abs(rx * sin))} ${f(ry)} 0 0 ${sin >= 0 ? 1 : 0} ${pt(cx, cy + ry)}`;
|
|
322
|
+
};
|
|
323
|
+
const equator = (k, dy = 0) => `M${pt(cx - rx * Math.sqrt(Math.max(0, 1 - (dy / ry) ** 2)), cy + dy)}Q${pt(cx, cy + dy + 2 * rx * s * Math.sqrt(Math.max(0, 1 - (dy / ry) ** 2)) * k)} ${pt(cx + rx * Math.sqrt(Math.max(0, 1 - (dy / ry) ** 2)), cy + dy)}`;
|
|
324
|
+
let patches = "";
|
|
325
|
+
switch (ball.kind) {
|
|
326
|
+
case "basket":
|
|
327
|
+
seams += equator(1);
|
|
328
|
+
for (let i = 0; i < 4; i++)
|
|
329
|
+
seams += meridian(yaw + i * 90);
|
|
330
|
+
break;
|
|
331
|
+
case "globe":
|
|
332
|
+
seams += equator(1) + equator(1, -ry * 0.5) + equator(1, ry * 0.5);
|
|
333
|
+
for (let i = 0; i < 6; i++)
|
|
334
|
+
seams += meridian(yaw + i * 30);
|
|
335
|
+
break;
|
|
336
|
+
case "base":
|
|
337
|
+
seams += meridian(yaw + 62) + meridian(yaw - 62);
|
|
338
|
+
break;
|
|
339
|
+
case "pine":
|
|
340
|
+
for (let i = 0; i < 6; i++)
|
|
341
|
+
seams += meridian(yaw + i * 30);
|
|
342
|
+
seams += equator(1, -ry * 0.45) + equator(1, 0) + equator(1, ry * 0.45);
|
|
343
|
+
break;
|
|
344
|
+
case "soccer":
|
|
345
|
+
for (const [lat, lon] of PENTAGONS) {
|
|
346
|
+
const la = lat * RAD;
|
|
347
|
+
const lo = (lon + yaw) * RAD;
|
|
348
|
+
const z = Math.cos(la) * Math.cos(lo);
|
|
349
|
+
if (z < 0.12)
|
|
350
|
+
continue;
|
|
351
|
+
const px = cx + rx * Math.cos(la) * Math.sin(lo);
|
|
352
|
+
const py = cy - rx * Math.sin(la) + s * rx * 0.0;
|
|
353
|
+
const dx = px - cx;
|
|
354
|
+
const dy = py - cy;
|
|
355
|
+
const dist = Math.hypot(dx, dy);
|
|
356
|
+
const ux = dist < 0.01 ? 1 : dx / dist;
|
|
357
|
+
const uy = dist < 0.01 ? 0 : dy / dist;
|
|
358
|
+
const squash = Math.max(0.28, z);
|
|
359
|
+
let d = "";
|
|
360
|
+
for (let i = 0; i < 5; i++) {
|
|
361
|
+
const ang = (i * 72 - 90) * RAD;
|
|
362
|
+
const lx = rx * 0.36 * Math.cos(ang);
|
|
363
|
+
const ly = rx * 0.36 * Math.sin(ang);
|
|
364
|
+
const along = lx * ux + ly * uy;
|
|
365
|
+
const across = -lx * uy + ly * ux;
|
|
366
|
+
d += `${i === 0 ? "M" : "L"}${pt(px + along * squash * ux - across * uy, py + along * squash * uy + across * ux)}`;
|
|
367
|
+
}
|
|
368
|
+
patches += `${d}z`;
|
|
369
|
+
}
|
|
370
|
+
break;
|
|
371
|
+
default:
|
|
372
|
+
break;
|
|
373
|
+
}
|
|
374
|
+
if (patches !== "")
|
|
375
|
+
parts.push(`<path d="${patches}" fill="${line ? "none" : t.deep}" stroke-width="1"/>`);
|
|
376
|
+
if (seams !== "") {
|
|
377
|
+
if (ball.kind === "base")
|
|
378
|
+
parts.push(`<path d="${seams}" stroke="${line ? "currentColor" : "#c0392b"}" stroke-width="${line ? 1.6 : 1.1}" stroke-dasharray="${line ? "none" : "1.4 1"}"/>`);
|
|
379
|
+
else
|
|
380
|
+
parts.push(`<path d="${seams}" stroke-width="${line ? 1.5 : ball.kind === "pine" ? 0.7 : 1}"${ball.kind === "basket" && !line ? ` stroke="${mix(t.rgb, -0.55)}"` : ""}/>`);
|
|
381
|
+
}
|
|
382
|
+
if (!line && !flat && ball.kind !== "pine")
|
|
383
|
+
parts.push(`<ellipse cx="${f(cx - rx * 0.36)}" cy="${f(cy - ry * 0.4)}" rx="${f(rx * 0.3)}" ry="${f(ry * 0.2)}" fill="#fff" fill-opacity=".38" stroke="none" transform="rotate(-30 ${f(cx - rx * 0.36)} ${f(cy - ry * 0.4)})"/>`);
|
|
384
|
+
}
|
|
385
|
+
mid.push(...parts);
|
|
386
|
+
}
|
|
387
|
+
return { body: back.join("") + mid.join("") + front.join(""), defs: line || flat ? "" : defsOf(grads), edge: main.edge };
|
|
388
|
+
}
|
|
389
|
+
/** The twelve pentagons of a ball, as the centres of a sphere's faces: the poles and two rings of five. */
|
|
390
|
+
const PENTAGONS = [
|
|
391
|
+
[90, 0], [26.57, 0], [26.57, 72], [26.57, 144], [26.57, 216], [26.57, 288],
|
|
392
|
+
[-26.57, 36], [-26.57, 108], [-26.57, 180], [-26.57, 252], [-26.57, 324], [-90, 0],
|
|
393
|
+
];
|
|
394
|
+
/** A lathe emblem: the object with its names and its model, the still drawing and the turned one. */
|
|
395
|
+
export function defineLathe(id, en, ja, source, model) {
|
|
396
|
+
const frame = (o) => {
|
|
397
|
+
const r = resolve(o);
|
|
398
|
+
const yaw = typeof o?.yaw === "number" && Number.isFinite(o.yaw) ? o.yaw % 360 : 0;
|
|
399
|
+
const pitch = typeof o?.pitch === "number" && Number.isFinite(o.pitch) ? Math.max(-40, Math.min(60, o.pitch)) : 0;
|
|
400
|
+
const d = draw(model, r, yaw, pitch);
|
|
401
|
+
return wrap({ title: en, size: r.size, style: r.style, theme: r.theme, defs: d.defs, body: d.body, edge: d.edge, width: r.style === "line" ? 2.3 : 0.6 });
|
|
402
|
+
};
|
|
403
|
+
return { id, en, ja, source, kind: "lathe", model, svg: (o) => frame(o), frame };
|
|
404
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type Emblem, type Metal } from "./emblem.core.ts";
|
|
2
|
+
/** What a Material icon is drawn from: its two paths, in a 960 box whose top is at -960, and the metal that paints it. */
|
|
3
|
+
export interface MaterialModel {
|
|
4
|
+
outlined: string;
|
|
5
|
+
filled: string;
|
|
6
|
+
metal: Metal;
|
|
7
|
+
}
|
|
8
|
+
/** An icon from Material Symbols. A `flat` icon is drawn in the page's ink unless it is tinted. */
|
|
9
|
+
export declare function defineMaterial(id: string, en: string, ja: string, paths: readonly [outlined: string, filled: string], metal: Metal): Emblem<MaterialModel>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** The commit of google/material-design-icons these paths come from. */
|
|
2
|
+
export declare const MATERIAL_COMMIT = "49d4db35df873165d6bd6ba09b063c7dafbac2f4";
|
|
3
|
+
/** Material Symbols `emoji_events`. */
|
|
4
|
+
export declare const M_EMOJI_EVENTS: readonly [string, string];
|
|
5
|
+
/** Material Symbols `military_tech`. */
|
|
6
|
+
export declare const M_MILITARY_TECH: readonly [string, string];
|
|
7
|
+
/** Material Symbols `workspace_premium`. */
|
|
8
|
+
export declare const M_WORKSPACE_PREMIUM: readonly [string, string];
|
|
9
|
+
/** Material Symbols `crown`. */
|
|
10
|
+
export declare const M_CROWN: readonly [string, string];
|
|
11
|
+
/** Material Symbols `star`. */
|
|
12
|
+
export declare const M_STAR: readonly [string, string];
|
|
13
|
+
/** Material Symbols `shield`. */
|
|
14
|
+
export declare const M_SHIELD: readonly [string, string];
|
|
15
|
+
/** Material Symbols `sports_football`. */
|
|
16
|
+
export declare const M_SPORTS_FOOTBALL: readonly [string, string];
|
|
17
|
+
/** Material Symbols `sports_hockey`. */
|
|
18
|
+
export declare const M_SPORTS_HOCKEY: readonly [string, string];
|
|
19
|
+
/** Material Symbols `sports_basketball`. */
|
|
20
|
+
export declare const M_SPORTS_BASKETBALL: readonly [string, string];
|
|
21
|
+
/** Material Symbols `sports_baseball`. */
|
|
22
|
+
export declare const M_SPORTS_BASEBALL: readonly [string, string];
|
|
23
|
+
/** Material Symbols `sports_soccer`. */
|
|
24
|
+
export declare const M_SPORTS_SOCCER: readonly [string, string];
|
|
25
|
+
/** Material Symbols `sports_tennis`. */
|
|
26
|
+
export declare const M_SPORTS_TENNIS: readonly [string, string];
|
|
27
|
+
/** Material Symbols `sports_volleyball`. */
|
|
28
|
+
export declare const M_SPORTS_VOLLEYBALL: readonly [string, string];
|
|
29
|
+
/** Material Symbols `sports_cricket`. */
|
|
30
|
+
export declare const M_SPORTS_CRICKET: readonly [string, string];
|
|
31
|
+
/** Material Symbols `sports_rugby`. */
|
|
32
|
+
export declare const M_SPORTS_RUGBY: readonly [string, string];
|
|
33
|
+
/** Material Symbols `sports_handball`. */
|
|
34
|
+
export declare const M_SPORTS_HANDBALL: readonly [string, string];
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
// Generated by scripts/fetch-material-symbols.mjs: do not edit by hand.
|
|
2
|
+
// Material Symbols by Google, from google/material-design-icons at 49d4db35df873165d6bd6ba09b063c7dafbac2f4, under the Apache License 2.0 (NOTICE.md).
|
|
3
|
+
// Each icon is [outlined, filled]: the paths of a 960 by 960 box whose top is at -960 (viewBox "0 -960 960 960").
|
|
4
|
+
/** The commit of google/material-design-icons these paths come from. */
|
|
5
|
+
export const MATERIAL_COMMIT = "49d4db35df873165d6bd6ba09b063c7dafbac2f4";
|
|
6
|
+
/** Material Symbols `emoji_events`. */
|
|
7
|
+
export const M_EMOJI_EVENTS = [
|
|
8
|
+
"M280-120v-80h160v-124q-49-11-87.5-41.5T296-442q-75-9-125.5-65.5T120-640v-40q0-33 23.5-56.5T200-760h80v-80h400v80h80q33 0 56.5 23.5T840-680v40q0 76-50.5 132.5T664-442q-18 46-56.5 76.5T520-324v124h160v80H280Zm0-408v-152h-80v40q0 38 22 68.5t58 43.5Zm200 128q50 0 85-35t35-85v-240H360v240q0 50 35 85t85 35Zm200-128q36-13 58-43.5t22-68.5v-40h-80v152Zm-200-52Z",
|
|
9
|
+
"M280-120v-80h160v-124q-49-11-87.5-41.5T296-442q-75-9-125.5-65.5T120-640v-40q0-33 23.5-56.5T200-760h80v-80h400v80h80q33 0 56.5 23.5T840-680v40q0 76-50.5 132.5T664-442q-18 46-56.5 76.5T520-324v124h160v80H280Zm0-408v-152h-80v40q0 38 22 68.5t58 43.5Zm400 0q36-13 58-43.5t22-68.5v-40h-80v152Z",
|
|
10
|
+
];
|
|
11
|
+
/** Material Symbols `military_tech`. */
|
|
12
|
+
export const M_MILITARY_TECH = [
|
|
13
|
+
"M280-880h400v314q0 23-10 41t-28 29l-142 84 28 92h152l-124 88 48 152-124-94-124 94 48-152-124-88h152l28-92-142-84q-18-11-28-29t-10-41v-314Zm80 80v234l80 48v-282h-80Zm240 0h-80v282l80-48v-234ZM480-647Zm-40-12Zm80 0Z",
|
|
14
|
+
"M280-880h400v314q0 23-10 41t-28 29l-142 84 28 92h152l-124 88 48 152-124-94-124 94 48-152-124-88h152l28-92-142-84q-18-11-28-29t-10-41v-314Zm160 80v282l40 24 40-24v-282h-80Z",
|
|
15
|
+
];
|
|
16
|
+
/** Material Symbols `workspace_premium`. */
|
|
17
|
+
export const M_WORKSPACE_PREMIUM = [
|
|
18
|
+
"m387-412 35-114-92-74h114l36-112 36 112h114l-93 74 35 114-92-71-93 71ZM240-40v-309q-38-42-59-96t-21-115q0-134 93-227t227-93q134 0 227 93t93 227q0 61-21 115t-59 96v309l-240-80-240 80Zm240-280q100 0 170-70t70-170q0-100-70-170t-170-70q-100 0-170 70t-70 170q0 100 70 170t170 70ZM320-159l160-41 160 41v-124q-35 20-75.5 31.5T480-240q-44 0-84.5-11.5T320-283v124Zm160-62Z",
|
|
19
|
+
"m387-412 35-114-92-74h114l36-112 36 112h114l-93 74 35 114-92-71-93 71ZM240-40v-309q-38-42-59-96t-21-115q0-134 93-227t227-93q134 0 227 93t93 227q0 61-21 115t-59 96v309l-240-80-240 80Zm240-280q100 0 170-70t70-170q0-100-70-170t-170-70q-100 0-170 70t-70 170q0 100 70 170t170 70Z",
|
|
20
|
+
];
|
|
21
|
+
/** Material Symbols `crown`. */
|
|
22
|
+
export const M_CROWN = [
|
|
23
|
+
"M200-160v-80h560v80H200Zm0-140-51-321q-2 0-4.5.5t-4.5.5q-25 0-42.5-17.5T80-680q0-25 17.5-42.5T140-740q25 0 42.5 17.5T200-680q0 7-1.5 13t-3.5 11l125 56 125-171q-11-8-18-21t-7-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820q0 15-7 28t-18 21l125 171 125-56q-2-5-3.5-11t-1.5-13q0-25 17.5-42.5T820-740q25 0 42.5 17.5T880-680q0 25-17.5 42.5T820-620q-2 0-4.5-.5t-4.5-.5l-51 321H200Zm68-80h424l26-167-105 46-133-183-133 183-105-46 26 167Zm212 0Z",
|
|
24
|
+
"M200-160v-80h560v80H200Zm0-140-51-321q-2 0-4.5.5t-4.5.5q-25 0-42.5-17.5T80-680q0-25 17.5-42.5T140-740q25 0 42.5 17.5T200-680q0 7-1.5 13t-3.5 11l125 56 125-171q-11-8-18-21t-7-28q0-25 17.5-42.5T480-880q25 0 42.5 17.5T540-820q0 15-7 28t-18 21l125 171 125-56q-2-5-3.5-11t-1.5-13q0-25 17.5-42.5T820-740q25 0 42.5 17.5T880-680q0 25-17.5 42.5T820-620q-2 0-4.5-.5t-4.5-.5l-51 321H200Z",
|
|
25
|
+
];
|
|
26
|
+
/** Material Symbols `star`. */
|
|
27
|
+
export const M_STAR = [
|
|
28
|
+
"m354-287 126-76 126 77-33-144 111-96-146-13-58-136-58 135-146 13 111 97-33 143ZM233-120l65-281L80-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Zm247-350Z",
|
|
29
|
+
"m233-120 65-281L80-590l288-25 112-265 112 265 288 25-218 189 65 281-247-149-247 149Z",
|
|
30
|
+
];
|
|
31
|
+
/** Material Symbols `shield`. */
|
|
32
|
+
export const M_SHIELD = [
|
|
33
|
+
"M480-80q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Zm0-84q104-33 172-132t68-220v-189l-240-90-240 90v189q0 121 68 220t172 132Zm0-316Z",
|
|
34
|
+
"M480-80q-139-35-229.5-159.5T160-516v-244l320-120 320 120v244q0 152-90.5 276.5T480-80Z",
|
|
35
|
+
];
|
|
36
|
+
/** Material Symbols `sports_football`. */
|
|
37
|
+
export const M_SPORTS_FOOTBALL = [
|
|
38
|
+
"M480-480ZM362-202 202-362q-3 38-1.5 79t7.5 73q23 7 69.5 9t84.5-1Zm96-16q59-13 106-37t82-59q34-34 58-80.5T742-500L500-742q-57 14-103 38.5T316-644q-35 35-59.5 81.5T218-458l240 240Zm-62-122-56-56 224-224 56 56-224 224Zm362-256q4-39 2.5-81t-8.5-73q-23-8-69.5-10t-84.5 2l160 162ZM310-120q-57 0-104-8.5T148-148q-11-12-19.5-60T120-314q0-119 36-220.5T258-702q66-66 169-102t223-36q58 0 104.5 8.5T812-812q11 12 19.5 60t8.5 108q0 117-36 218.5T702-258q-65 65-168 101.5T310-120Z",
|
|
39
|
+
"M363-121q-47 5-113.5-2.5T148-148q-14-32-23.5-100T120-364l243 243Zm95-16L136-459q17-75 49.5-136.5T261-701q43-43 104.5-74.5T498-823l324 324q-16 74-47 136t-74 105q-45 44-107.5 75.5T458-137Zm-82-183 264-264-56-56-264 264 56 56Zm462-274L595-839q48-6 118 2t99 25q18 40 25 103.5t1 114.5Z",
|
|
40
|
+
];
|
|
41
|
+
/** Material Symbols `sports_hockey`. */
|
|
42
|
+
export const M_SPORTS_HOCKEY = [
|
|
43
|
+
"M80-160v-120q0-17 11.5-28.5T120-320h40v160H80Zm120 0v-160h160l34-78 64 140-34 76q-5 11-15 16.5t-21 5.5H200Zm600 0v-160h40q17 0 28.5 11.5T880-280v120h-80Zm-40 0H572q-11 0-21-5.5T536-182L254-800h134l92 208 92-208h134L544-446l56 126h160v160Z",
|
|
44
|
+
"M80-160v-120q0-17 11.5-28.5T120-320h40v160H80Zm120 0v-160h160l34-78 64 140-34 76q-5 11-15 16.5t-21 5.5H200Zm600 0v-160h40q17 0 28.5 11.5T880-280v120h-80Zm-40 0H572q-11 0-21-5.5T536-182L254-800h134l92 208 92-208h134L544-446l56 126h160v160Z",
|
|
45
|
+
];
|
|
46
|
+
/** Material Symbols `sports_basketball`. */
|
|
47
|
+
export const M_SPORTS_BASKETBALL = [
|
|
48
|
+
"M162-520h114q-6-38-23-71t-43-59q-18 29-30.5 61.5T162-520Zm522 0h114q-5-36-17.5-68.5T750-650q-26 26-43 59t-23 71ZM210-310q26-26 43-59t23-71H162q5 36 17.5 68.5T210-310Zm540 0q18-29 30.5-61.5T798-440H684q6 38 23 71t43 59ZM358-520h82v-278q-53 8-98.5 29.5T260-712q39 38 64.5 86.5T358-520Zm162 0h82q8-57 33.5-105.5T700-712q-36-35-81.5-56.5T520-798v278Zm-80 358v-278h-82q-8 57-33.5 105.5T260-248q36 35 81.5 56.5T440-162Zm80 0q53-8 98.5-29.5T700-248q-39-38-64.5-86.5T602-440h-82v278Zm-40-318Zm0 400q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z",
|
|
49
|
+
"M82-521q5-51 21-96.5t44-85.5q35 36 58.5 83.5T236-521H82Zm642 0q7-51 30-98t59-83q28 39 44 85t21 96H724ZM147-258q-28-39-44-84.5T82-439h154q-7 51-30.5 98T147-258Zm666 0q-36-36-59-83t-30-98h154q-5 50-21 96t-44 85ZM317-521q-8-72-39-133t-81-110q48-48 109.5-77T439-878v357H317Zm204 0v-357q71 8 132.5 37T763-764q-51 48-81.5 109.5T643-521H521ZM439-82q-72-8-133-37.5T197-197q51-48 81.5-109T317-439h122v357Zm82 0v-357h122q8 72 38.5 133.5T763-196q-48 48-109.5 77T521-82Z",
|
|
50
|
+
];
|
|
51
|
+
/** Material Symbols `sports_baseball`. */
|
|
52
|
+
export const M_SPORTS_BASEBALL = [
|
|
53
|
+
"M224-288q45-35 70.5-85T320-480q0-57-25.5-107T224-672q-31 42-47.5 91T160-480q0 52 16.5 101t47.5 91Zm256 128q55 0 106.5-17.5T680-230q-57-46-88.5-111.5T560-480q0-73 31.5-138.5T680-730q-42-35-93.5-52.5T480-800q-55 0-106.5 17.5T280-730q57 46 88.5 111.5T400-480q0 73-31.5 138.5T280-230q42 35 93.5 52.5T480-160Zm256-128q31-42 47.5-91T800-480q0-52-16.5-101T736-672q-45 35-70.5 85T640-480q0 57 25.5 107t70.5 85ZM480-480Zm0 400q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z",
|
|
54
|
+
"M167-231q-42-54-64.5-117.5T80-480q0-68 22.5-131.5T167-729q58 45 91 110.5T291-480q0 73-33 138.5T167-231ZM480-80q-72 0-137.5-24T223-174q69-57 108-136.5T370-480q0-90-39-169.5T223-786q54-46 119.5-70T480-880q72 0 137.5 24T737-786q-69 57-108 136.5T590-480q0 90 39 169.5T737-174q-54 46-119.5 70T480-80Zm313-151q-58-45-91-110.5T669-480q0-73 33-138.5T793-729q42 54 64.5 117.5T880-480q0 68-22.5 131.5T793-231Z",
|
|
55
|
+
];
|
|
56
|
+
/** Material Symbols `sports_soccer`. */
|
|
57
|
+
export const M_SPORTS_SOCCER = [
|
|
58
|
+
"M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm200-500 54-18 16-54q-32-48-77-82.5T574-786l-54 38v56l160 112Zm-400 0 160-112v-56l-54-38q-54 17-99 51.5T210-652l16 54 54 18Zm-42 308 46-4 30-54-58-174-56-20-40 30q0 65 18 118.5T238-272Zm242 112q26 0 51-4t49-12l28-60-26-44H378l-26 44 28 60q24 8 49 12t51 4Zm-90-200h180l56-160-146-102-144 102 54 160Zm332 88q42-50 60-103.5T800-494l-40-28-56 18-58 174 30 54 46 4Z",
|
|
59
|
+
"M480-80q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Zm200-500 54-18 16-54q-32-48-77-82.5T574-786l-54 38v56l160 112Zm-400 0 160-112v-56l-54-38q-54 17-99 51.5T210-652l16 54 54 18Zm-42 308 46-4 30-54-58-174-56-20-40 30q0 65 18 118.5T238-272Zm242 112q26 0 51-4t49-12l28-60-26-44H378l-26 44 28 60q24 8 49 12t51 4Zm-90-200h180l56-160-146-102-144 102 54 160Zm332 88q42-50 60-103.5T800-494l-40-28-56 18-58 174 30 54 46 4Z",
|
|
60
|
+
];
|
|
61
|
+
/** Material Symbols `sports_tennis`. */
|
|
62
|
+
export const M_SPORTS_TENNIS = [
|
|
63
|
+
"m137-160-57-56 164-164q31-31 42.5-77.5T298-600q0-58 26-114t74-104q91-91 201-103t181 61q72 72 60 182T738-478q-48 48-104 74t-114 26q-97 0-142 11t-77 43L137-160Zm275-334q47 46 127 34t143-75q64-64 76.5-143.5T724-803q-48-48-125.5-36T456-763q-63 63-76.5 142.5T412-494ZM720-40q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113T720-40Zm0-80q33 0 56.5-23.5T800-200q0-33-23.5-56.5T720-280q-33 0-56.5 23.5T640-200q0 33 23.5 56.5T720-120Zm0-80Z",
|
|
64
|
+
"m137-160-57-56 164-164q31-31 42.5-77.5T298-600q0-58 26-114t74-104q91-91 201-103t181 61q72 72 60 182T738-478q-48 48-104 74t-114 26q-97 0-142 11t-77 43L137-160Zm275-334q47 46 127 34t143-75q64-64 76.5-143.5T724-803q-48-48-125.5-36T456-763q-63 63-76.5 142.5T412-494ZM720-40q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 66-47 113T720-40Z",
|
|
65
|
+
];
|
|
66
|
+
/** Material Symbols `sports_volleyball`. */
|
|
67
|
+
export const M_SPORTS_VOLLEYBALL = [
|
|
68
|
+
"M782-582q-31-87-101-145.5T520-798v64l262 152ZM320-434l120-70v-294q-32 3-62 14.5T320-756v322Zm-134 78 54-32v-302q-39 44-59.5 98T160-480q0 32 6.5 63.5T186-356Zm134 152 280-160-120-70-254 148q20 25 43 46t51 36Zm160 44q75 0 142-34t112-94l-54-30-264 152q16 3 32 4.5t32 1.5Zm294-196q13-29 19.5-60.5T800-480L520-642v138l254 148ZM480-480Zm0 400q-83 0-156-31.5T197-197q-54-54-85.5-127T80-480q0-83 31.5-156T197-763q54-54 127-85.5T480-880q83 0 156 31.5T763-763q54 54 85.5 127T880-480q0 83-31.5 156T763-197q-54 54-127 85.5T480-80Z",
|
|
69
|
+
"M864-592 520-791v-87q123 12 216 90.5T864-592ZM270-404v-416q39-23 82-38t89-20v375l-171 99Zm-154 89q-18-38-27-79.5T80-480q0-77 28-147.5T190-754v395l-74 44Zm176 187q-42-20-76-50t-60-68l325-188 171 99-360 207Zm189 48q-23 0-47-2.5T388-91l344-198 74 41q-57 78-142.5 123T481-80Zm364-236L520-503v-197l360 209q0 46-8 90t-27 85Z",
|
|
70
|
+
];
|
|
71
|
+
/** Material Symbols `sports_cricket`. */
|
|
72
|
+
export const M_SPORTS_CRICKET = [
|
|
73
|
+
"M600-392 488-280q-12 12-28 12t-28-12L92-620q-12-12-12-27t12-27l112-112q12-12 29-12t29 12l338 338q12 12 12 28t-12 28Zm-140 28 56-56-284-284-56 56 284 284ZM744-80 574-250l56-56 170 170-56 56Zm-4-520q-58 0-99-41t-41-99q0-58 41-99t99-41q58 0 99 41t41 99q0 58-41 99t-99 41Zm0-80q25 0 42.5-17.5T800-740q0-25-17.5-42.5T740-800q-25 0-42.5 17.5T680-740q0 25 17.5 42.5T740-680Zm0-60ZM346-534Z",
|
|
74
|
+
"M600-392 488-280q-12 12-28 12t-28-12L92-620q-12-12-12-27t12-27l112-112q12-12 29-12t29 12l338 338q12 12 12 28t-12 28ZM744-80 574-250l56-56 170 170-56 56Zm-4-520q-58 0-99-41t-41-99q0-58 41-99t99-41q58 0 99 41t41 99q0 58-41 99t-99 41Z",
|
|
75
|
+
];
|
|
76
|
+
/** Material Symbols `sports_rugby`. */
|
|
77
|
+
export const M_SPORTS_RUGBY = [
|
|
78
|
+
"M306-100q-57 0-103-9t-65-29q-18-19-28-66t-10-106q0-115 40.5-220.5T252-708q71-71 177.5-111.5T654-860q57 0 103 9t65 29q18 19 28 66t10 106q0 115-40.5 220.5T708-252q-71 71-177.5 111.5T306-100ZM182-326q33-72 80-140.5T366-594q57-57 125.5-104T632-778q-91 3-178.5 37.5T310-650q-59 57-92.5 143T182-326Zm146 144q91-3 178.5-37.5T650-310q59-57 92.5-143T778-634q-33 72-79.5 140.5T594-366q-57 57-125.5 104T328-182Zm-100-46q80-27 163-80t145-116q66-65 119-148t77-160q-80 27-163 80T424-536q-66 65-119 148t-77 160Zm252-252Z",
|
|
79
|
+
"M306-100q-57 0-103-9t-65-29q-18-19-28-66t-10-106q0-115 40.5-220.5T252-708q71-71 177.5-111.5T654-860q57 0 103 9t65 29q18 19 28 66t10 106q0 115-40.5 220.5T708-252q-71 71-177.5 111.5T306-100ZM182-326q33-72 80-140.5T366-594q57-57 125.5-104T632-778q-91 3-178.5 37.5T310-650q-59 57-92.5 143T182-326Zm146 144q91-3 178.5-37.5T650-310q59-57 92.5-143T778-634q-33 72-80 140.5T594-366q-57 57-125.5 104T328-182Z",
|
|
80
|
+
];
|
|
81
|
+
/** Material Symbols `sports_handball`. */
|
|
82
|
+
export const M_SPORTS_HANDBALL = [
|
|
83
|
+
"m368-4-70-40 120-208-68-40-60 104-70-40 206-356q-38-39-57-89t-19-103q0-36 9-71.5t29-68.5l68 40q-14 23-20 47.5t-6 50.5q0 53 26 99.5t74 74.5l90 52q62 36 91 103.5T740-322q0 38-10 74t-28 68l-70-40q14-24 20-49t6-51q0-32-9-62t-29-56L368-4Zm272-596q-33 0-56.5-23.5T560-680q0-33 23.5-56.5T640-760q33 0 56.5 23.5T720-680q0 33-23.5 56.5T640-600ZM540-800q-26 0-43-18t-17-42q0-26 18-43t42-17q26 0 43 18t17 42q0 26-18 43t-42 17Z",
|
|
84
|
+
"m368-4-70-40 120-208-68-40-60 104-70-40 206-356q-38-39-57-89t-19-103q0-36 9-71.5t29-68.5l68 40q-14 23-20 47.5t-6 50.5q0 53 26 99.5t74 74.5l90 52q62 36 91 103.5T740-322q0 38-10 74t-28 68l-70-40q14-24 20-49t6-51q0-32-9-62t-29-56L368-4Zm272-596q-33 0-56.5-23.5T560-680q0-33 23.5-56.5T640-760q33 0 56.5 23.5T720-680q0 33-23.5 56.5T640-600ZM540-800q-26 0-43-18t-17-42q0-26 18-43t42-17q26 0 43 18t17 42q0 26-18 43t-42 17Z",
|
|
85
|
+
];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// A Material Symbols icon (Google, Apache License 2.0; see NOTICE.md): the filled symbol is the metal style (with a gradient and a darker edge), the outlined symbol is the line style, and the `color` style
|
|
2
|
+
// is the filled symbol in one flat colour. The paths are data in emblem.material.data.ts, one constant each, so an icon's module takes only its own. Imports only the core.
|
|
3
|
+
import { defsOf, hexOf, mainOf, mix, resolve, sheetGradient, wrap } from "./emblem.core.js";
|
|
4
|
+
/** An icon from Material Symbols. A `flat` icon is drawn in the page's ink unless it is tinted. */
|
|
5
|
+
export function defineMaterial(id, en, ja, paths, metal) {
|
|
6
|
+
const model = { outlined: paths[0], filled: paths[1], metal };
|
|
7
|
+
const svg = (o) => {
|
|
8
|
+
const r = resolve(o);
|
|
9
|
+
const main = mainOf(metal, r.tint);
|
|
10
|
+
const coloured = r.tint !== undefined || metal !== "flat";
|
|
11
|
+
const gradient = sheetGradient(main);
|
|
12
|
+
const edge = mix(main, -0.45);
|
|
13
|
+
let body;
|
|
14
|
+
if (r.style === "line")
|
|
15
|
+
body = `<path d="${paths[0]}" fill="currentColor" stroke="none"/>`;
|
|
16
|
+
else if (!coloured)
|
|
17
|
+
body = `<path d="${paths[1]}" fill="currentColor" stroke="none"/>`;
|
|
18
|
+
else
|
|
19
|
+
body = `<path d="${paths[1]}" fill="${r.style === "metal" ? gradient.fill : hexOf(main)}" stroke="${edge}" stroke-width="12"/>`;
|
|
20
|
+
return wrap({ box: "0 -960 960 960", title: en, size: r.size, style: r.style, theme: r.theme, defs: r.style === "metal" && coloured ? defsOf([gradient]) : "", body });
|
|
21
|
+
};
|
|
22
|
+
return { id, en, ja, source: "material", kind: "icon", model, svg, frame: svg };
|
|
23
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { Emblem, Metal } from "./emblem.core.ts";
|
|
2
|
+
import { type FlatModel } from "./emblem.shapes.ts";
|
|
3
|
+
/** A medal on a ribbon. */
|
|
4
|
+
export declare function defineMedal(id: string, en: string, ja: string, metal: Extract<Metal, "gold" | "silver" | "bronze">): Emblem<FlatModel>;
|
|
5
|
+
/** A plain badge for a place: a bevelled disc with its numeral. */
|
|
6
|
+
export declare function definePlace(id: string, en: string, ja: string, place: 1 | 2 | 3, metal: Extract<Metal, "gold" | "silver" | "bronze">): Emblem<FlatModel>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { circlePath, defineFlat, starPath } from "./emblem.shapes.js";
|
|
2
|
+
/** The colours of the ribbon's stripes, in the order of the five colours a games uses; the ribbon carries no rings. */
|
|
3
|
+
const STRIPES = ["#0085c7", "#f4c300", "#1b1b1b", "#009f3d", "#df0024"];
|
|
4
|
+
const lerp = (a, b, t) => Math.round((a + (b - a) * t) * 10) / 10;
|
|
5
|
+
/** The two straps of the ribbon, crossing above the clasp, each cut into the five stripes. */
|
|
6
|
+
function ribbon() {
|
|
7
|
+
const out = [];
|
|
8
|
+
STRIPES.forEach((colour, k) => {
|
|
9
|
+
const [t0, t1] = [k / 5, (k + 1) / 5];
|
|
10
|
+
// The left strap runs from the top left to the clasp, the right one the other way.
|
|
11
|
+
out.push(["f", `M${lerp(10, 25, t0)} 2L${lerp(10, 25, t1)} 2L${lerp(26, 38, t1)} 28L${lerp(26, 38, t0)} 28z`, colour]);
|
|
12
|
+
out.push(["f", `M${lerp(54, 39, t0)} 2L${lerp(54, 39, t1)} 2L${lerp(38, 26, t1)} 28L${lerp(38, 26, t0)} 28z`, colour]);
|
|
13
|
+
});
|
|
14
|
+
return out;
|
|
15
|
+
}
|
|
16
|
+
/** A medal on a ribbon. */
|
|
17
|
+
export function defineMedal(id, en, ja, metal) {
|
|
18
|
+
const disc = [
|
|
19
|
+
["m", "M27.5 23h9v8h-9z"],
|
|
20
|
+
["o", circlePath(32, 43, 17.5)],
|
|
21
|
+
["e", circlePath(32, 43, 15.2), "1.8"],
|
|
22
|
+
];
|
|
23
|
+
const front = [
|
|
24
|
+
...ribbon(),
|
|
25
|
+
...disc,
|
|
26
|
+
["m", starPath(32, 43, 9, 3.9)],
|
|
27
|
+
["l", "M19.2 40a13.4 13.4 0 0 1 9.4-10.4 14 14 0 0 0-6.6 12.6z"],
|
|
28
|
+
];
|
|
29
|
+
const back = [...disc, ["e", circlePath(32, 43, 8.4), "1.4"]];
|
|
30
|
+
return defineFlat(id, en, ja, "ours", { metal, front, back, rim: 3 });
|
|
31
|
+
}
|
|
32
|
+
/** The numerals 1, 2 and 3 as strokes. */
|
|
33
|
+
const NUMERALS = { 1: "M26 28l7-5v20", 2: "M25 28c1-9 15-9 15 0 0 6-14 9-15 15h16", 3: "M25 26c4-6 14-4 13 2-1 5-6 6-9 6 3 0 9 1 9 7 0 8-14 9-16 2" };
|
|
34
|
+
/** A plain badge for a place: a bevelled disc with its numeral. */
|
|
35
|
+
export function definePlace(id, en, ja, place, metal) {
|
|
36
|
+
const base = [["o", circlePath(32, 32, 27.5)], ["e", circlePath(32, 32, 24.2), "2.2"]];
|
|
37
|
+
return defineFlat(id, en, ja, "ours", { metal, front: [...base, ["d", NUMERALS[place]], ["l", "M10.4 28a22 22 0 0 1 16.6-17 24 24 0 0 0-11 22z"]], back: [...base, ["e", circlePath(32, 32, 14), "1.6"]], rim: 3 });
|
|
38
|
+
}
|