agent-robot-avatar 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/CHANGELOG.md +60 -0
- package/LICENSE +21 -0
- package/README.md +286 -0
- package/agent-robot-avatar.js +16 -0
- package/assets/support/alipay.png +0 -0
- package/assets/support/wechat-pay.png +0 -0
- package/docs/README.de.md +152 -0
- package/docs/README.es.md +217 -0
- package/docs/README.fr.md +215 -0
- package/docs/README.ja.md +217 -0
- package/docs/README.ko.md +217 -0
- package/docs/README.pt.md +217 -0
- package/docs/README.zh-CN.md +286 -0
- package/docs/README.zh-TW.md +219 -0
- package/index.d.ts +78 -0
- package/package.json +76 -0
- package/src/agent-robot-avatar-actions.js +394 -0
- package/src/agent-robot-avatar-antenna-flash.js +127 -0
- package/src/agent-robot-avatar-antenna.js +173 -0
- package/src/agent-robot-avatar-core.js +1056 -0
- package/src/agent-robot-avatar-extension-host.js +73 -0
- package/src/agent-robot-avatar-failure.js +127 -0
- package/src/agent-robot-avatar-head-roundness.js +136 -0
- package/src/agent-robot-avatar-inspect.js +231 -0
- package/src/agent-robot-avatar-version.js +3 -0
- package/src/agent-robot-avatar-waiting.js +121 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Agent Robot Avatar
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="../assets/readme/agent-robot-avatar-header.jpg" alt="Agent Robot Avatar">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
[English](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/README.md) | [简体中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-CN.md) | [繁體中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-TW.md) | [日本語](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.ja.md) | [한국어](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.ko.md) | [Español](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.es.md) | [Português](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.pt.md) | [Deutsch](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.de.md) | [Français](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.fr.md)
|
|
8
|
+
|
|
9
|
+
 [](../LICENSE) [](https://github.com/CX-ArtLab/agent-robot-avatar/actions/workflows/validate.yml) [](https://ko-fi.com/P0E625WIOI)
|
|
10
|
+
|
|
11
|
+
      
|
|
12
|
+
|
|
13
|
+
Un Web Component ligero y expresivo de avatar robótico para agentes de IA y otras aplicaciones interactivas.
|
|
14
|
+
|
|
15
|
+
Agent Robot Avatar está construido con SVG y JavaScript nativo, sin depender de frameworks de animación de terceros. Funciona como un Custom Element nativo y ofrece una API compacta para expresiones, estados de interacción, seguimiento del puntero, espera y forma de la cabeza.
|
|
16
|
+
|
|
17
|
+
**Versión pública actual: v0.2.0**
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<img src="../assets/demo/agent-robot-avatar-demo.gif" alt="Demostración animada interactiva de Agent Robot Avatar" width="560">
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
## Características principales
|
|
24
|
+
|
|
25
|
+
- SVG + JavaScript nativo
|
|
26
|
+
- Web Component nativo
|
|
27
|
+
- Sin dependencias de frameworks de animación
|
|
28
|
+
- Parpadeo automático y mirada sutil
|
|
29
|
+
- Seguimiento del puntero y movimiento de cabeza con inercia
|
|
30
|
+
- Deformación local tipo gelatina al arrastrar y recuperación elástica
|
|
31
|
+
- Estados y expresiones de Agent controlables por código
|
|
32
|
+
- Semántica separada para espera, fallo, advertencia, revisión, bloqueo y error del sistema
|
|
33
|
+
- Redondez de la cabeza ajustable
|
|
34
|
+
- Antena flotante con parpadeo de estado opcional
|
|
35
|
+
- Demo separado del componente reutilizable
|
|
36
|
+
|
|
37
|
+
## Inicio rápido
|
|
38
|
+
|
|
39
|
+
Si usas directamente el código del repositorio, conserva `agent-robot-avatar.js` junto con `src/` y carga la entrada pública:
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<script type="module" src="./agent-robot-avatar.js"></script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<agent-robot-avatar id="avatar"></agent-robot-avatar>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
El avatar entra automáticamente en el estado idle. Hay un ejemplo mínimo en [`examples/basic.html`](../examples/basic.html).
|
|
50
|
+
|
|
51
|
+
## API básica
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
const avatar = document.querySelector('#avatar');
|
|
55
|
+
|
|
56
|
+
avatar.play('success');
|
|
57
|
+
avatar.play('failure');
|
|
58
|
+
avatar.play('warning');
|
|
59
|
+
avatar.play('inspect');
|
|
60
|
+
avatar.play('angry');
|
|
61
|
+
avatar.play('error');
|
|
62
|
+
|
|
63
|
+
avatar.reset();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Estados y expresiones
|
|
67
|
+
|
|
68
|
+
| Estado | API | Uso previsto |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| Idle | `idle` | Estado normal de reposo |
|
|
71
|
+
| Bored | `bored` | Periodos largos sin tarea activa |
|
|
72
|
+
| Waiting | `waiting` | Solicitud enviada, esperando resultado |
|
|
73
|
+
| Input | `input` | El usuario está escribiendo |
|
|
74
|
+
| Send | `send` | Envío / gesto de asentir |
|
|
75
|
+
| Success | `success` | Tarea completada correctamente |
|
|
76
|
+
| Failure | `failure` | La tarea terminó sin éxito |
|
|
77
|
+
| Warning | `warning` | Acción arriesgada o destructiva que requiere confirmación |
|
|
78
|
+
| Inspect | `inspect` | Revisar, comprobar o verificar un resultado |
|
|
79
|
+
| Blocked | `angry` | Solicitud bloqueada o que no puede continuar |
|
|
80
|
+
| System error | `error` | Error de conexión, servicio o sistema |
|
|
81
|
+
| Surprise | `surprise` | Resultado o evento inesperado |
|
|
82
|
+
| Sleep | `sleep` | Entrar en reposo |
|
|
83
|
+
| Wake | `wake` | Despertar |
|
|
84
|
+
|
|
85
|
+
`failure` representa un fallo de la tarea; `error` se reserva para problemas de conexión, servicio o sistema. `waiting` indica una solicitud pendiente y `bored` indica inactividad.
|
|
86
|
+
|
|
87
|
+
También hay alias semánticos:
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
avatar.play('failed');
|
|
91
|
+
avatar.play('fail');
|
|
92
|
+
avatar.play('verify');
|
|
93
|
+
avatar.play('review');
|
|
94
|
+
avatar.play('blocked');
|
|
95
|
+
avatar.play('policy-blocked');
|
|
96
|
+
avatar.play('system-error');
|
|
97
|
+
avatar.play('connection-error');
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Espera continua
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
avatar.startWaiting();
|
|
104
|
+
// Detener cuando llegue la respuesta o el resultado.
|
|
105
|
+
avatar.stopWaiting();
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Cualquier otra acción también interrumpe el estado waiting activo.
|
|
109
|
+
|
|
110
|
+
## Seguimiento del puntero
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
avatar.setPointerFollow(false);
|
|
114
|
+
avatar.setPointerFollow(true);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Redondez de la cabeza
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
avatar.setHeadRoundness(0); // más cuadrada
|
|
121
|
+
avatar.setHeadRoundness(50); // predeterminado
|
|
122
|
+
avatar.setHeadRoundness(100); // más redonda
|
|
123
|
+
|
|
124
|
+
console.log(avatar.getHeadRoundness());
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Los valores se limitan a `0–100`. Al cambiar se emite `head-roundness-change`.
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
avatar.addEventListener('head-roundness-change', (event) => {
|
|
131
|
+
console.log(event.detail.value);
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Evento de estado
|
|
136
|
+
|
|
137
|
+
Cada cambio visual emite `face-state`:
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
avatar.addEventListener('face-state', (event) => {
|
|
141
|
+
console.log(event.detail.state);
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Atributos
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<agent-robot-avatar
|
|
149
|
+
size="160"
|
|
150
|
+
color="#08090b"
|
|
151
|
+
auto-sleep="30000">
|
|
152
|
+
</agent-robot-avatar>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
| Atributo | Descripción |
|
|
156
|
+
| --- | --- |
|
|
157
|
+
| `size` | Tamaño del componente en píxeles |
|
|
158
|
+
| `color` | Color principal del avatar |
|
|
159
|
+
| `auto-sleep` | Tiempo de inactividad antes de dormir, en ms; `0` lo desactiva |
|
|
160
|
+
|
|
161
|
+
## Comportamiento predeterminado
|
|
162
|
+
|
|
163
|
+
Sin llamadas explícitas a la API, el avatar ya ofrece parpadeo aleatorio, movimiento sutil de la mirada, seguimiento del puntero cercano, movimiento inercial de la cabeza, retorno natural a idle y suspensión automática opcional.
|
|
164
|
+
|
|
165
|
+
## Interacción de arrastre
|
|
166
|
+
|
|
167
|
+
Al arrastrar, la cabeza se deforma localmente alrededor del punto de interacción en lugar de moverse como un objeto rígido.
|
|
168
|
+
|
|
169
|
+
- Tirón fuerte hacia fuera: activa `angry` después de recuperarse
|
|
170
|
+
- Empuje fuerte hacia el centro: activa `success` después de recuperarse
|
|
171
|
+
- Arrastre pequeño: solo deformación
|
|
172
|
+
|
|
173
|
+
## Demo interactiva
|
|
174
|
+
|
|
175
|
+
`demo/index.html` incluye todos los estados públicos, seguimiento del puntero, arrastre tipo gelatina, ciclo de waiting, ajuste de redondez, controles de color y comportamiento y una simulación de conversación con Agent. El JavaScript exclusivo de la Demo está aislado en `demo/` y no forma parte del runtime reutilizable de npm.
|
|
176
|
+
|
|
177
|
+
## Estructura del proyecto
|
|
178
|
+
|
|
179
|
+
```text
|
|
180
|
+
agent-robot-avatar.js Entrada pública del componente
|
|
181
|
+
src/ Runtime reutilizable y módulos de expresiones
|
|
182
|
+
demo/ Demo interactiva y scripts exclusivos
|
|
183
|
+
examples/ Ejemplos mínimos de integración
|
|
184
|
+
assets/support/ Recursos QR de apoyo / pago
|
|
185
|
+
docs/ Documentación multilingüe
|
|
186
|
+
README.md Documento principal en inglés
|
|
187
|
+
CHANGELOG.md Historial público de versiones
|
|
188
|
+
CONTRIBUTING.md Guía de contribución
|
|
189
|
+
package.json Metadatos del paquete
|
|
190
|
+
LICENSE Licencia MIT
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Distribución y compatibilidad
|
|
194
|
+
|
|
195
|
+
El paquete está publicado en npm como `agent-robot-avatar` e incluye declaraciones TypeScript para acciones, eventos y métodos públicos. Está pensado para navegadores modernos compatibles con ES Modules, Custom Elements, SVG, Pointer Events y Web Animations API.
|
|
196
|
+
|
|
197
|
+
## Contribuir
|
|
198
|
+
|
|
199
|
+
Se aceptan Issues y Pull Requests. Consulta [`CONTRIBUTING.md`](../CONTRIBUTING.md) antes de enviar cambios.
|
|
200
|
+
|
|
201
|
+
## Estado del proyecto
|
|
202
|
+
|
|
203
|
+
v0.1.0 es la primera línea de versión pública. La API pública se mantiene deliberadamente pequeña para poder evolucionar con cuidado antes de un futuro compromiso de estabilidad `1.0.0`.
|
|
204
|
+
|
|
205
|
+
Agent Robot Avatar es un proyecto independiente de código abierto y no está afiliado, respaldado ni representa a ninguna plataforma o marca de IA.
|
|
206
|
+
|
|
207
|
+
## Licencia
|
|
208
|
+
|
|
209
|
+
MIT License. Consulta [`LICENSE`](../LICENSE).
|
|
210
|
+
|
|
211
|
+
## Invítame a un café
|
|
212
|
+
|
|
213
|
+
Si el proyecto te resulta útil, puedes apoyarlo con el método que prefieras:
|
|
214
|
+
|
|
215
|
+
| Ko-fi | Alipay | WeChat Pay |
|
|
216
|
+
| --- | --- | --- |
|
|
217
|
+
| <a href='https://ko-fi.com/P0E625WIOI' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi6.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a> | <img src="../assets/support/alipay.png" alt="Código QR de Alipay" width="160"> | <img src="../assets/support/wechat-pay.png" alt="Código QR de WeChat Pay" width="160"> |
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# Agent Robot Avatar
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="../assets/readme/agent-robot-avatar-header.jpg" alt="Agent Robot Avatar">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
[English](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/README.md) | [简体中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-CN.md) | [繁體中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-TW.md) | [日本語](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.ja.md) | [한국어](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.ko.md) | [Español](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.es.md) | [Português](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.pt.md) | [Deutsch](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.de.md) | [Français](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.fr.md)
|
|
8
|
+
|
|
9
|
+
 [](../LICENSE) [](https://github.com/CX-ArtLab/agent-robot-avatar/actions/workflows/validate.yml) [](https://ko-fi.com/P0E625WIOI)
|
|
10
|
+
|
|
11
|
+
Un Web Component léger et expressif d’avatar robot pour les agents IA et d’autres applications interactives.
|
|
12
|
+
|
|
13
|
+
Agent Robot Avatar est construit avec SVG et JavaScript natif, sans framework d’animation tiers. Il fonctionne comme un Custom Element natif et propose une API compacte pour les expressions, les états d’interaction, le suivi du pointeur, l’attente et la forme de la tête.
|
|
14
|
+
|
|
15
|
+
**Version publique actuelle : v0.2.0**
|
|
16
|
+
|
|
17
|
+
<p align="center">
|
|
18
|
+
<img src="../assets/demo/agent-robot-avatar-demo.gif" alt="Démonstration animée interactive d’Agent Robot Avatar" width="560">
|
|
19
|
+
</p>
|
|
20
|
+
|
|
21
|
+
## Points forts
|
|
22
|
+
|
|
23
|
+
- SVG + JavaScript natif
|
|
24
|
+
- Web Component natif
|
|
25
|
+
- Aucune dépendance à un framework d’animation
|
|
26
|
+
- Clignement automatique et mouvements subtils du regard
|
|
27
|
+
- Suivi du pointeur et mouvement de tête avec inertie
|
|
28
|
+
- Déformation locale type gelée lors du glisser et retour élastique
|
|
29
|
+
- États et expressions d’Agent pilotables par code
|
|
30
|
+
- Sémantique distincte pour waiting, failure, warning, inspect, blocked et system error
|
|
31
|
+
- Arrondi de la tête réglable
|
|
32
|
+
- Antenne flottante avec clignotement d’état optionnel
|
|
33
|
+
- Demo séparée du composant réutilisable
|
|
34
|
+
|
|
35
|
+
## Démarrage rapide
|
|
36
|
+
|
|
37
|
+
Si vous utilisez directement le code du dépôt, conservez `agent-robot-avatar.js` avec le dossier `src/`, puis chargez l’entrée publique :
|
|
38
|
+
|
|
39
|
+
```html
|
|
40
|
+
<script type="module" src="./agent-robot-avatar.js"></script>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<agent-robot-avatar id="avatar"></agent-robot-avatar>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
L’avatar passe automatiquement à l’état idle. Un exemple minimal est disponible dans [`examples/basic.html`](../examples/basic.html).
|
|
48
|
+
|
|
49
|
+
## API de base
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
const avatar = document.querySelector('#avatar');
|
|
53
|
+
|
|
54
|
+
avatar.play('success');
|
|
55
|
+
avatar.play('failure');
|
|
56
|
+
avatar.play('warning');
|
|
57
|
+
avatar.play('inspect');
|
|
58
|
+
avatar.play('angry');
|
|
59
|
+
avatar.play('error');
|
|
60
|
+
|
|
61
|
+
avatar.reset();
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## États et expressions
|
|
65
|
+
|
|
66
|
+
| État | API | Usage |
|
|
67
|
+
| --- | --- | --- |
|
|
68
|
+
| Idle | `idle` | État d’attente normal |
|
|
69
|
+
| Bored | `bored` | Longue période sans tâche active |
|
|
70
|
+
| Waiting | `waiting` | Requête envoyée, résultat en attente |
|
|
71
|
+
| Input | `input` | L’utilisateur saisit du texte |
|
|
72
|
+
| Send | `send` | Envoi / retour par hochement |
|
|
73
|
+
| Success | `success` | Tâche terminée avec succès |
|
|
74
|
+
| Failure | `failure` | Tâche terminée sans succès |
|
|
75
|
+
| Warning | `warning` | Action importante nécessitant confirmation |
|
|
76
|
+
| Inspect | `inspect` | Examiner, contrôler ou vérifier un résultat |
|
|
77
|
+
| Blocked | `angry` | Requête bloquée ou impossible à poursuivre |
|
|
78
|
+
| System error | `error` | Erreur de connexion, de service ou système |
|
|
79
|
+
| Surprise | `surprise` | Événement ou résultat inattendu |
|
|
80
|
+
| Sleep | `sleep` | Entrer en veille |
|
|
81
|
+
| Wake | `wake` | Sortir de veille |
|
|
82
|
+
|
|
83
|
+
`failure` correspond à l’échec de la tâche elle-même ; `error` est réservé aux problèmes de connexion, de service ou de système. `waiting` indique une requête en cours et `bored` une période d’inactivité.
|
|
84
|
+
|
|
85
|
+
Des alias sémantiques sont également disponibles :
|
|
86
|
+
|
|
87
|
+
```js
|
|
88
|
+
avatar.play('failed');
|
|
89
|
+
avatar.play('fail');
|
|
90
|
+
avatar.play('verify');
|
|
91
|
+
avatar.play('review');
|
|
92
|
+
avatar.play('blocked');
|
|
93
|
+
avatar.play('policy-blocked');
|
|
94
|
+
avatar.play('system-error');
|
|
95
|
+
avatar.play('connection-error');
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Attente continue
|
|
99
|
+
|
|
100
|
+
```js
|
|
101
|
+
avatar.startWaiting();
|
|
102
|
+
// Arrêter lorsque la réponse ou le résultat arrive.
|
|
103
|
+
avatar.stopWaiting();
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Toute autre action interrompt aussi l’état waiting actif.
|
|
107
|
+
|
|
108
|
+
## Suivi du pointeur
|
|
109
|
+
|
|
110
|
+
```js
|
|
111
|
+
avatar.setPointerFollow(false);
|
|
112
|
+
avatar.setPointerFollow(true);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Arrondi de la tête
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
avatar.setHeadRoundness(0); // plus carrée
|
|
119
|
+
avatar.setHeadRoundness(50); // valeur par défaut
|
|
120
|
+
avatar.setHeadRoundness(100); // plus ronde
|
|
121
|
+
|
|
122
|
+
console.log(avatar.getHeadRoundness());
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
Les valeurs sont limitées à `0–100`. Les changements déclenchent `head-roundness-change`.
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
avatar.addEventListener('head-roundness-change', (event) => {
|
|
129
|
+
console.log(event.detail.value);
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Événement d’état
|
|
134
|
+
|
|
135
|
+
Chaque changement visuel déclenche `face-state` :
|
|
136
|
+
|
|
137
|
+
```js
|
|
138
|
+
avatar.addEventListener('face-state', (event) => {
|
|
139
|
+
console.log(event.detail.state);
|
|
140
|
+
});
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Attributs
|
|
144
|
+
|
|
145
|
+
```html
|
|
146
|
+
<agent-robot-avatar
|
|
147
|
+
size="160"
|
|
148
|
+
color="#08090b"
|
|
149
|
+
auto-sleep="30000">
|
|
150
|
+
</agent-robot-avatar>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| Attribut | Description |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| `size` | Taille du composant en pixels |
|
|
156
|
+
| `color` | Couleur principale de l’avatar |
|
|
157
|
+
| `auto-sleep` | Temps d’inactivité avant veille automatique, en ms ; `0` désactive la fonction |
|
|
158
|
+
|
|
159
|
+
## Comportement par défaut
|
|
160
|
+
|
|
161
|
+
Sans appel explicite à l’API, l’avatar propose déjà des clignements aléatoires, de petits mouvements du regard, le suivi du pointeur proche, une légère inertie de la tête, un retour naturel à idle et une veille automatique optionnelle.
|
|
162
|
+
|
|
163
|
+
## Interaction par glisser
|
|
164
|
+
|
|
165
|
+
Lors du glisser, la tête se déforme localement autour du point d’interaction au lieu de se déplacer comme un objet rigide.
|
|
166
|
+
|
|
167
|
+
- Forte traction vers l’extérieur : déclenche `angry` après le retour
|
|
168
|
+
- Forte poussée vers le centre : déclenche `success` après le retour
|
|
169
|
+
- Petit glisser : déformation uniquement
|
|
170
|
+
|
|
171
|
+
## Demo interactive
|
|
172
|
+
|
|
173
|
+
`demo/index.html` contient tous les états publics, le suivi du pointeur, le glisser type gelée, le cycle waiting, le réglage de l’arrondi, les contrôles de couleur et de comportement et une simulation de conversation Agent. Le JavaScript propre à la Demo reste dans `demo/` et n’est pas inclus dans le runtime npm réutilisable.
|
|
174
|
+
|
|
175
|
+
## Structure du projet
|
|
176
|
+
|
|
177
|
+
```text
|
|
178
|
+
agent-robot-avatar.js Entrée publique du composant
|
|
179
|
+
src/ Runtime réutilisable et modules d’expression
|
|
180
|
+
demo/ Demo interactive et scripts dédiés
|
|
181
|
+
examples/ Exemples minimaux d’intégration
|
|
182
|
+
assets/support/ Ressources QR de soutien / paiement
|
|
183
|
+
docs/ Documentation multilingue
|
|
184
|
+
README.md Documentation principale en anglais
|
|
185
|
+
CHANGELOG.md Historique public des versions
|
|
186
|
+
CONTRIBUTING.md Guide de contribution
|
|
187
|
+
package.json Métadonnées du paquet
|
|
188
|
+
LICENSE Licence MIT
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Distribution et compatibilité
|
|
192
|
+
|
|
193
|
+
Le paquet est publié sur npm sous le nom `agent-robot-avatar` et inclut des déclarations TypeScript pour les actions, les événements et les méthodes publiques. Le composant cible les navigateurs modernes prenant en charge ES Modules, Custom Elements, SVG, Pointer Events et Web Animations API.
|
|
194
|
+
|
|
195
|
+
## Contribuer
|
|
196
|
+
|
|
197
|
+
Issues et Pull Requests sont les bienvenus. Consultez [`CONTRIBUTING.md`](../CONTRIBUTING.md) avant de proposer des changements.
|
|
198
|
+
|
|
199
|
+
## État du projet
|
|
200
|
+
|
|
201
|
+
v0.1.0 est la première ligne de version publique. L’API publique reste volontairement limitée afin d’évoluer avec prudence avant un futur engagement de stabilité `1.0.0`.
|
|
202
|
+
|
|
203
|
+
Agent Robot Avatar est un projet open source développé indépendamment ; il n’est affilié, approuvé ni représentatif d’aucune plateforme ou marque d’IA.
|
|
204
|
+
|
|
205
|
+
## Licence
|
|
206
|
+
|
|
207
|
+
MIT License. Voir [`LICENSE`](../LICENSE).
|
|
208
|
+
|
|
209
|
+
## Offrez-moi un café
|
|
210
|
+
|
|
211
|
+
Si ce projet vous est utile, vous pouvez le soutenir avec la méthode qui vous convient :
|
|
212
|
+
|
|
213
|
+
| Ko-fi | Alipay | WeChat Pay |
|
|
214
|
+
| --- | --- | --- |
|
|
215
|
+
| <a href='https://ko-fi.com/P0E625WIOI' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi6.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a> | <img src="../assets/support/alipay.png" alt="QR code Alipay" width="160"> | <img src="../assets/support/wechat-pay.png" alt="QR code WeChat Pay" width="160"> |
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
# Agent Robot Avatar
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="../assets/readme/agent-robot-avatar-header.jpg" alt="Agent Robot Avatar">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
[English](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/README.md) | [简体中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-CN.md) | [繁體中文](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.zh-TW.md) | [日本語](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.ja.md) | [한국어](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.ko.md) | [Español](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.es.md) | [Português](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.pt.md) | [Deutsch](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.de.md) | [Français](https://github.com/CX-ArtLab/agent-robot-avatar/blob/main/docs/README.fr.md)
|
|
8
|
+
|
|
9
|
+
 [](../LICENSE) [](https://github.com/CX-ArtLab/agent-robot-avatar/actions/workflows/validate.yml) [](https://ko-fi.com/P0E625WIOI)
|
|
10
|
+
|
|
11
|
+
      
|
|
12
|
+
|
|
13
|
+
AI エージェントやその他のインタラクティブなアプリケーションで使える、軽量で表情豊かなロボットアバター Web Component です。
|
|
14
|
+
|
|
15
|
+
Agent Robot Avatar は SVG と Vanilla JavaScript だけで構築され、サードパーティー製アニメーションフレームワークに依存しません。ネイティブ Custom Element として動作し、表情、状態、ポインター追従、待機フィードバック、頭部形状をシンプルな API で制御できます。
|
|
16
|
+
|
|
17
|
+
**現在の公開バージョン:v0.2.0**
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<img src="../assets/demo/agent-robot-avatar-demo.gif" alt="Agent Robot Avatar インタラクティブアニメーションデモ" width="560">
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
## 特長
|
|
24
|
+
|
|
25
|
+
- SVG + Vanilla JavaScript
|
|
26
|
+
- ネイティブ Web Component
|
|
27
|
+
- 外部アニメーション依存なし
|
|
28
|
+
- 自動まばたきと自然な視線移動
|
|
29
|
+
- ポインター追従と慣性のある頭部モーション
|
|
30
|
+
- 局所的なゼリー風ドラッグ変形と弾性復帰
|
|
31
|
+
- Agent の状態や表情をプログラムから制御可能
|
|
32
|
+
- waiting / failure / warning / inspect / blocked / system error を意味的に分離
|
|
33
|
+
- 頭部の丸みを調整可能
|
|
34
|
+
- オプションで点滅するフローティングアンテナ
|
|
35
|
+
- Demo と再利用可能なコンポーネント本体を分離
|
|
36
|
+
|
|
37
|
+
## クイックスタート
|
|
38
|
+
|
|
39
|
+
リポジトリのソースを直接使う場合は、ルートの `agent-robot-avatar.js` と `src/` を同じ構成で保ち、公開エントリを読み込みます。
|
|
40
|
+
|
|
41
|
+
```html
|
|
42
|
+
<script type="module" src="./agent-robot-avatar.js"></script>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```html
|
|
46
|
+
<agent-robot-avatar id="avatar"></agent-robot-avatar>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
読み込み後は自動的に idle 状態になります。最小サンプルは [`examples/basic.html`](../examples/basic.html) にあります。
|
|
50
|
+
|
|
51
|
+
## 基本 API
|
|
52
|
+
|
|
53
|
+
```js
|
|
54
|
+
const avatar = document.querySelector('#avatar');
|
|
55
|
+
|
|
56
|
+
avatar.play('success');
|
|
57
|
+
avatar.play('failure');
|
|
58
|
+
avatar.play('warning');
|
|
59
|
+
avatar.play('inspect');
|
|
60
|
+
avatar.play('angry');
|
|
61
|
+
avatar.play('error');
|
|
62
|
+
|
|
63
|
+
avatar.reset();
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 状態と表情
|
|
67
|
+
|
|
68
|
+
| 状態 | API 名 | 用途 |
|
|
69
|
+
| --- | --- | --- |
|
|
70
|
+
| Idle | `idle` | 通常の待機状態 |
|
|
71
|
+
| Bored | `bored` | 長時間タスクがない状態 |
|
|
72
|
+
| Waiting | `waiting` | リクエスト送信後、結果待ち |
|
|
73
|
+
| Input | `input` | ユーザー入力中 |
|
|
74
|
+
| Send | `send` | 送信 / うなずきフィードバック |
|
|
75
|
+
| Success | `success` | タスク成功 |
|
|
76
|
+
| Failure | `failure` | タスク自体が失敗 |
|
|
77
|
+
| Warning | `warning` | 危険・破壊的な操作の確認 |
|
|
78
|
+
| Inspect | `inspect` | 結果の確認・検証 |
|
|
79
|
+
| Blocked | `angry` | リクエストが拒否・停止された状態 |
|
|
80
|
+
| System error | `error` | 接続・サービス・システム障害 |
|
|
81
|
+
| Surprise | `surprise` | 予期しない結果 |
|
|
82
|
+
| Sleep | `sleep` | スリープへ移行 |
|
|
83
|
+
| Wake | `wake` | スリープから復帰 |
|
|
84
|
+
|
|
85
|
+
`failure` はタスク結果の失敗、`error` は接続・サービス・システム側の障害を表します。`waiting` は進行中の待機、`bored` はアクティブなタスクがない状態です。
|
|
86
|
+
|
|
87
|
+
セマンティックエイリアスも利用できます。
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
avatar.play('failed');
|
|
91
|
+
avatar.play('fail');
|
|
92
|
+
avatar.play('verify');
|
|
93
|
+
avatar.play('review');
|
|
94
|
+
avatar.play('blocked');
|
|
95
|
+
avatar.play('policy-blocked');
|
|
96
|
+
avatar.play('system-error');
|
|
97
|
+
avatar.play('connection-error');
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## 継続待機
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
avatar.startWaiting();
|
|
104
|
+
// 結果が返ったら停止します。
|
|
105
|
+
avatar.stopWaiting();
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
別のアクションを再生した場合も waiting は解除されます。
|
|
109
|
+
|
|
110
|
+
## ポインター追従
|
|
111
|
+
|
|
112
|
+
```js
|
|
113
|
+
avatar.setPointerFollow(false);
|
|
114
|
+
avatar.setPointerFollow(true);
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## 頭部の丸み
|
|
118
|
+
|
|
119
|
+
```js
|
|
120
|
+
avatar.setHeadRoundness(0); // より角ばった形
|
|
121
|
+
avatar.setHeadRoundness(50); // デフォルト
|
|
122
|
+
avatar.setHeadRoundness(100); // より丸い形
|
|
123
|
+
|
|
124
|
+
console.log(avatar.getHeadRoundness());
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
値は `0–100` に制限されます。変更時には `head-roundness-change` イベントが発火します。
|
|
128
|
+
|
|
129
|
+
```js
|
|
130
|
+
avatar.addEventListener('head-roundness-change', (event) => {
|
|
131
|
+
console.log(event.detail.value);
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 状態イベント
|
|
136
|
+
|
|
137
|
+
表示状態が変化すると `face-state` イベントが発火します。
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
avatar.addEventListener('face-state', (event) => {
|
|
141
|
+
console.log(event.detail.state);
|
|
142
|
+
});
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## 属性
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<agent-robot-avatar
|
|
149
|
+
size="160"
|
|
150
|
+
color="#08090b"
|
|
151
|
+
auto-sleep="30000">
|
|
152
|
+
</agent-robot-avatar>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
| 属性 | 説明 |
|
|
156
|
+
| --- | --- |
|
|
157
|
+
| `size` | コンポーネントのサイズ(px) |
|
|
158
|
+
| `color` | アバターのメインカラー |
|
|
159
|
+
| `auto-sleep` | 自動スリープまでのアイドル時間(ms)。`0` で無効 |
|
|
160
|
+
|
|
161
|
+
## デフォルト動作
|
|
162
|
+
|
|
163
|
+
API を呼ばなくても、ランダムなまばたき、視線移動、近くのポインターへの追従、軽い慣性モーション、自然な idle 復帰、オプションの自動スリープが動作します。
|
|
164
|
+
|
|
165
|
+
## ドラッグ操作
|
|
166
|
+
|
|
167
|
+
ドラッグ時は頭全体を剛体として動かすのではなく、操作点の周辺が局所的に変形します。
|
|
168
|
+
|
|
169
|
+
- 強く外側へ引く:復帰後に `angry`
|
|
170
|
+
- 強く中心へ押す:復帰後に `success`
|
|
171
|
+
- 小さなドラッグ:変形のみ
|
|
172
|
+
|
|
173
|
+
## インタラクティブ Demo
|
|
174
|
+
|
|
175
|
+
`demo/index.html` には全公開状態、ポインター追従、ゼリー風ドラッグ、waiting ライフサイクル、頭部丸み調整、色・挙動設定、Agent 会話シミュレーションが含まれます。Demo 専用 JavaScript は `demo/` に分離され、再利用用 npm runtime には含まれません。
|
|
176
|
+
|
|
177
|
+
## プロジェクト構成
|
|
178
|
+
|
|
179
|
+
```text
|
|
180
|
+
agent-robot-avatar.js 公開コンポーネントのエントリ
|
|
181
|
+
src/ 再利用可能な runtime / 表情モジュール
|
|
182
|
+
demo/ インタラクティブ Demo と専用スクリプト
|
|
183
|
+
examples/ 最小統合サンプル
|
|
184
|
+
assets/support/ 支援 / 決済 QR アセット
|
|
185
|
+
docs/ 多言語ドキュメント
|
|
186
|
+
README.md 英語メインドキュメント
|
|
187
|
+
CHANGELOG.md 公開リリース履歴
|
|
188
|
+
CONTRIBUTING.md コントリビューションガイド
|
|
189
|
+
package.json パッケージ情報
|
|
190
|
+
LICENSE MIT License
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## 配布と互換性
|
|
194
|
+
|
|
195
|
+
パッケージは `agent-robot-avatar` として npm に公開され、アクション、イベント、公開メソッドの TypeScript 型定義を含みます。ES Modules、Custom Elements、SVG、Pointer Events、Web Animations API をサポートするモダンブラウザーを対象とします。
|
|
196
|
+
|
|
197
|
+
## コントリビューション
|
|
198
|
+
|
|
199
|
+
Issue と Pull Request を歓迎します。提出前に [`CONTRIBUTING.md`](../CONTRIBUTING.md) を確認してください。
|
|
200
|
+
|
|
201
|
+
## プロジェクトの状態
|
|
202
|
+
|
|
203
|
+
v0.1.0 は最初の公開リリースラインです。将来の `1.0.0` に向けて慎重に進化できるよう、公開 API は意図的に小さく保っています。
|
|
204
|
+
|
|
205
|
+
Agent Robot Avatar は独立して開発されたオープンソースプロジェクトであり、特定の AI プラットフォームやブランドとは提携・公式承認関係にありません。
|
|
206
|
+
|
|
207
|
+
## License
|
|
208
|
+
|
|
209
|
+
MIT License。詳細は [`LICENSE`](../LICENSE) を参照してください。
|
|
210
|
+
|
|
211
|
+
## コーヒーで支援
|
|
212
|
+
|
|
213
|
+
このプロジェクトが役立った場合は、使いやすい方法で支援できます。
|
|
214
|
+
|
|
215
|
+
| Ko-fi | Alipay | WeChat Pay |
|
|
216
|
+
| --- | --- | --- |
|
|
217
|
+
| <a href='https://ko-fi.com/P0E625WIOI' target='_blank'><img height='36' style='border:0px;height:36px;' src='https://storage.ko-fi.com/cdn/kofi6.png?v=6' border='0' alt='Buy Me a Coffee at ko-fi.com' /></a> | <img src="../assets/support/alipay.png" alt="Alipay QR code" width="160"> | <img src="../assets/support/wechat-pay.png" alt="WeChat Pay QR code" width="160"> |
|