@spatialwalk/avatarkit 1.0.0-beta.31 → 1.0.0-beta.34
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 +10 -0
- package/README.md +24 -5
- package/dist/{StreamingAudioPlayer-B07iPxK4.js → StreamingAudioPlayer-D_anvcr1.js} +1 -1
- package/dist/core/AvatarController.d.ts +1 -1
- package/dist/core/AvatarView.d.ts +1 -0
- package/dist/{index-CCBBCJi2.js → index-D8QhzqfR.js} +4629 -4065
- package/dist/index.js +1 -1
- package/dist/renderer/renderer.d.ts +6 -1
- package/dist/renderer/webgl/webglRenderer.d.ts +16 -2
- package/dist/renderer/webgpu/webgpuRenderer.d.ts +15 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ 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.34] - 2025-12-16
|
|
9
|
+
|
|
10
|
+
### ✨ New Features
|
|
11
|
+
- **Avatar Transform API** - Added `setTransform` method to `AvatarView` for controlling avatar position and scale within the canvas. Supports normalized coordinates (-1 to 1) for position and scale factor.
|
|
12
|
+
|
|
13
|
+
## [1.0.0-beta.32] - 2025-12-16
|
|
14
|
+
|
|
15
|
+
### 🔄 Breaking Changes
|
|
16
|
+
- **Host Mode Interface** - Updated `yieldFramesData` method to accept binary data array instead of single binary data. The method now processes multiple protobuf-encoded Message objects in a single call.
|
|
17
|
+
|
|
8
18
|
## [1.0.0-beta.31] - 2025-12-16
|
|
9
19
|
|
|
10
20
|
### 🐛 Bugfix
|
package/README.md
CHANGED
|
@@ -87,7 +87,7 @@ const avatarView = new AvatarView(avatar, container)
|
|
|
87
87
|
// 4. Host Mode Workflow:
|
|
88
88
|
// Send audio data first to get conversationId, then use it to send animation data
|
|
89
89
|
const conversationId = avatarView.avatarController.yieldAudioData(audioData, false)
|
|
90
|
-
avatarView.avatarController.yieldFramesData(
|
|
90
|
+
avatarView.avatarController.yieldFramesData(animationDataArray, conversationId) // animationDataArray: (Uint8Array | ArrayBuffer)[]
|
|
91
91
|
```
|
|
92
92
|
|
|
93
93
|
### Complete Examples
|
|
@@ -177,7 +177,7 @@ External data source (audio + animation)
|
|
|
177
177
|
↓
|
|
178
178
|
AvatarController.yieldAudioData(audioChunk) // Returns conversationId
|
|
179
179
|
↓
|
|
180
|
-
AvatarController.yieldFramesData(
|
|
180
|
+
AvatarController.yieldFramesData(keyframesDataArray, conversationId) // keyframesDataArray: (Uint8Array | ArrayBuffer)[] - each element is a protobuf encoded Message
|
|
181
181
|
↓
|
|
182
182
|
AvatarController → AnimationPlayer (synchronized playback)
|
|
183
183
|
↓
|
|
@@ -292,6 +292,12 @@ const avatarView = new AvatarView(avatar, container)
|
|
|
292
292
|
// Wait for first frame to render
|
|
293
293
|
await avatarView.ready // Promise that resolves when the first frame is rendered
|
|
294
294
|
|
|
295
|
+
// Set avatar transform (position and scale)
|
|
296
|
+
avatarView.setTransform(x, y, scale)
|
|
297
|
+
// - x: Horizontal offset in normalized coordinates (-1 to 1, where -1 = left edge, 0 = center, 1 = right edge)
|
|
298
|
+
// - y: Vertical offset in normalized coordinates (-1 to 1, where -1 = bottom edge, 0 = center, 1 = top edge)
|
|
299
|
+
// - scale: Scale factor (1.0 = original size, 2.0 = double size, 0.5 = half size)
|
|
300
|
+
|
|
295
301
|
// Cleanup resources (must be called before switching characters)
|
|
296
302
|
avatarView.dispose()
|
|
297
303
|
```
|
|
@@ -348,8 +354,8 @@ const conversationId = avatarView.avatarController.yieldAudioData(
|
|
|
348
354
|
|
|
349
355
|
// Stream animation keyframes (requires conversationId from audio data)
|
|
350
356
|
avatarView.avatarController.yieldFramesData(
|
|
351
|
-
|
|
352
|
-
conversationId: string
|
|
357
|
+
keyframesDataArray: (Uint8Array | ArrayBuffer)[], // Animation keyframes binary data array (each element is a protobuf encoded Message)
|
|
358
|
+
conversationId: string // Conversation ID (required)
|
|
353
359
|
)
|
|
354
360
|
```
|
|
355
361
|
|
|
@@ -389,6 +395,19 @@ avatarView.avatarController.onConversationState = (state: ConversationState) =>
|
|
|
389
395
|
avatarView.avatarController.onError = (error: Error) => {}
|
|
390
396
|
```
|
|
391
397
|
|
|
398
|
+
#### Avatar Transform Methods
|
|
399
|
+
|
|
400
|
+
```typescript
|
|
401
|
+
// Set avatar transform (position and scale in canvas)
|
|
402
|
+
avatarView.setTransform(x, y, scale)
|
|
403
|
+
// - x: Horizontal offset in normalized coordinates (-1 to 1, where -1 = left edge, 0 = center, 1 = right edge)
|
|
404
|
+
// - y: Vertical offset in normalized coordinates (-1 to 1, where -1 = bottom edge, 0 = center, 1 = top edge)
|
|
405
|
+
// - scale: Scale factor (1.0 = original size, 2.0 = double size, 0.5 = half size)
|
|
406
|
+
// Example:
|
|
407
|
+
avatarView.setTransform(0, 0, 1.0) // Center, original size
|
|
408
|
+
avatarView.setTransform(0.5, 0, 2.0) // Right half, double size
|
|
409
|
+
```
|
|
410
|
+
|
|
392
411
|
**Important Notes:**
|
|
393
412
|
- `start()` and `close()` are only available in SDK mode
|
|
394
413
|
- `yieldAudioData()` and `yieldFramesData()` are only available in Host mode
|
|
@@ -552,7 +571,7 @@ const avatarView = new AvatarView(avatar, container)
|
|
|
552
571
|
|
|
553
572
|
// Use
|
|
554
573
|
const conversationId = avatarView.avatarController.yieldAudioData(audioChunk, false)
|
|
555
|
-
avatarView.avatarController.yieldFramesData(
|
|
574
|
+
avatarView.avatarController.yieldFramesData(keyframesDataArray, conversationId) // keyframesDataArray: (Uint8Array | ArrayBuffer)[]
|
|
556
575
|
|
|
557
576
|
// Cleanup
|
|
558
577
|
avatarView.avatarController.clear() // Clear all data and resources
|
|
@@ -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, e as errorToMessage, l as logEvent, a as logger } from "./index-
|
|
4
|
+
import { A as APP_CONFIG, e as errorToMessage, l as logEvent, a as logger } from "./index-D8QhzqfR.js";
|
|
5
5
|
class StreamingAudioPlayer {
|
|
6
6
|
constructor(options) {
|
|
7
7
|
__publicField(this, "audioContext", null);
|
|
@@ -39,7 +39,7 @@ export declare class AvatarController {
|
|
|
39
39
|
send(audioData: ArrayBuffer, end?: boolean): string | null;
|
|
40
40
|
close(): void;
|
|
41
41
|
yieldAudioData(data: Uint8Array, isLast?: boolean): string | null;
|
|
42
|
-
yieldFramesData(
|
|
42
|
+
yieldFramesData(keyframesDataArray: (Uint8Array | ArrayBuffer)[], conversationId: string): void;
|
|
43
43
|
pause(): void;
|
|
44
44
|
resume(): Promise<void>;
|
|
45
45
|
interrupt(): void;
|