mesh-avatar 0.1.0 → 0.2.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 CHANGED
@@ -10,6 +10,13 @@ npm install mesh-avatar
10
10
 
11
11
  The package is ESM and includes TypeScript declarations. Rendering requires a browser with WebGL. It has no React dependency; the animation loop starts automatically after loading.
12
12
 
13
+ ## Get a `.mavatar` file
14
+
15
+ Open your project in Mesh Avatar Studio and choose **Export .mavatar** in the editor header.
16
+ The file holds the rig, the built layers, any drawn eye and mouth variants and a manifest,
17
+ so it is all the runtime needs. You can also pack a project folder from the command line
18
+ with `npm run pack-avatar -- projects/<name>` in the Studio repository.
19
+
13
20
  ## Load an avatar
14
21
 
15
22
  Place an exported `.mavatar` file in your app's public assets and provide a canvas:
@@ -5,12 +5,16 @@ export function createSpriteModule(engine: ReturnType<typeof import("./rig.js").
5
5
  /**
6
6
  * Show / hide and deform the sprites for this frame.
7
7
  * Returns which eyes are covered by a sprite, so the layered eye parts can be hidden.
8
+ * `mood` (angry / sad / surprise) picks drawn expression eyes (sad, surprise) and closed
9
+ * mouths (angry, sad) when the avatar has them.
8
10
  */
9
- update(P: any, phys: any, dt?: number): {
11
+ update(P: any, phys: any, dt?: number, mood?: null): {
10
12
  eyes: boolean[];
11
13
  mouth: any;
12
14
  };
13
15
  };
14
16
  mouthShape: (open: any, form: any, prev?: null) => any;
15
- eyeSprite: (open: any, smile: any) => "eyes_smile" | "eyes_closed" | "eyes_half" | null;
17
+ eyeSprite: (open: any, smile: any, mood?: null) => "eyes_smile" | "eyes_closed" | "eyes_half" | null;
16
18
  };
19
+ /** The drawn-eye / mouth mood for the live expression, else for the motion expression (if it is applied). */
20
+ export function eyeMood(overlay: any, expression: any): any;