angular-avatar-player 0.1.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/LICENSE +21 -0
- package/README.md +105 -0
- package/fesm2022/angular-avatar-player.mjs +1664 -0
- package/fesm2022/angular-avatar-player.mjs.map +1 -0
- package/index.d.ts +20 -0
- package/lib/avatar-player.module.d.ts +9 -0
- package/lib/components/avatar-player/avatar-player.component.d.ts +28 -0
- package/lib/components/svg-avatar/svg-avatar.component.d.ts +52 -0
- package/lib/geometry/avatar-animator.d.ts +36 -0
- package/lib/geometry/avatar-renderer.d.ts +64 -0
- package/lib/geometry/avatar.model.d.ts +24 -0
- package/lib/geometry/eye-colors.d.ts +2 -0
- package/lib/geometry/hair-colors.d.ts +2 -0
- package/lib/geometry/index.d.ts +46 -0
- package/lib/geometry/lip-sync-player.d.ts +16 -0
- package/lib/geometry/skin-tones.d.ts +21 -0
- package/lib/geometry/svg-parts/beard-path.d.ts +16 -0
- package/lib/geometry/svg-parts/beard-shapes.d.ts +2 -0
- package/lib/geometry/svg-parts/eye-shapes.d.ts +7 -0
- package/lib/geometry/svg-parts/glasses-shapes.d.ts +2 -0
- package/lib/geometry/svg-parts/hair-shapes.d.ts +7 -0
- package/lib/geometry/svg-parts/mouth-shapes.d.ts +1 -0
- package/lib/geometry/svg-parts/mustache-shapes.d.ts +2 -0
- package/lib/geometry/svg-parts/profession-layers.d.ts +7 -0
- package/lib/geometry/trait-previews.d.ts +2 -0
- package/lib/geometry/visemes.d.ts +19 -0
- package/lib/services/avatar-animation.service.d.ts +14 -0
- package/lib/services/lip-sync.service.d.ts +13 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mateusz Psuja
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
# angular-avatar-player
|
|
2
|
+
|
|
3
|
+
Animated SVG avatar component for Angular 19. Blinking, eye movement, head idle
|
|
4
|
+
motion and lip sync — rendered as pure vector SVG, so there are no images, no
|
|
5
|
+
fonts and no runtime assets to ship.
|
|
6
|
+
|
|
7
|
+
Every avatar is a plain `AvatarConfig` object, so an avatar designed in one app
|
|
8
|
+
can be stored, sent over the wire and rendered in another.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install angular-avatar-player
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`@angular/core`, `@angular/common` and `@angular/platform-browser` are peer
|
|
17
|
+
dependencies (v19). `tslib` is the only regular dependency.
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### Standalone component
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
import { Component } from '@angular/core';
|
|
25
|
+
import { AvatarPlayerComponent, type AvatarConfig } from 'angular-avatar-player';
|
|
26
|
+
|
|
27
|
+
@Component({
|
|
28
|
+
selector: 'app-chat-bubble',
|
|
29
|
+
imports: [AvatarPlayerComponent],
|
|
30
|
+
template: `
|
|
31
|
+
<app-avatar-player
|
|
32
|
+
[config]="avatar"
|
|
33
|
+
[message]="line"
|
|
34
|
+
[speaking]="talking"
|
|
35
|
+
/>
|
|
36
|
+
`,
|
|
37
|
+
})
|
|
38
|
+
export class ChatBubble {
|
|
39
|
+
avatar: AvatarConfig = { /* 11 traits */ };
|
|
40
|
+
line = 'Hi, I am talking while you read this.';
|
|
41
|
+
talking = true;
|
|
42
|
+
}
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### NgModule-based apps
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
import { importProvidersFrom } from '@angular/core';
|
|
49
|
+
import { AvatarPlayerModule } from 'angular-avatar-player';
|
|
50
|
+
|
|
51
|
+
export const appConfig: ApplicationConfig = {
|
|
52
|
+
providers: [importProvidersFrom(AvatarPlayerModule)],
|
|
53
|
+
};
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## What you get
|
|
57
|
+
|
|
58
|
+
Everything is exported from the single entry point:
|
|
59
|
+
|
|
60
|
+
| Export | Purpose |
|
|
61
|
+
| --- | --- |
|
|
62
|
+
| `AvatarPlayerComponent` | Animated player (blinking, eye tracking, idle motion, lip sync) |
|
|
63
|
+
| `SvgAvatarComponent` | Static SVG avatar, no animation |
|
|
64
|
+
| `AvatarPlayerModule` | NgModule wrapper for module-based apps |
|
|
65
|
+
| `AvatarConfig` + trait types | The avatar model: gender, skin tone, haircut, hair/eye colour, glasses, facial hair, profession |
|
|
66
|
+
| `SKIN_TONES`, `HAIR_COLORS`, `EYE_COLORS` | Palettes, for building pickers |
|
|
67
|
+
| `buildAvatarSvg`, `buildAvatarSvgInner`, `avatarCssVars` | Server-safe renderer, also usable in Node for offline export |
|
|
68
|
+
| `textToVisemes`, `MS_PER_VISEME`, viseme shapes | Lip-sync mapping |
|
|
69
|
+
| `buildTraitPreview` | Small trait thumbnails for creator UIs |
|
|
70
|
+
| `LipSyncService`, `AvatarAnimationService` | Lower-level services |
|
|
71
|
+
|
|
72
|
+
### Rendering outside Angular
|
|
73
|
+
|
|
74
|
+
The renderer is pure and dependency-free, so it works in Node too:
|
|
75
|
+
|
|
76
|
+
```ts
|
|
77
|
+
import { buildAvatarSvg, textToVisemes } from 'angular-avatar-player';
|
|
78
|
+
|
|
79
|
+
const svg = buildAvatarSvg(config);
|
|
80
|
+
const visemes = textToVisemes('Hello there');
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Peer dependencies
|
|
84
|
+
|
|
85
|
+
Angular 19. For Angular 20+ wait for a compatible release, or use
|
|
86
|
+
`--legacy-peer-deps`.
|
|
87
|
+
|
|
88
|
+
## License
|
|
89
|
+
|
|
90
|
+
MIT © Mateusz Psuja — see [LICENSE](https://github.com/MateuszPsuja/AvatarCreator/blob/main/LICENSE).
|
|
91
|
+
|
|
92
|
+
## Related packages
|
|
93
|
+
|
|
94
|
+
The geometry, palettes and lip-sync mapping ship **inside** this package (see
|
|
95
|
+
`src/lib/geometry`) — no second install, and everything above is importable from
|
|
96
|
+
this single path. They are plain TypeScript, so `buildAvatarSvg` also runs in
|
|
97
|
+
Node for offline SVG export.
|
|
98
|
+
|
|
99
|
+
[`react-avatar-player`](https://www.npmjs.com/package/react-avatar-player) is
|
|
100
|
+
the same player for React, compiled from the same geometry files, so an avatar
|
|
101
|
+
looks and animates identically in either framework.
|
|
102
|
+
|
|
103
|
+
Part of [AvatarCreator](https://github.com/MateuszPsuja/AvatarCreator), which
|
|
104
|
+
includes a full browser-based avatar creator. Report issues
|
|
105
|
+
[on GitHub](https://github.com/MateuszPsuja/AvatarCreator/issues).
|