@voqalize/avatar 0.5.1 → 0.5.3
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 +16 -1
- package/dist/index.d.ts +32 -0
- package/dist/index.js +14 -0
- package/dist/pin.d.ts +1 -1
- package/dist/pin.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,7 +46,22 @@ appeared.
|
|
|
46
46
|
`character` names one of the characters you can meet at
|
|
47
47
|
https://voqalize.com/demos/avatar. Each release of this package can mount a
|
|
48
48
|
fixed set of them, and a name it does not have throws, listing the ones it
|
|
49
|
-
does.
|
|
49
|
+
does. `listCharacters()` returns that set:
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
import { listCharacters } from "@voqalize/avatar";
|
|
53
|
+
|
|
54
|
+
for (const c of await listCharacters()) {
|
|
55
|
+
// c.name, c.still (an image URL), c.gender, c.age.min, c.age.max,
|
|
56
|
+
// c.ethnicity[], c.tags[], c.suggestedVoices[]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Use it to build a picker or a filter rather than writing the names down. The
|
|
61
|
+
words in `gender`, `ethnicity` and `tags` come from closed lists, so a filter
|
|
62
|
+
you build from one call matches the next. `suggestedVoices` lists the voices
|
|
63
|
+
that suit the face, best first, as Voqalize voice ids such as
|
|
64
|
+
`omnivoice/gauri`. It is advice: the avatar never speaks.
|
|
50
65
|
|
|
51
66
|
The gains are optional, from `0` to `2`, and `1` is as authored:
|
|
52
67
|
|
package/dist/index.d.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* // …
|
|
8
8
|
* avatar.destroy();
|
|
9
9
|
*
|
|
10
|
+
* const roster = await listCharacters(); // every character, to choose from
|
|
11
|
+
*
|
|
10
12
|
* This package is the loader and nothing else. The avatar itself — the
|
|
11
13
|
* characters, the renderer and everything that reads the call — is the
|
|
12
14
|
* Voqalize avatar runtime, which this module imports from
|
|
@@ -42,4 +44,34 @@ export interface AvatarInstance {
|
|
|
42
44
|
* including before the avatar has appeared. */
|
|
43
45
|
destroy(): void;
|
|
44
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* A character, as a page choosing one sees it. The words in `gender`,
|
|
49
|
+
* `ethnicity` and `tags` come from closed lists the runtime keeps, so a filter
|
|
50
|
+
* built from what one call returns matches what the next returns.
|
|
51
|
+
*/
|
|
52
|
+
export interface CharacterInfo {
|
|
53
|
+
/** What `createAvatar` takes as `character`. */
|
|
54
|
+
readonly name: string;
|
|
55
|
+
/** An image URL: the character at rest. */
|
|
56
|
+
readonly still: string;
|
|
57
|
+
readonly gender: string;
|
|
58
|
+
/** The age the face reads as, in years. */
|
|
59
|
+
readonly age: {
|
|
60
|
+
readonly min: number;
|
|
61
|
+
readonly max: number;
|
|
62
|
+
};
|
|
63
|
+
readonly ethnicity: readonly string[];
|
|
64
|
+
/** Dress, hair, jewellery — how the character presents. */
|
|
65
|
+
readonly tags: readonly string[];
|
|
66
|
+
/** Voqalize voice ids that suit this face, best first — `"omnivoice/gauri"`,
|
|
67
|
+
* for example. Advice only: the avatar never speaks. */
|
|
68
|
+
readonly suggestedVoices: readonly string[];
|
|
69
|
+
}
|
|
45
70
|
export declare function createAvatar(options: AvatarOptions): AvatarInstance;
|
|
71
|
+
/**
|
|
72
|
+
* Every character the runtime can mount, in a stable order — for a page that
|
|
73
|
+
* lets someone choose one, or filters by what they look like. Loads the runtime
|
|
74
|
+
* if nothing has yet, so the first call waits for it; the list is the
|
|
75
|
+
* runtime's own and cannot be changed.
|
|
76
|
+
*/
|
|
77
|
+
export declare function listCharacters(): Promise<readonly CharacterInfo[]>;
|
package/dist/index.js
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
* // …
|
|
8
8
|
* avatar.destroy();
|
|
9
9
|
*
|
|
10
|
+
* const roster = await listCharacters(); // every character, to choose from
|
|
11
|
+
*
|
|
10
12
|
* This package is the loader and nothing else. The avatar itself — the
|
|
11
13
|
* characters, the renderer and everything that reads the call — is the
|
|
12
14
|
* Voqalize avatar runtime, which this module imports from
|
|
@@ -54,3 +56,15 @@ export function createAvatar(options) {
|
|
|
54
56
|
},
|
|
55
57
|
};
|
|
56
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Every character the runtime can mount, in a stable order — for a page that
|
|
61
|
+
* lets someone choose one, or filters by what they look like. Loads the runtime
|
|
62
|
+
* if nothing has yet, so the first call waits for it; the list is the
|
|
63
|
+
* runtime's own and cannot be changed.
|
|
64
|
+
*/
|
|
65
|
+
export async function listCharacters() {
|
|
66
|
+
const rt = await load();
|
|
67
|
+
if (!rt.characters)
|
|
68
|
+
throw new Error(`[avatar] the runtime at ${RUNTIME_URL} does not list its characters`);
|
|
69
|
+
return rt.characters();
|
|
70
|
+
}
|
package/dist/pin.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const RUNTIME_URL = "https://avatar.voqalize.com/runtime/runtime.
|
|
1
|
+
export declare const RUNTIME_URL = "https://avatar.voqalize.com/runtime/runtime.RE3NT6O7.js";
|
|
2
2
|
export declare const PROTOCOL = 1;
|
package/dist/pin.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// Written by scripts/build-runtime.mjs — the runtime this shim is released with.
|
|
2
|
-
export const RUNTIME_URL = "https://avatar.voqalize.com/runtime/runtime.
|
|
2
|
+
export const RUNTIME_URL = "https://avatar.voqalize.com/runtime/runtime.RE3NT6O7.js";
|
|
3
3
|
export const PROTOCOL = 1;
|
package/package.json
CHANGED