@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 @@
|
|
|
1
|
+
export declare const BALL_BASKETBALL_6: import("./ball.core.ts").Piece<import("./ball.engine.ts").BallSpec>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Basketball, size 6 (women's competitions): the same pattern a little smaller, here a shade lighter.
|
|
2
|
+
import { defineBall } from "./ball.engine.js";
|
|
3
|
+
import { basketballSpec } from "./ball.basketball.js";
|
|
4
|
+
export const BALL_BASKETBALL_6 = /* @__PURE__ */ defineBall({
|
|
5
|
+
id: "ball:basketball-6",
|
|
6
|
+
en: "Basketball, size 6",
|
|
7
|
+
ja: "バスケットボール(6号球)",
|
|
8
|
+
size: { extentMm: 230.0, diameterMm: 230.0, circumferenceMm: 722.5, massG: [510, 550], rule: "FIBA Basketball Equipment 2026, Rule 2 Basketballs, 2.4 and Table 1 (size 6 = women's competitions)", note: "Diameter worked out from the middle of the circumference range." },
|
|
9
|
+
spec: basketballSpec("#e57a26"),
|
|
10
|
+
});
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** `metal` (also written `colour`): full colour, with shading. `line`: one outline in `currentColor`. */
|
|
2
|
+
export type PieceStyle = "metal" | "colour" | "color" | "line";
|
|
3
|
+
/** `inherit` (the default): the page's text colour. `auto`: dark ink on a light device and pale ink on a dark one. `light` and `dark` force one. */
|
|
4
|
+
export type PieceTheme = "inherit" | "auto" | "light" | "dark";
|
|
5
|
+
export interface PieceOptions {
|
|
6
|
+
/** `metal` or `colour` (the default) or `line`. */
|
|
7
|
+
style?: PieceStyle;
|
|
8
|
+
/** The width and height in pixels (64 by default); the drawing is a vector at any size. */
|
|
9
|
+
size?: number;
|
|
10
|
+
/** A colour that replaces the main colour of the piece, where it has one. A hex colour or `rgb()`; anything else is ignored. */
|
|
11
|
+
tint?: string;
|
|
12
|
+
theme?: PieceTheme;
|
|
13
|
+
/** A second colour, where a piece has one (laces, a stripe). */
|
|
14
|
+
accent?: string;
|
|
15
|
+
/** Force the grain on or off. By default it is on for a colour ball of 48 pixels or more that is not turning. */
|
|
16
|
+
grain?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** A turn: `yaw` degrees about the vertical axis (0 is the default view), `pitch` the tilt toward you, `roll` the turn about the line of sight. */
|
|
19
|
+
export interface BallFrameOptions extends PieceOptions {
|
|
20
|
+
yaw?: number;
|
|
21
|
+
pitch?: number;
|
|
22
|
+
roll?: number;
|
|
23
|
+
}
|
|
24
|
+
/** Where a drawing comes from. */
|
|
25
|
+
export type PieceSource = "generated" | "drawn" | "noto" | "mdi" | "commons" | "gameicons";
|
|
26
|
+
/** `ball` is turned in 3D; `gear` is a flat drawing in a colour and a line style. */
|
|
27
|
+
export type PieceKind = "ball" | "gear";
|
|
28
|
+
/** The official size of a ball or an implement, from the rulebook that governs it. Lengths in millimetres, mass in grams. */
|
|
29
|
+
export interface PieceSize {
|
|
30
|
+
/** The largest extent of the drawing (a ball's diameter, a football's length), in millimetres: the scale `lineup` draws at. */
|
|
31
|
+
extentMm: number;
|
|
32
|
+
/** Across a sphere or a disc. */
|
|
33
|
+
diameterMm?: number;
|
|
34
|
+
/** End to end, for a prolate ball or an implement. */
|
|
35
|
+
lengthMm?: number;
|
|
36
|
+
/** The width across the middle of a prolate ball, or a stone's height, a puck's thickness. */
|
|
37
|
+
thicknessMm?: number;
|
|
38
|
+
/** Round the middle, for a ball the rulebook measures that way. */
|
|
39
|
+
circumferenceMm?: number;
|
|
40
|
+
/** Round the long way, for a prolate ball. */
|
|
41
|
+
longCircumferenceMm?: number;
|
|
42
|
+
massG?: readonly [number, number];
|
|
43
|
+
/** The rule the figures are from: document, edition and rule number. */
|
|
44
|
+
rule: string;
|
|
45
|
+
/** Anything the figures leave out, such as a figure that is the middle of a range or a part drawn shorter than it is. */
|
|
46
|
+
note?: string;
|
|
47
|
+
}
|
|
48
|
+
/** One ball or piece of gear. */
|
|
49
|
+
export interface Piece<Model = unknown> {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly en: string;
|
|
52
|
+
readonly ja: string;
|
|
53
|
+
readonly source: PieceSource;
|
|
54
|
+
readonly kind: PieceKind;
|
|
55
|
+
readonly model: Model;
|
|
56
|
+
/** The official size, where the rulebook gives one. */
|
|
57
|
+
readonly size?: PieceSize;
|
|
58
|
+
/** The still drawing: a document of SVG. */
|
|
59
|
+
svg: (options?: PieceOptions) => string;
|
|
60
|
+
/** The piece turned (a ball in 3D; gear is drawn as it is). */
|
|
61
|
+
frame: (options?: BallFrameOptions) => string;
|
|
62
|
+
}
|
|
63
|
+
type Rgb = readonly [number, number, number];
|
|
64
|
+
export declare function readColour(value: string | undefined): Rgb | undefined;
|
|
65
|
+
export declare const hexOf: (rgb: Rgb) => string;
|
|
66
|
+
/** A colour mixed toward black (`amount` below 0) or white (above 0). */
|
|
67
|
+
export declare function mix(colour: string, amount: number): string;
|
|
68
|
+
/** Two colours mixed: `t` 0 is `a`, 1 is `b`. */
|
|
69
|
+
export declare function blend(a: string, b: string, t: number): string;
|
|
70
|
+
/** Text made safe to write between tags and inside a double-quoted attribute. */
|
|
71
|
+
export declare const escape: (text: string) => string;
|
|
72
|
+
/** A number written short: at most `digits` decimals, no trailing zeros, no `-0`. */
|
|
73
|
+
export declare const num: (value: number, digits?: number) => string;
|
|
74
|
+
/** A short stable hash of some text, for ids that two drawings of one piece agree on. */
|
|
75
|
+
export declare function hashOf(text: string): string;
|
|
76
|
+
/** The options as the renderers use them. */
|
|
77
|
+
export interface ResolvedOptions {
|
|
78
|
+
style: "colour" | "line";
|
|
79
|
+
size: number;
|
|
80
|
+
theme: PieceTheme;
|
|
81
|
+
tint: string | undefined;
|
|
82
|
+
accent: string | undefined;
|
|
83
|
+
grain: boolean | undefined;
|
|
84
|
+
}
|
|
85
|
+
export declare function resolveOptions(o: PieceOptions | undefined): ResolvedOptions;
|
|
86
|
+
/** The ink of a drawing when a theme sets it, and the page it is made to read on. */
|
|
87
|
+
export declare const PIECE_INK: {
|
|
88
|
+
readonly light: "#20262d";
|
|
89
|
+
readonly dark: "#eef1f3";
|
|
90
|
+
};
|
|
91
|
+
/** A drawing wrapped into a document, in a 100 by 100 box: the title, the outline's colour for the theme, the definitions and the body. */
|
|
92
|
+
export declare function wrapPiece(o: {
|
|
93
|
+
title: string;
|
|
94
|
+
size: number;
|
|
95
|
+
theme: PieceTheme;
|
|
96
|
+
defs?: string;
|
|
97
|
+
body: string;
|
|
98
|
+
box?: string;
|
|
99
|
+
desc?: string;
|
|
100
|
+
}): string;
|
|
101
|
+
/** Degrees to radians, for a value that may be missing or not a number. */
|
|
102
|
+
export declare const radians: (degrees: number | undefined, fallback: number) => number;
|
|
103
|
+
/** The definition of the grain filter: noise lit from the upper left and multiplied into what it is applied to. It works in the box's own units, so the grain stays where it is while a ball turns. */
|
|
104
|
+
export declare function grainDef(id: string, f: number, a: number, seed?: number): string;
|
|
105
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// What every ball and every piece of gear is made of: the options, the colour helpers, the way a drawing is wrapped into a document, and the `Piece` object each one is.
|
|
2
|
+
// It imports nothing, so a ball stands alone: a bundler can take one ball module without the others. The shape of a piece (`id`, `en`, `ja`, `source`, `kind`, `model`, `svg`, `frame`)
|
|
3
|
+
// is the shape of an emblem in the emblem registry, so a registry can take a ball or a piece of gear as it is.
|
|
4
|
+
export function readColour(value) {
|
|
5
|
+
if (value === undefined)
|
|
6
|
+
return undefined;
|
|
7
|
+
const text = value.trim();
|
|
8
|
+
const hex = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(text)?.[1];
|
|
9
|
+
if (hex !== undefined) {
|
|
10
|
+
const full = hex.length === 3 ? [...hex].map((c) => c + c).join("") : hex;
|
|
11
|
+
return [parseInt(full.slice(0, 2), 16), parseInt(full.slice(2, 4), 16), parseInt(full.slice(4, 6), 16)];
|
|
12
|
+
}
|
|
13
|
+
const rgb = /^rgb\(\s*(\d{1,3})[\s,]+(\d{1,3})[\s,]+(\d{1,3})\s*\)$/i.exec(text);
|
|
14
|
+
return rgb === null ? undefined : [Math.min(255, Number(rgb[1])), Math.min(255, Number(rgb[2])), Math.min(255, Number(rgb[3]))];
|
|
15
|
+
}
|
|
16
|
+
const hex2 = (n) => Math.max(0, Math.min(255, Math.round(n))).toString(16).padStart(2, "0");
|
|
17
|
+
export const hexOf = (rgb) => `#${hex2(rgb[0])}${hex2(rgb[1])}${hex2(rgb[2])}`;
|
|
18
|
+
/** A colour mixed toward black (`amount` below 0) or white (above 0). */
|
|
19
|
+
export function mix(colour, amount) {
|
|
20
|
+
const rgb = readColour(colour) ?? [128, 128, 128];
|
|
21
|
+
const target = amount < 0 ? 0 : 255;
|
|
22
|
+
const t = Math.abs(amount);
|
|
23
|
+
return hexOf([rgb[0] + (target - rgb[0]) * t, rgb[1] + (target - rgb[1]) * t, rgb[2] + (target - rgb[2]) * t]);
|
|
24
|
+
}
|
|
25
|
+
/** Two colours mixed: `t` 0 is `a`, 1 is `b`. */
|
|
26
|
+
export function blend(a, b, t) {
|
|
27
|
+
const x = readColour(a) ?? [128, 128, 128];
|
|
28
|
+
const y = readColour(b) ?? [128, 128, 128];
|
|
29
|
+
return hexOf([x[0] + (y[0] - x[0]) * t, x[1] + (y[1] - x[1]) * t, x[2] + (y[2] - x[2]) * t]);
|
|
30
|
+
}
|
|
31
|
+
/** Text made safe to write between tags and inside a double-quoted attribute. */
|
|
32
|
+
export const escape = (text) => text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
33
|
+
/** A number written short: at most `digits` decimals, no trailing zeros, no `-0`. */
|
|
34
|
+
export const num = (value, digits = 1) => {
|
|
35
|
+
const text = (Math.round(value * 10 ** digits) / 10 ** digits).toString();
|
|
36
|
+
return text === "-0" ? "0" : text;
|
|
37
|
+
};
|
|
38
|
+
/** A short stable hash of some text, for ids that two drawings of one piece agree on. */
|
|
39
|
+
export function hashOf(text) {
|
|
40
|
+
let h = 2166136261;
|
|
41
|
+
for (let i = 0; i < text.length; i++)
|
|
42
|
+
h = Math.imul(h ^ text.charCodeAt(i), 16777619);
|
|
43
|
+
return (h >>> 0).toString(36);
|
|
44
|
+
}
|
|
45
|
+
export function resolveOptions(o) {
|
|
46
|
+
const size = typeof o?.size === "number" && Number.isFinite(o.size) && o.size > 0 ? Math.min(Math.round(o.size * 100) / 100, 4096) : 64;
|
|
47
|
+
const theme = o?.theme === "auto" || o?.theme === "light" || o?.theme === "dark" ? o.theme : "inherit";
|
|
48
|
+
const tint = readColour(o?.tint);
|
|
49
|
+
const accent = readColour(o?.accent);
|
|
50
|
+
return { style: o?.style === "line" ? "line" : "colour", size, theme, tint: tint === undefined ? undefined : hexOf(tint), accent: accent === undefined ? undefined : hexOf(accent), grain: typeof o?.grain === "boolean" ? o.grain : undefined };
|
|
51
|
+
}
|
|
52
|
+
/** The ink of a drawing when a theme sets it, and the page it is made to read on. */
|
|
53
|
+
export const PIECE_INK = { light: "#20262d", dark: "#eef1f3" };
|
|
54
|
+
/** A drawing wrapped into a document, in a 100 by 100 box: the title, the outline's colour for the theme, the definitions and the body. */
|
|
55
|
+
export function wrapPiece(o) {
|
|
56
|
+
const colour = o.theme === "dark" ? PIECE_INK.dark : o.theme === "inherit" ? "" : PIECE_INK.light;
|
|
57
|
+
const auto = o.theme === "auto" ? `<style>@media(prefers-color-scheme:dark){svg{color:${PIECE_INK.dark}}}</style>` : "";
|
|
58
|
+
return (`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${o.box ?? "0 0 100 100"}" width="${o.size}" height="${o.size}" role="img"${colour === "" ? "" : ` color="${colour}"`}>` +
|
|
59
|
+
`<title>${escape(o.title)}</title>${o.desc === undefined ? "" : `<desc>${escape(o.desc)}</desc>`}${auto}${o.defs === undefined || o.defs === "" ? "" : `<defs>${o.defs}</defs>`}${o.body}</svg>`);
|
|
60
|
+
}
|
|
61
|
+
/** Degrees to radians, for a value that may be missing or not a number. */
|
|
62
|
+
export const radians = (degrees, fallback) => ((typeof degrees === "number" && Number.isFinite(degrees) ? degrees : fallback) * Math.PI) / 180;
|
|
63
|
+
/** The definition of the grain filter: noise lit from the upper left and multiplied into what it is applied to. It works in the box's own units, so the grain stays where it is while a ball turns. */
|
|
64
|
+
export function grainDef(id, f, a, seed = 3) {
|
|
65
|
+
return `<filter id="${id}n" x="0" y="0" width="100" height="100" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"><feTurbulence type="fractalNoise" baseFrequency="${f}" numOctaves="2" seed="${seed}" result="n"/><feDiffuseLighting in="n" lighting-color="#fff" surfaceScale="${a}" diffuseConstant="1.15" result="l"><feDistantLight azimuth="225" elevation="58"/></feDiffuseLighting><feBlend in="SourceGraphic" in2="l" mode="multiply"/><feComposite in2="SourceGraphic" operator="in"/></filter>`;
|
|
66
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Piece } from "./ball.core.ts";
|
|
2
|
+
import type { BallSpec } from "./ball.engine.ts";
|
|
3
|
+
export declare const BALL_CRICKET_RED: Piece<BallSpec>;
|
|
4
|
+
export declare const BALL_CRICKET_WHITE: Piece<BallSpec>;
|
|
5
|
+
export declare const BALL_CRICKET_PINK: Piece<BallSpec>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Cricket balls: a leather ball with one raised seam round its middle and three rows of stitches either side of it. Red for Tests, white for limited overs, pink for day-night matches.
|
|
2
|
+
// The stitching is drawn the way it is sewn: 78 stitches to a row, each square across the row.
|
|
3
|
+
import { defineBall } from "./ball.engine.js";
|
|
4
|
+
import { greatCircle, smallCircle } from "./ball.math.js";
|
|
5
|
+
import { stitches } from "./ball.stitch.js";
|
|
6
|
+
import { mix } from "./ball.core.js";
|
|
7
|
+
const ROWS = [0.1, 0.19, 0.28];
|
|
8
|
+
const AXIS = [0.2, 1, 0.1];
|
|
9
|
+
function cricket(id, en, ja, base, thread, size, shade) {
|
|
10
|
+
return defineBall({
|
|
11
|
+
id,
|
|
12
|
+
en,
|
|
13
|
+
ja,
|
|
14
|
+
size,
|
|
15
|
+
spec: {
|
|
16
|
+
view: { yaw: 20, pitch: 24, roll: -12 },
|
|
17
|
+
base,
|
|
18
|
+
mat: { gloss: 0.62, shade, grain: { f: 1.1, a: 0.16 } },
|
|
19
|
+
draw: (s, colour) => {
|
|
20
|
+
let out = s.seam(greatCircle(AXIS, 96), mix(colour, -0.12), 2.6, { closed: true });
|
|
21
|
+
const rows = ROWS.flatMap((r) => [r, -r]).map((lat) => smallCircle(AXIS, Math.PI / 2 - lat, 96));
|
|
22
|
+
out += s.strokes(rows.flatMap((row) => stitches(row, true, 78, 0.026)), thread, 0.75, { ink: false });
|
|
23
|
+
return out;
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
const SIZE = { extentMm: 72.1, diameterMm: 72.1, circumferenceMm: 226.5, massG: [156, 163], rule: "Laws of Cricket, Law 4 The Ball, 4.1 Weight and size (Size 1, Size 2, Size 3)", note: "Size 1 (men's). Diameter worked out from the middle of the circumference range. The Laws do not set a colour." };
|
|
29
|
+
export const BALL_CRICKET_RED = /* @__PURE__ */ cricket("ball:cricket-red", "Cricket ball, red", "クリケットボール(赤)", "#a9161e", "#f2e8d2", SIZE, "#2a0408");
|
|
30
|
+
export const BALL_CRICKET_WHITE = /* @__PURE__ */ cricket("ball:cricket-white", "Cricket ball, white", "クリケットボール(白)", "#f3f0e8", "#2a2a2a", SIZE, "#4a4a58");
|
|
31
|
+
export const BALL_CRICKET_PINK = /* @__PURE__ */ cricket("ball:cricket-pink", "Cricket ball, pink", "クリケットボール(ピンク)", "#e45a8c", "#2a2a2a", SIZE, "#4a0a22");
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// Curling stone: a granite drum with a polished striking band round its belly, a narrow running ring under it with the concave recess inside (it shows when the stone is turned over), and a
|
|
2
|
+
// handle on top. The slices follow the stone's profile.
|
|
3
|
+
import { drawStack } from "./ball.stack.js";
|
|
4
|
+
import { defineObject } from "./ball.object.js";
|
|
5
|
+
import {} from "./ball.math.js";
|
|
6
|
+
import { num } from "./ball.core.js";
|
|
7
|
+
const GRANITE = "#8d929a";
|
|
8
|
+
const POLISHED = "#4d525b";
|
|
9
|
+
const HANDLE = "#d4202c";
|
|
10
|
+
export const BALL_CURLING_STONE = /* @__PURE__ */ defineObject({
|
|
11
|
+
id: "ball:curling-stone",
|
|
12
|
+
en: "Curling stone",
|
|
13
|
+
ja: "カーリングストーン",
|
|
14
|
+
size: { extentMm: 290.9, diameterMm: 290.9, thicknessMm: 114, circumferenceMm: 914, massG: [17240, 19960], rule: "World Curling The Rules of Curling, R2 Stones (a)-(j); R3(b) handle colour", note: "The largest stone the rule allows: a circumference of at most 914 mm and a height of at least 114 mm; the mass includes the handle." },
|
|
15
|
+
view: { yaw: 0, pitch: 30, roll: -6 },
|
|
16
|
+
model: { slices: 6 },
|
|
17
|
+
draw: (c) => drawStack(c, {
|
|
18
|
+
slices: [
|
|
19
|
+
{ y0: -0.2, y1: -0.15, r: [0.74, 0.8], colour: POLISHED, outline: true },
|
|
20
|
+
{ y0: -0.15, y1: -0.04, r: [0.8, 0.94], colour: GRANITE },
|
|
21
|
+
{ y0: -0.04, y1: 0.08, r: 1, colour: POLISHED, outline: true },
|
|
22
|
+
{ y0: 0.08, y1: 0.15, r: [1, 0.9], colour: GRANITE },
|
|
23
|
+
{ y0: 0.15, y1: 0.2, r: [0.9, 0.78], colour: GRANITE, outline: true },
|
|
24
|
+
],
|
|
25
|
+
top: "#9a9fa7",
|
|
26
|
+
bottom: "#6a6f78",
|
|
27
|
+
gloss: 0.5,
|
|
28
|
+
shade: "#000",
|
|
29
|
+
grain: { f: 1.9, a: 0.55 },
|
|
30
|
+
dish: { r: 0.74, colour: "#555a63" },
|
|
31
|
+
extra: (ctx) => {
|
|
32
|
+
// The handle: a post and a bar, a capsule in 3D (a thick line with round ends).
|
|
33
|
+
const post0 = ctx.at([0, 0.2, 0]), post1 = ctx.at([0, 0.34, 0]);
|
|
34
|
+
const a = [-0.42, 0.4, 0], b = [0.42, 0.4, 0];
|
|
35
|
+
const p = ctx.at(a), q = ctx.at(b);
|
|
36
|
+
const colour = ctx.opts.style === "line" ? "currentColor" : (ctx.opts.tint ?? HANDLE);
|
|
37
|
+
const line = ctx.opts.style === "line";
|
|
38
|
+
const w = (r) => (line ? Math.max(2.4, ctx.minWidth) : Math.max(92 * r, ctx.minWidth));
|
|
39
|
+
const stroke = (width) => `stroke="${colour}" stroke-width="${num(width, 2)}"`;
|
|
40
|
+
const post = `<path d="M${num(post0[0])} ${num(post0[1])}L${num(post1[0])} ${num(post1[1])}" ${stroke(w(0.075))} stroke-linecap="round" fill="none"/>`;
|
|
41
|
+
const bar = `<path d="M${num(p[0])} ${num(p[1])}L${num(q[0])} ${num(q[1])}" ${stroke(w(0.11))} stroke-linecap="round" fill="none"/>`;
|
|
42
|
+
const sheen = line ? "" : `<path d="M${num(p[0])} ${num(p[1] - 1.2)}L${num(q[0])} ${num(q[1] - 1.2)}" stroke="#fff" stroke-opacity=".35" stroke-width="${num(Math.max(0.8, 46 * 0.03), 2)}" stroke-linecap="round" fill="none"/>`;
|
|
43
|
+
return post + bar + sheen;
|
|
44
|
+
},
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const BALL_DISCUS: import("./ball.core.ts").Piece<import("./ball.engine.ts").BallSpec>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Discus: a lens, thin at the rim, with a metal plate let into each face and a metal rim. Drawn as a flattened ellipsoid.
|
|
2
|
+
import { defineBall } from "./ball.engine.js";
|
|
3
|
+
import { greatCircle, smallCircle } from "./ball.math.js";
|
|
4
|
+
export const BALL_DISCUS = /* @__PURE__ */ defineBall({
|
|
5
|
+
id: "ball:discus",
|
|
6
|
+
en: "Discus",
|
|
7
|
+
ja: "円盤",
|
|
8
|
+
size: { extentMm: 220, diameterMm: 220, thicknessMm: 45, massG: [2000, 2000], rule: "World Athletics Technical Rules (C2.1), Rule 34 Discus Throw - 'The discus shall conform to the following specifications'", note: "Men's discus, 219 to 221 mm across the rim and 44 to 46 mm thick at the middle; 2 kg is a minimum." },
|
|
9
|
+
spec: {
|
|
10
|
+
axes: [1, 0.2, 1],
|
|
11
|
+
view: { yaw: 25, pitch: 52, roll: -12 },
|
|
12
|
+
base: "#3b3f48",
|
|
13
|
+
mat: { gloss: 0.7, shade: "#050608", grain: { f: 1.4, a: 0.12 } },
|
|
14
|
+
draw: (s) => {
|
|
15
|
+
let out = "";
|
|
16
|
+
for (const sign of [1, -1])
|
|
17
|
+
out += s.panel(smallCircle([0, sign, 0], 0.82, 72), "#b4bac3", { n: 1, ink: false });
|
|
18
|
+
for (const sign of [1, -1])
|
|
19
|
+
out += s.stroke(smallCircle([0, sign, 0], 0.82, 72), "#555b66", 0.7, { closed: true });
|
|
20
|
+
out += s.stroke(greatCircle([0, 1, 0], 96), "#cfd4dc", 1.6, { closed: true });
|
|
21
|
+
return out;
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { type Piece, type PieceSize, type ResolvedOptions } from "./ball.core.ts";
|
|
2
|
+
import { type V3 } from "./ball.math.ts";
|
|
3
|
+
/** How a ball takes the light. */
|
|
4
|
+
export interface Material {
|
|
5
|
+
/** The colour of the shadowed side; by default the base colour made darker. */
|
|
6
|
+
shade?: string;
|
|
7
|
+
/** 0 (matt) to 1 (a hard bright highlight). */
|
|
8
|
+
gloss: number;
|
|
9
|
+
/** A polished metal: the sky above and the ground below are mirrored in it. */
|
|
10
|
+
metal?: boolean;
|
|
11
|
+
/** How dark the limb is, 0 to 1 (1 by default). */
|
|
12
|
+
rim?: number;
|
|
13
|
+
/** The grain: `f` is the noise's frequency per unit of the 100 by 100 box, `a` its relief. */
|
|
14
|
+
grain?: {
|
|
15
|
+
f: number;
|
|
16
|
+
a: number;
|
|
17
|
+
seed?: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** What a ball's `draw` lays things with. Points are unit vectors on the sphere the ball is made on (an ellipsoid ball is stretched after). */
|
|
21
|
+
export interface Surface {
|
|
22
|
+
/** True in the line style: a panel with `ink` is filled with the ink, a stroke without `deco` is drawn in it, and the rest is left out. */
|
|
23
|
+
readonly line: boolean;
|
|
24
|
+
/** The ball's radius in the box (the longest semi-axis). */
|
|
25
|
+
readonly radius: number;
|
|
26
|
+
/** The width of the thinnest line that still shows at this size, in box units. */
|
|
27
|
+
readonly minWidth: number;
|
|
28
|
+
/** The screen position of a point and how squarely it faces you (1 facing, 0 on the limb, below 0 hidden). */
|
|
29
|
+
project(u: V3): [number, number, number];
|
|
30
|
+
/** A closed polygon on the surface, cut at the limb. Its edges follow the sphere. `n` is the samples an edge gets. */
|
|
31
|
+
panel(ring: readonly V3[], fill: string, o?: {
|
|
32
|
+
ink?: boolean;
|
|
33
|
+
opacity?: number;
|
|
34
|
+
n?: number;
|
|
35
|
+
}): string;
|
|
36
|
+
/** A curve on the surface: only what faces you. `closed` joins its ends; `deco` marks a line that is not part of the ball's form (a highlight), which the line style leaves out. */
|
|
37
|
+
stroke(pts: readonly V3[], colour: string, width: number, o?: StrokeOptions): string;
|
|
38
|
+
/** Several curves drawn as one path. */
|
|
39
|
+
strokes(curves: ReadonlyArray<readonly V3[]>, colour: string, width: number, o?: StrokeOptions): string;
|
|
40
|
+
/** A raised seam: a shadow, the colour and a highlight along the curve. */
|
|
41
|
+
seam(pts: readonly V3[], colour: string, width: number, o?: {
|
|
42
|
+
closed?: boolean;
|
|
43
|
+
light?: string;
|
|
44
|
+
opacity?: number;
|
|
45
|
+
}): string;
|
|
46
|
+
/** Small round marks lying on the surface (holes, dimples, dots): each is a cap of `radius` radians round its centre. */
|
|
47
|
+
dots(centres: readonly V3[], radius: number, fill: string, o?: {
|
|
48
|
+
opacity?: number;
|
|
49
|
+
ink?: boolean;
|
|
50
|
+
light?: boolean;
|
|
51
|
+
}): string;
|
|
52
|
+
/** The facing of a point: 1 straight at you, 0 on the limb. */
|
|
53
|
+
facing(u: V3): number;
|
|
54
|
+
/** A point of space, in units of the ball's radius from its centre (not on the surface): its screen position and depth (positive is toward you). */
|
|
55
|
+
space(p: V3): [number, number, number];
|
|
56
|
+
}
|
|
57
|
+
export interface StrokeOptions {
|
|
58
|
+
closed?: boolean;
|
|
59
|
+
ink?: boolean;
|
|
60
|
+
deco?: boolean;
|
|
61
|
+
opacity?: number;
|
|
62
|
+
dx?: number;
|
|
63
|
+
dy?: number;
|
|
64
|
+
dash?: string;
|
|
65
|
+
}
|
|
66
|
+
export interface BallSpec {
|
|
67
|
+
/** The semi-axes of the ellipsoid along x, y and z before the view turns it. A sphere is `[1, 1, 1]`; a football is longer along x. */
|
|
68
|
+
axes?: V3;
|
|
69
|
+
/**
|
|
70
|
+
* Makes a prolate ball pointed at the ends. The ball is a body of revolution about its long axis whose radius at a distance x from the middle (as a fraction of the half length) is `(1 - x^2)^point`
|
|
71
|
+
* times the cross-section's semi-axis: 0.5 is the ellipsoid, and nearer 1 the ends are drawn to a point (a football's). The cross-section's two semi-axes must be equal.
|
|
72
|
+
*/
|
|
73
|
+
point?: number;
|
|
74
|
+
/** The default view in degrees. */
|
|
75
|
+
view: {
|
|
76
|
+
yaw: number;
|
|
77
|
+
pitch: number;
|
|
78
|
+
roll: number;
|
|
79
|
+
};
|
|
80
|
+
/** The main colour of the ball (what `tint` replaces). */
|
|
81
|
+
base: string;
|
|
82
|
+
/** The colour the whole ball is filled with before its panels are laid on, where it is not `base` (a soccer ball is white, its pentagons are `base`). */
|
|
83
|
+
ground?: string;
|
|
84
|
+
mat: Material;
|
|
85
|
+
/** Lays the panels and seams. `base` is the main colour, or the tint; `accent` is the second colour or undefined. */
|
|
86
|
+
draw: (s: Surface, base: string, accent: string | undefined) => string;
|
|
87
|
+
/** Where the ball's centre is in the 100 by 100 box (50, 50 by default): a hammer's head sits in a corner to leave room for the wire. */
|
|
88
|
+
centre?: readonly [number, number];
|
|
89
|
+
/** Where the ball is in space, in units of its radius from the middle of the whole (0, 0, 0 by default), turned with it: a hammer's head is at one end of the hammer, which turns about its middle. */
|
|
90
|
+
at?: V3;
|
|
91
|
+
/** The fraction of the box's radius the ball takes (1 by default): a hammer's head is small, to leave room for its wire. */
|
|
92
|
+
fit?: number;
|
|
93
|
+
/** What is attached to the ball and sticks out of it (a hammer's wire and handle): drawn behind the ball or in front of it, by what is nearer to you. */
|
|
94
|
+
attach?: (s: Surface, base: string) => {
|
|
95
|
+
behind: string;
|
|
96
|
+
front: string;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** Draws a ball: the document for a spec, the options and a turn in radians. */
|
|
100
|
+
export declare function drawBall(title: string, key: string, spec: BallSpec, opts: ResolvedOptions, turn: {
|
|
101
|
+
yaw: number;
|
|
102
|
+
pitch: number;
|
|
103
|
+
roll: number;
|
|
104
|
+
}, turning: boolean): string;
|
|
105
|
+
/** What `defineBall` takes. */
|
|
106
|
+
export interface BallDef {
|
|
107
|
+
id: string;
|
|
108
|
+
en: string;
|
|
109
|
+
ja: string;
|
|
110
|
+
spec: BallSpec;
|
|
111
|
+
size: PieceSize;
|
|
112
|
+
}
|
|
113
|
+
/** A ball from its definition: the `Piece` the registry and the gallery take. */
|
|
114
|
+
export declare function defineBall(def: BallDef): Piece<BallSpec>;
|