@fabi-play/engine 0.3.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1876,21 +1876,21 @@ export interface Palette {
1876
1876
  hair?: string;
1877
1877
  }
1878
1878
  /** The head's outline. */
1879
- export type HeadShape = "round" | "wide" | "tall" | "square" | "bulb" | "bucket";
1879
+ export type HeadShape = "round" | "wide" | "tall" | "square" | "bulb" | "bucket" | "snout-long";
1880
1880
  /** The ears (or what is in their place: horns, antennae, a fin). */
1881
- export type EarKind = "none" | "pointy" | "round" | "big-round" | "long" | "side" | "tufts" | "antenna" | "antennae" | "horns" | "unicorn" | "floppy" | "droopy" | "fin" | "human";
1881
+ export type EarKind = "none" | "pointy" | "round" | "big-round" | "long" | "side" | "tufts" | "antenna" | "antennae" | "horns" | "unicorn" | "floppy" | "droopy" | "fin" | "human" | "pixie";
1882
1882
  /** How the eyes are drawn. */
1883
1883
  export type EyeKind = "dot" | "big" | "mask" | "screen" | "almond" | "visor" | "calm" | "slit" | "goggle" | "bead";
1884
1884
  /** How the mouth (or beak) is drawn. */
1885
- export type MouthKind = "none" | "smile" | "open" | "cat" | "beak" | "teeth" | "grill" | "tiny" | "smirk" | "bill" | "hook" | "jaws";
1885
+ export type MouthKind = "none" | "smile" | "open" | "cat" | "beak" | "teeth" | "grill" | "tiny" | "smirk" | "bill" | "hook" | "jaws" | "toothy";
1886
1886
  /** The patch around the nose and mouth. */
1887
1887
  export type MuzzleKind = "none" | "oval" | "heart" | "monkey" | "disc" | "cheeks" | "band";
1888
1888
  /** The tail, behind the body. */
1889
- export type TailKind = "none" | "fluffy" | "brush" | "pom" | "long" | "curl" | "tuft" | "striped" | "spiky" | "arrow" | "fish" | "plume";
1889
+ export type TailKind = "none" | "fluffy" | "brush" | "pom" | "long" | "curl" | "tuft" | "striped" | "spiky" | "arrow" | "fish" | "plume" | "thick";
1890
1890
  /** Things on the head. */
1891
- export type HeadExtra = "mane" | "rainbow-mane" | "stripes" | "spikes" | "spots" | "curl" | "helmet" | "bolts" | "whiskers" | "tuft" | "brows" | "eggshell" | "wool" | "eye-spot" | "crest" | "forehead" | "gills" | "ruff" | "hair" | "curls" | "locks" | "ninja-hood" | "cap" | "safari-hat" | "wizard-hat" | "plume" | "stripe" | "bandana" | "eye-patch" | "dive-mask" | "domino";
1891
+ export type HeadExtra = "mane" | "rainbow-mane" | "stripes" | "spikes" | "spots" | "curl" | "helmet" | "bolts" | "whiskers" | "tuft" | "brows" | "eggshell" | "wool" | "eye-spot" | "crest" | "forehead" | "gills" | "ruff" | "hair" | "curls" | "locks" | "ninja-hood" | "cap" | "safari-hat" | "wizard-hat" | "plume" | "stripe" | "bandana" | "eye-patch" | "dive-mask" | "domino" | "bun" | "flower-crown";
1892
1892
  /** Things on the body. */
1893
- export type BodyExtra = "wings" | "backpack" | "sheet" | "tentacles" | "panel" | "badge" | "joints" | "feathers" | "flippers" | "boots" | "scarf" | "spots" | "wool" | "robe" | "cape" | "fins" | "tank" | "straps" | "belt" | "stripes" | "pauldrons" | "emblem" | "pocket" | "racing-stripe" | "star";
1893
+ export type BodyExtra = "wings" | "backpack" | "sheet" | "tentacles" | "panel" | "badge" | "joints" | "feathers" | "flippers" | "boots" | "scarf" | "spots" | "wool" | "robe" | "cape" | "fins" | "tank" | "straps" | "belt" | "stripes" | "pauldrons" | "emblem" | "pocket" | "racing-stripe" | "star" | "tiny-arms" | "strong-legs" | "wings-fairy" | "wand" | "petals";
1894
1894
  /** An avatar's face. */
1895
1895
  export interface FaceDef {
1896
1896
  /** How the eyes are drawn. */
@@ -1912,7 +1912,7 @@ export interface FaceDef {
1912
1912
  /** Eyebrows of this colour (people): a little attitude. */
1913
1913
  brows?: string;
1914
1914
  }
1915
- /** The age band an avatar is for, or 'all': offered in every band (Fabi the fox, the app's mascot). */
1915
+ /** The age band an avatar is for, or 'all': of no band (Fabi the fox, the app's mascot: the host, in no picker). */
1916
1916
  export type AvatarBand = AgeRange | "all";
1917
1917
  /** An avatar, as data: one renderer draws any definition. */
1918
1918
  export interface AvatarDef {
@@ -1924,11 +1924,17 @@ export interface AvatarDef {
1924
1924
  it: string;
1925
1925
  };
1926
1926
  /**
1927
- * The age band the avatar is for: its style and its body proportions (see BAND_BODY in rig.ts). 'all': in every
1928
- * band's list, drawn with the 6–8 proportions.
1927
+ * The age band the avatar is for, its home: its style and its body proportions (see BAND_BODY in rig.ts). 'all': in
1928
+ * no band's list (the mascot), drawn with the 6–8 proportions. See alsoIn for an avatar offered in other bands too.
1929
1929
  */
1930
1930
  band: AvatarBand;
1931
- /** A special avatar (the mascot): first in every band's list; pickers may mark it. */
1931
+ /**
1932
+ * Other age bands the avatar is also offered in (listed in their AVATAR_BANDS too), besides its own band. Shown in
1933
+ * one of them, it is drawn with that band's proportions (bodyBand(def, band)); its band stays its home: its style
1934
+ * (outline), bandOf, and its proportions when the band shown is not known. Not for 'all' (the mascot).
1935
+ */
1936
+ alsoIn?: readonly AgeRange[];
1937
+ /** A special avatar (the mascot): the host, not a player; in no band's list (AVATAR_BANDS). */
1932
1938
  special?: boolean;
1933
1939
  /** Its colours. */
1934
1940
  palette: Palette;
@@ -28,6 +28,7 @@ var DEFAULT_AVATARS_BY_AGE = {
28
28
  };
29
29
  var DEFAULT_AVATARS = DEFAULT_AVATARS_BY_AGE["6-8"];
30
30
  var toScreen = (view, p) => view ? { x: view.x + p.x * view.w, y: view.y + p.y * view.h } : { x: p.x, y: p.y };
31
+ var COVER_ASPECT = 16 / 9;
31
32
  var POSE_HEADER = 12;
32
33
  var POSE_BODY_BYTES = LANDMARKS * 4;
33
34
  var poseBytes = (bodies) => POSE_HEADER + bodies * POSE_BODY_BYTES;
@@ -5176,6 +5177,10 @@ async function createEngine(opts = {}) {
5176
5177
  };
5177
5178
  unlisten.push(
5178
5179
  play.on("start", (m) => lateHint(m?.device)),
5180
+ // The simple API knows muted only from the start (its getter is false before): read it again then.
5181
+ play.on("start", (m) => {
5182
+ if (typeof m?.muted === "boolean") sound.muted = m.muted;
5183
+ }),
5179
5184
  play.on("frame", (m) => setPlayers(m?.players)),
5180
5185
  play.on("players", (m) => setPlayers(m?.players)),
5181
5186
  play.on("backdrop", (m) => setBackdrop(m?.backdrop, m?.view)),