ara3d 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/dist/index.js CHANGED
@@ -26,7 +26,7 @@ function a(e) {
26
26
  let t = typeof e == "string" ? e.split(",") : e, n = [];
27
27
  for (let e of t) {
28
28
  if (typeof e != "string") {
29
- if (!e || typeof e.clip != "string") throw Error("Each step needs a clip, such as { clip: \"wave\" }.");
29
+ if (!e || typeof e.clip != "string") throw Error("Each step needs a clip, such as { clip: \"vault_over\" }.");
30
30
  n.push({
31
31
  id: e.clip,
32
32
  ...e.seconds === void 0 ? {} : { seconds: e.seconds },
@@ -1684,6 +1684,18 @@ var o = {
1684
1684
  tank: "drive_tank",
1685
1685
  jet: "fly_jet"
1686
1686
  },
1687
+ women: [
1688
+ "The Bride",
1689
+ "The Covert Spy",
1690
+ "The Female Executive",
1691
+ "The Beach Girl",
1692
+ "Athletic woman",
1693
+ "Businesswoman",
1694
+ "Teen",
1695
+ "The Adventurer",
1696
+ "The Cyberpunk Hacker",
1697
+ "The Dahomey Warrior"
1698
+ ],
1687
1699
  props: {
1688
1700
  weapons: [
1689
1701
  "rifle",
@@ -1825,7 +1837,7 @@ function w(t, n, r, { fade: i = .35, repeat: o = !0 } = {}) {
1825
1837
  length: Math.max(o, i * 2)
1826
1838
  };
1827
1839
  });
1828
- if (!s.length) throw Error("Give playSequence() at least one animation, such as \"walk, wave\".");
1840
+ if (!s.length) throw Error("Give playSequence() at least one animation, such as \"walk, look_around\".");
1829
1841
  let c = n.update, l = -1, u = 0, d = !1, f = !1, p = (t) => {
1830
1842
  let r = s[l]?.action, a = s[t];
1831
1843
  l = t, u = n.time, a.action.reset(), a.action.clampWhenFinished = !0, a.action.setLoop(e, a.loops ? Infinity : a.times), a.action.play(), r && r !== a.action && r.crossFadeTo(a.action, i, !1);
@@ -6,17 +6,19 @@ export declare class AraCharacterElement extends HTMLElement {
6
6
  private view?;
7
7
  private status;
8
8
  private figure;
9
- private bar;
10
9
  private label;
11
10
  private building;
12
11
  private queued;
13
12
  private visible;
14
13
  private sequence?;
14
+ /** The clip playing on the character, for playClip()'s blends. */
15
+ private active?;
16
+ private extentFor?;
15
17
  constructor();
16
18
  connectedCallback(): void;
17
19
  disconnectedCallback(): void;
18
20
  attributeChangedCallback(name: string, before: string | null, after: string | null): void;
19
- /** What plays: the animation attribute (one clip, or a sequence such as "walk 3s, wave"), a vehicle's riding clip, or idle. */
21
+ /** What plays: the animation attribute (one clip, or a sequence such as "walk 3s, look_around"), a vehicle's riding clip, or idle. */
20
22
  get animation(): string;
21
23
  /** The clips the animation uses, each once. */
22
24
  private clipIds;
@@ -25,8 +27,22 @@ export declare class AraCharacterElement extends HTMLElement {
25
27
  private applyExpression;
26
28
  private fit;
27
29
  /** Frames the character and any vehicle from the front-right. */
30
+ /**
31
+ * The space the character fills while its animations play: each clip is posed at its start, middle and end, so a
32
+ * swim or a crouch is framed as well as standing. Props count as they stand.
33
+ */
34
+ private extent;
28
35
  private frame;
36
+ /** The current frame as a 2D canvas, for thumbnails and transitions; transparent where there's no background. */
37
+ snapshot(): HTMLCanvasElement | undefined;
38
+ /** Starts the animation again from the beginning. */
39
+ restart(): void;
29
40
  private play;
41
+ /**
42
+ * Blends to a loaded clip (from animation or clips) without rebuilding or reframing, for games and controls:
43
+ * el.playClip('run'). Returns false if the clip isn't loaded.
44
+ */
45
+ playClip(id: string, fade?: number): boolean;
30
46
  private draw;
31
47
  /** What to build, from the attributes. */
32
48
  private input;
@@ -90,8 +90,8 @@ export interface AraCharacter {
90
90
  /** Natural blinking, on by default; call update() every frame for it to run. */
91
91
  blinking: boolean;
92
92
  /**
93
- * Plays clips one after another on `mixer`, blending each into the next, such as "walk 3s, wave, cheer x2". A step
94
- * that loops (walk, idle) plays one cycle unless given a length; others (wave, jump) play once, or a number of times.
93
+ * Plays clips one after another on `mixer`, blending each into the next, such as "run 2s, vault_over, ledge_climb_up". A step
94
+ * that loops (walk, idle) plays one cycle unless given a length; others (vault_over, jump) play once, or a number of times.
95
95
  * It moves on as you call mixer.update(), and takes over the mixer's other actions.
96
96
  */
97
97
  playSequence(mixer: AnimationMixer, steps: string | readonly SequenceStep[], options?: SequenceOptions): Sequence;
@@ -1,4 +1,4 @@
1
- /** Animation sequences, such as "walk 3s, wave, cheer x2": the steps the library's playSequence() and the embed play. */
1
+ /** Animation sequences, such as "run 2s, vault_over, ledge_climb_up": the steps the library's playSequence() and the embed play. */
2
2
  /** One step: a clip ID, with an optional length in seconds or a number of times to play it. */
3
3
  export type SequenceStep = string | {
4
4
  clip: string;
@@ -10,5 +10,5 @@ export interface ParsedStep {
10
10
  seconds?: number;
11
11
  times?: number;
12
12
  }
13
- /** Reads "walk 3s, wave, cheer x2" (or an array of steps) into clip IDs with their lengths or counts. */
13
+ /** Reads "run 2s, vault_over, ledge_climb_up" (or an array of steps) into clip IDs with their lengths or counts. */
14
14
  export declare function parseSteps(steps: string | readonly SequenceStep[]): ParsedStep[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ara3d",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Realistic, rigged and animated 3D characters: a three.js library, an <ara-character> embed for any web page, and a command-line tool (GLB, FBX, OBJ). Free and open source.",
5
5
  "keywords": ["web-component", "embed", "3d", "character", "avatar", "glb", "gltf", "fbx", "three", "threejs", "rigged", "animation", "makehuman", "cli", "gamedev"],
6
6
  "homepage": "https://ara3dgen.com/docs/library/",