@fabi-play/avatars 0.4.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/README.md +12 -10
- package/dist/index.d.ts +18 -12
- package/dist/index.js +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
# @fabi-play/avatars
|
|
2
2
|
|
|
3
|
-
Thirty-nine original, child-friendly avatars, drawn from a body pose:
|
|
4
|
-
|
|
3
|
+
Thirty-nine original, child-friendly avatars, drawn from a body pose: 12 for each age band, the T-rex and the fairy,
|
|
4
|
+
and Fabi the fox (the fox of the app icon, the mascot). Fabi is the host, not a player: no band offers it to the
|
|
5
|
+
children, but the TV and games draw it like any other avatar. The lion, the T-rex and the fairy
|
|
5
6
|
are offered to both 3–5 and 6–8. The TV shows them in place
|
|
6
7
|
of the plain silhouette when the phone's video is not on screen. Each child picks one on the phone, among the avatars
|
|
7
8
|
of their age band. The phone stores only the avatar's id; any valid id is accepted everywhere, whatever the band.
|
|
@@ -11,7 +12,7 @@ varied skin tones and gender-neutral looks, and are told apart by their gear.
|
|
|
11
12
|
|
|
12
13
|
| Band | Style | id · en · it (the first four are the slot defaults) |
|
|
13
14
|
| --- | --- | --- |
|
|
14
|
-
| all | the app icon's fox:
|
|
15
|
+
| all | the app icon's fox, the host: in no band's list (pickers don't offer it), `special: true`, drawn with the 6–8 proportions; never a slot default; a child saved with it keeps it | `mascot` Fabi · Fabi |
|
|
15
16
|
| 3–5 | cuddly baby animals: big round heads, chubby limbs, soft colours, a soft brown outline | `bunny` Bunny · Coniglietto, `bear` Bear · Orsetto, `panda` Panda · Panda, `penguin` Penguin · Pinguino, `koala` Koala · Koala, `frog` Frog · Ranocchio, `cat` Cat · Gattino, `owl` Owl · Gufetto, `chick` Chick · Pulcino, `puppy` Puppy · Cucciolo, `lamb` Lamb · Agnellino, `duckling` Duckling · Anatroccolo; then, also offered here (home 6–8): `lion`, `trex`, `fairy` |
|
|
16
17
|
| 6–8 | animals and adventure | `fox` Fox · Volpe, `lion` Lion · Leoncino, `dragon` Little Dragon · Draghetto, `unicorn` Unicorn · Unicorno, `tiger` Tiger · Tigrotto, `monkey` Monkey · Scimmietta, `dinosaur` Dinosaur · Dinosauro, `trex` T-Rex · T-Rex, `octopus` Octopus · Polpetto, `ghost` Friendly Ghost · Fantasmino, `shark` Shark · Squalo, `wolf` Wolf · Lupo, `parrot` Parrot · Pappagallo, `fairy` Fairy · Fatina |
|
|
17
18
|
| 9–12 | older kids: smaller heads, slimmer longer limbs, gear, cooler colours, no blush, a cool outline | `robot` Robot · Robot, `astronaut` Astronaut · Astronauta, `ninja` Ninja · Ninja, `skater` Skater · Skater, `alien` Alien · Alieno, `explorer` Explorer · Giramondo, `wizard` Wizard · Mago, `knight` Knight · Cavaliere, `racer` Racer · Pilota, `pirate` Pirate · Pirata, `diver` Diver · Sub, `hero` Hero · Supereroe |
|
|
@@ -43,13 +44,14 @@ el.innerHTML = avatarIconSvg('panda', 96) // web DOM
|
|
|
43
44
|
```
|
|
44
45
|
|
|
45
46
|
- `AVATARS: readonly AvatarDef[]` (all 39), `AVATAR_IDS`, `DEFAULT_AVATAR` (the fox), `avatarById(id)`, `isAvatarId(x)`.
|
|
46
|
-
- `AVATAR_BANDS: Record<AgeRange, readonly AvatarId[]>` (picker order: the
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
- `AVATAR_BANDS: Record<AgeRange, readonly AvatarId[]>` (picker order: the band's own 12, whose first four are the
|
|
48
|
+
slot defaults, see `defaultAvatarFor(slot, ageRange?)` in `@fabi-play/protocol`, then the avatars also offered
|
|
49
|
+
there; the lists are not all the same length: 15, 14, 12). The mascot (`MASCOT_ID`) is in none: Fabi is the host,
|
|
50
|
+
not a player. It stays in `AVATARS`, `isAvatarId('mascot')` is true and `drawAvatar` draws it,
|
|
49
51
|
`avatarsFor(ageRange)` (the definitions, in that order), `bandOf(id)` (the home band: `'all'` for the mascot, 6–8
|
|
50
|
-
for an unknown id), `bandsOf(id)` (every band whose list offers it). Every definition has its `band`
|
|
52
|
+
for an unknown id), `bandsOf(id)` (every band whose list offers it: none for the mascot). Every definition has its `band`
|
|
51
53
|
(`AvatarBand`: an age range or `'all'`) and, if it is offered elsewhere too, `alsoIn` (see "Avatars of two bands"
|
|
52
|
-
below); `special: true` marks the mascot
|
|
54
|
+
below); `special: true` marks the mascot. `bodyBand(def, shown?)` gives the proportions
|
|
53
55
|
it is drawn with (6–8 for `'all'`).
|
|
54
56
|
- `drawAvatar(ctx, body, def | id, box, { alpha?, mirrored?, band? })`. Unknown ids draw the default avatar. `band`:
|
|
55
57
|
the child's age band, when the caller knows it (see "Avatars of two bands"). Pass
|
|
@@ -106,7 +108,7 @@ a change that alters them by accident fails the tests (`UPDATE_SNAPSHOT=1` after
|
|
|
106
108
|
- **Limbs**: thick round strokes from shoulder to elbow to wrist (0.22 U) and from hip to knee to ankle (0.28 U),
|
|
107
109
|
each with an outline. Arms start just below the shoulder. Legs start inside the torso, so nothing looks detached.
|
|
108
110
|
Hands are round caps. Feet are ovals, flippers or boots.
|
|
109
|
-
- **Proportions by band** (`BAND_BODY`): the joints are always the child's, only sizes change. An avatar of
|
|
111
|
+
- **Proportions by band** (`BAND_BODY`): the joints are always the child's, only sizes change. An avatar of no
|
|
110
112
|
band (`'all'`, the mascot) takes the 6–8 row. An avatar of two bands takes the row of the band shown (above).
|
|
111
113
|
|
|
112
114
|
| band | head radius | head centre above the shoulders | arm / leg thickness | hand radius | torso below the hips | torso min half width (shoulders / hips) |
|
|
@@ -134,7 +136,7 @@ a change that alters them by accident fails the tests (`UPDATE_SNAPSHOT=1` after
|
|
|
134
136
|
## Adding an avatar
|
|
135
137
|
|
|
136
138
|
1. Add an entry to `AVATARS` in `src/defs.ts` and its id to its band in `AVATAR_BANDS` (`src/index.ts`) (an avatar
|
|
137
|
-
of band `'all'` goes in
|
|
139
|
+
of band `'all'` goes in no band (only the mascot, the host, is one); one offered in another band too lists it in `alsoIn` and goes
|
|
138
140
|
in that band's list as well, after the band's own). Choose a new
|
|
139
141
|
kebab-case `id` and never rename it later, because phones store it. Fill in `name.en`, `name.it` and `band`. Pick a `palette` with `body`, `limbs`, `belly`, `accent` and
|
|
140
142
|
`outline`, plus optional `hands`, `feet` and `ears`. Then choose a `head` shape, `ears`, the `face` (eyes, mouth,
|
package/dist/index.d.ts
CHANGED
|
@@ -152,7 +152,7 @@ export interface FaceDef {
|
|
|
152
152
|
/** Eyebrows of this colour (people): a little attitude. */
|
|
153
153
|
brows?: string;
|
|
154
154
|
}
|
|
155
|
-
/** The age band an avatar is for, or 'all':
|
|
155
|
+
/** The age band an avatar is for, or 'all': of no band (Fabi the fox, the app's mascot: the host, in no picker). */
|
|
156
156
|
export type AvatarBand = AgeRange | "all";
|
|
157
157
|
/** An avatar, as data: one renderer draws any definition. */
|
|
158
158
|
export interface AvatarDef {
|
|
@@ -165,7 +165,7 @@ export interface AvatarDef {
|
|
|
165
165
|
};
|
|
166
166
|
/**
|
|
167
167
|
* The age band the avatar is for, its home: its style and its body proportions (see BAND_BODY in rig.ts). 'all': in
|
|
168
|
-
*
|
|
168
|
+
* no band's list (the mascot), drawn with the 6–8 proportions. See alsoIn for an avatar offered in other bands too.
|
|
169
169
|
*/
|
|
170
170
|
band: AvatarBand;
|
|
171
171
|
/**
|
|
@@ -174,7 +174,7 @@ export interface AvatarDef {
|
|
|
174
174
|
* (outline), bandOf, and its proportions when the band shown is not known. Not for 'all' (the mascot).
|
|
175
175
|
*/
|
|
176
176
|
alsoIn?: readonly AgeRange[];
|
|
177
|
-
/** A special avatar (the mascot):
|
|
177
|
+
/** A special avatar (the mascot): the host, not a player; in no band's list (AVATAR_BANDS). */
|
|
178
178
|
special?: boolean;
|
|
179
179
|
/** Its colours. */
|
|
180
180
|
palette: Palette;
|
|
@@ -292,7 +292,7 @@ export interface BandBody {
|
|
|
292
292
|
}
|
|
293
293
|
export declare const BAND_BODY: Record<AgeRange, BandBody>;
|
|
294
294
|
/**
|
|
295
|
-
* The proportions an avatar is drawn with: its band's, 6–8's for
|
|
295
|
+
* The proportions an avatar is drawn with: its band's, 6–8's for the mascot ('all') or anything else.
|
|
296
296
|
* shown: the band it is shown in (the child's, the picker's), when known; an avatar offered in more than one band
|
|
297
297
|
* (alsoIn) takes the proportions of the one shown, any other keeps its own (the mascot always 6–8's).
|
|
298
298
|
*/
|
|
@@ -375,14 +375,17 @@ export declare class BodyInterpolator {
|
|
|
375
375
|
export declare function blend(a: Body$1, b: Body$1, u: number): Body$1;
|
|
376
376
|
export declare const AVATAR_IDS: readonly string[];
|
|
377
377
|
export type AvatarId = string;
|
|
378
|
-
/**
|
|
378
|
+
/**
|
|
379
|
+
* Fabi the fox, the app's mascot ('all': no band of its own). Fabi is the host, not a player: in no band's list
|
|
380
|
+
* (AVATAR_BANDS), so pickers never offer it, but it is a valid avatar (isAvatarId, avatarById, drawAvatar) for the TV
|
|
381
|
+
* and for games, and a child saved with it before keeps it.
|
|
382
|
+
*/
|
|
379
383
|
export declare const MASCOT_ID: AvatarId;
|
|
380
384
|
/**
|
|
381
|
-
* The avatars of each age band, in the order the pickers show them: the
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
385
|
-
* all the same length.
|
|
385
|
+
* The avatars of each age band, in the order the pickers show them: the band's own 12, then (3–5) the ones also
|
|
386
|
+
* offered there. The first four are the defaults of the four player slots (defaultAvatarFor in @fabi-play/protocol).
|
|
387
|
+
* Every avatar is in its own band and in those of its alsoIn; those of band 'all' (the mascot, MASCOT_ID) are in
|
|
388
|
+
* none: Fabi hosts, the children play. The lists are not all the same length.
|
|
386
389
|
*/
|
|
387
390
|
export declare const AVATAR_BANDS: Readonly<Record<AgeRange, readonly AvatarId[]>>;
|
|
388
391
|
/** The avatar of a child who has not picked one yet: the fox (6–8's first). */
|
|
@@ -393,12 +396,15 @@ export declare const avatarById: (id: string) => AvatarDef | undefined;
|
|
|
393
396
|
/** The avatars of an age band, in picker order (6–8 for anything that is not an age band). */
|
|
394
397
|
export declare function avatarsFor(ageRange: AgeRange): readonly AvatarDef[];
|
|
395
398
|
/**
|
|
396
|
-
* The age band of an avatar, its home: 'all' for the mascot (in
|
|
399
|
+
* The age band of an avatar, its home: 'all' for the mascot (in no band's list), 6–8 (the default avatar's) for an
|
|
397
400
|
* unknown id. An avatar offered in more than one band has one home band (its style, its proportions when the band
|
|
398
401
|
* shown is not known); bandsOf gives every band it is offered in.
|
|
399
402
|
*/
|
|
400
403
|
export declare const bandOf: (id: AvatarId) => AvatarBand;
|
|
401
|
-
/**
|
|
404
|
+
/**
|
|
405
|
+
* Every age band whose list (AVATAR_BANDS) offers the avatar, youngest first; the default avatar's for an unknown id;
|
|
406
|
+
* none for the mascot (offered in no band).
|
|
407
|
+
*/
|
|
402
408
|
export declare const bandsOf: (id: AvatarId) => readonly AgeRange[];
|
|
403
409
|
export interface DrawOptions {
|
|
404
410
|
/** 0–1, for the whole avatar. */
|
package/dist/index.js
CHANGED
|
@@ -2248,9 +2248,9 @@ function blend(a, b, u) {
|
|
|
2248
2248
|
var AVATAR_IDS = AVATARS.map((a) => a.id);
|
|
2249
2249
|
var MASCOT_ID = "mascot";
|
|
2250
2250
|
var AVATAR_BANDS = {
|
|
2251
|
-
"3-5": [
|
|
2252
|
-
"6-8": [
|
|
2253
|
-
"9-12": [
|
|
2251
|
+
"3-5": ["bunny", "bear", "panda", "penguin", "koala", "frog", "cat", "owl", "chick", "puppy", "lamb", "duckling", "lion", "trex", "fairy"],
|
|
2252
|
+
"6-8": ["fox", "lion", "dragon", "unicorn", "tiger", "monkey", "dinosaur", "trex", "octopus", "ghost", "shark", "wolf", "parrot", "fairy"],
|
|
2253
|
+
"9-12": ["robot", "astronaut", "ninja", "skater", "alien", "explorer", "wizard", "knight", "racer", "pirate", "diver", "hero"]
|
|
2254
2254
|
};
|
|
2255
2255
|
var BY_ID = new Map(AVATARS.map((a) => [a.id, a]));
|
|
2256
2256
|
var DEFAULT_AVATAR = BY_ID.get("fox");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabi-play/avatars",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "39 child-friendly avatars: Fabi the fox in every age band, 12 per band, a T-rex and a fairy, drawn from a body pose, on canvas or as SVG portraits for the pickers.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"fabi-play",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"access": "public"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@fabi-play/protocol": "^0.
|
|
35
|
+
"@fabi-play/protocol": "^0.5.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "24.10.1",
|