@spatialwalk/avatarkit 1.0.0-beta.73 → 1.0.0-beta.74

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/CHANGELOG.md CHANGED
@@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [1.0.0-beta.74] - 2026-01-22
9
+
10
+ ### 🔧 Improvements
11
+ - **Transition API** - Replaced `generateTransitionFromIdle` with `generateTransition` (options-based API: `from`, `to`, `frameCount`, `useLinear`)
12
+
8
13
  ## [1.0.0-beta.73] - 2026-01-22
9
14
 
10
15
  ### ✨ New Features
@@ -1,7 +1,7 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { A as APP_CONFIG, l as logger, e as errorToMessage, a as logEvent } from "./index-AtEuBzqP.js";
4
+ import { A as APP_CONFIG, l as logger, e as errorToMessage, a as logEvent } from "./index-CXzGTmFB.js";
5
5
  class StreamingAudioPlayer {
6
6
  // Mark if AudioContext is being resumed, avoid concurrent resume requests
7
7
  constructor(options) {
File without changes
@@ -55,14 +55,12 @@ export declare class AvatarView {
55
55
  * @param enableIdleRendering - Whether to enable idle loop rendering. true: Enable idle rendering and return immediately (skip this keyframe); false: Disable idle rendering and process keyframe (default)
56
56
  */
57
57
  renderFlame(keyframeData: KeyframeData, enableIdleRendering?: boolean): Promise<void>;
58
- /**
59
- * Generate transition frame array from current idle frame to target keyframe (pure rendering mode)
60
- * @param toKeyframeData - Target keyframe data
61
- * @param frameCount - Number of transition frames
62
- * @param transitionType - Transition type: 'start' means Idle -> toKeyframeData (start transition), 'end' means toKeyframeData -> Idle (end transition)
63
- * @returns Transition frame array with length of frameCount
64
- */
65
- generateTransitionFromIdle(toKeyframeData: KeyframeData, frameCount: number, transitionType?: 'start' | 'end'): Promise<KeyframeData[]>;
58
+ generateTransition(options: {
59
+ from?: KeyframeData;
60
+ to?: KeyframeData;
61
+ frameCount: number;
62
+ useLinear?: boolean;
63
+ }): Promise<KeyframeData[]>;
66
64
  /**
67
65
  * Get or set avatar transform in canvas
68
66
  *
@@ -8243,7 +8243,7 @@ const _AnimationPlayer = class _AnimationPlayer {
8243
8243
  if (this.streamingPlayer) {
8244
8244
  return;
8245
8245
  }
8246
- const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-C8IqtjfL.js");
8246
+ const { StreamingAudioPlayer } = await import("./StreamingAudioPlayer-BDIgU70Y.js");
8247
8247
  const { AvatarSDK: AvatarSDK2 } = await Promise.resolve().then(() => AvatarSDK$1);
8248
8248
  const audioFormat = AvatarSDK2.getAudioFormat();
8249
8249
  this.streamingPlayer = new StreamingAudioPlayer({
@@ -9936,7 +9936,7 @@ class AvatarSDK {
9936
9936
  }
9937
9937
  __publicField(AvatarSDK, "_isInitialized", false);
9938
9938
  __publicField(AvatarSDK, "_configuration", null);
9939
- __publicField(AvatarSDK, "_version", "1.0.0-beta.73");
9939
+ __publicField(AvatarSDK, "_version", "1.0.0-beta.74");
9940
9940
  __publicField(AvatarSDK, "_avatarCore", null);
9941
9941
  __publicField(AvatarSDK, "_dynamicSdkConfig", null);
9942
9942
  const AvatarSDK$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
@@ -16679,17 +16679,11 @@ class AvatarView {
16679
16679
  throw error;
16680
16680
  }
16681
16681
  }
16682
- /**
16683
- * Generate transition frame array from current idle frame to target keyframe (pure rendering mode)
16684
- * @param toKeyframeData - Target keyframe data
16685
- * @param frameCount - Number of transition frames
16686
- * @param transitionType - Transition type: 'start' means Idle -> toKeyframeData (start transition), 'end' means toKeyframeData -> Idle (end transition)
16687
- * @returns Transition frame array with length of frameCount
16688
- */
16689
- async generateTransitionFromIdle(toKeyframeData, frameCount, transitionType = "start") {
16682
+ async generateTransition(options) {
16690
16683
  if (!this.isInitialized) {
16691
16684
  throw new Error("AvatarView not initialized");
16692
16685
  }
16686
+ const { from, to: to2, frameCount, useLinear = false } = options;
16693
16687
  if (frameCount <= 0) {
16694
16688
  throw new Error("Frame count must be greater than 0");
16695
16689
  }
@@ -16698,32 +16692,31 @@ class AvatarView {
16698
16692
  throw new Error("AvatarCore not available");
16699
16693
  }
16700
16694
  try {
16701
- const idleParams = await avatarCore.getCurrentFrameParams(this.idleCurrentFrameIndex, this.characterId);
16702
- const idleFrameProto = convertWasmParamsToProtoFlame(idleParams);
16703
- const toFlame = toKeyframeData;
16704
- const toFlameWithPostProcessing = this.avatarController.applyPostProcessingToFlame(toFlame);
16705
- const aligned = this.alignFlamePair(idleFrameProto, toFlameWithPostProcessing);
16706
- const from = transitionType === "start" ? aligned.from : aligned.to;
16707
- const to2 = transitionType === "start" ? aligned.to : aligned.from;
16695
+ let fromFrame;
16696
+ if (from) {
16697
+ fromFrame = from;
16698
+ } else {
16699
+ const idleParams = await avatarCore.getCurrentFrameParams(this.idleCurrentFrameIndex, this.characterId);
16700
+ fromFrame = convertWasmParamsToProtoFlame(idleParams);
16701
+ }
16702
+ let toFrame;
16703
+ if (to2) {
16704
+ toFrame = this.avatarController.applyPostProcessingToFlame(to2);
16705
+ } else {
16706
+ const idleFirstParams = await avatarCore.getCurrentFrameParams(0, this.characterId);
16707
+ toFrame = convertWasmParamsToProtoFlame(idleFirstParams);
16708
+ }
16709
+ const aligned = this.alignFlamePair(fromFrame, toFrame);
16710
+ const alignedFrom = aligned.from;
16711
+ const alignedTo = aligned.to;
16708
16712
  const fps = APP_CONFIG.animation.fps;
16709
16713
  const durationMs = frameCount / fps * 1e3;
16710
- const useLinear = transitionType === "start";
16711
- const transitionFrames = useLinear ? generateTransitionFramesLinear(
16712
- from,
16713
- to2,
16714
- durationMs,
16715
- fps
16716
- ) : generateTransitionFrames(
16717
- from,
16718
- to2,
16719
- durationMs,
16720
- fps
16721
- );
16722
- transitionFrames[0] = from;
16723
- transitionFrames[transitionFrames.length - 1] = to2;
16714
+ const transitionFrames = useLinear ? generateTransitionFramesLinear(alignedFrom, alignedTo, durationMs, fps) : generateTransitionFrames(alignedFrom, alignedTo, durationMs, fps);
16715
+ transitionFrames[0] = alignedFrom;
16716
+ transitionFrames[transitionFrames.length - 1] = alignedTo;
16724
16717
  return transitionFrames;
16725
16718
  } catch (error) {
16726
- logger.error("[AvatarView] Failed to generate transition from idle:", error instanceof Error ? error.message : String(error));
16719
+ logger.error("[AvatarView] Failed to generate transition:", error instanceof Error ? error.message : String(error));
16727
16720
  throw error;
16728
16721
  }
16729
16722
  }
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { b, c, m, f, d, j, g, C, i, D, E, k, h, L, R, n } from "./index-AtEuBzqP.js";
1
+ import { b, c, m, f, d, j, g, C, i, D, E, k, h, L, R, n } from "./index-CXzGTmFB.js";
2
2
  export {
3
3
  b as Avatar,
4
4
  c as AvatarController,
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "@spatialwalk/avatarkit",
3
3
  "type": "module",
4
- "version": "1.0.0-beta.73",
5
- "packageManager": "pnpm@10.18.2",
4
+ "version": "1.0.0-beta.74",
6
5
  "description": "AvatarKit SDK - 3D Gaussian Splatting Avatar Rendering SDK",
7
6
  "author": "AvatarKit Team",
8
7
  "license": "MIT",
@@ -38,17 +37,6 @@
38
37
  "vite.js",
39
38
  "vite.d.ts"
40
39
  ],
41
- "scripts": {
42
- "build": "SDK_BUILD=true vite build --mode library && npm run build:vite-plugin",
43
- "build:vite-plugin": "tsc vite.ts --outDir . --module esnext --target es2020 --moduleResolution bundler --esModuleInterop --skipLibCheck --declaration --declarationMap",
44
- "dev": "vite build --mode library --watch",
45
- "clean": "rm -rf dist",
46
- "typecheck": "tsc --noEmit",
47
- "test": "cd tests && pnpm test",
48
- "test:watch": "cd tests && pnpm run test:watch",
49
- "test:e2e": "cd tests && pnpm run test:e2e",
50
- "test:perf": "cd tests && pnpm run test:perf"
51
- },
52
40
  "peerDependencies": {
53
41
  "@webgpu/types": "*",
54
42
  "vite": "^5.0.0"
@@ -66,5 +54,16 @@
66
54
  "typescript": "^5.0.0",
67
55
  "vite": "^5.0.0",
68
56
  "vite-plugin-dts": "^4.5.4"
57
+ },
58
+ "scripts": {
59
+ "build": "SDK_BUILD=true vite build --mode library && npm run build:vite-plugin",
60
+ "build:vite-plugin": "tsc vite.ts --outDir . --module esnext --target es2020 --moduleResolution bundler --esModuleInterop --skipLibCheck --declaration --declarationMap",
61
+ "dev": "vite build --mode library --watch",
62
+ "clean": "rm -rf dist",
63
+ "typecheck": "tsc --noEmit",
64
+ "test": "cd tests && pnpm test",
65
+ "test:watch": "cd tests && pnpm run test:watch",
66
+ "test:e2e": "cd tests && pnpm run test:e2e",
67
+ "test:perf": "cd tests && pnpm run test:perf"
69
68
  }
70
- }
69
+ }