vue-plugin-live2d 0.0.14 โ 0.0.16
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/README.md +101 -1
- package/package.json +12 -10
package/README.md
CHANGED
|
@@ -1,3 +1,103 @@
|
|
|
1
1
|
# vue-plugin-live2d
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Vue 3 compatibility component for `@doki-land/live2d`.
|
|
4
|
+
|
|
5
|
+
This adapter helps existing Vue applications mount the browser-native runtime. It is not the architectural center of the
|
|
6
|
+
project and does not replace the framework-independent facade used by game engines and other hosts.
|
|
7
|
+
|
|
8
|
+
## โจ Features
|
|
9
|
+
|
|
10
|
+
- Declarative model source.
|
|
11
|
+
- Configurable canvas dimensions.
|
|
12
|
+
- Renderer preference passthrough.
|
|
13
|
+
- Loading progress overlay.
|
|
14
|
+
- Ready, error, progress, profile, and hit events.
|
|
15
|
+
- Optional browser animation loop.
|
|
16
|
+
- Pointer tracking.
|
|
17
|
+
- Parameter inspection and mutation through the exposed component API.
|
|
18
|
+
|
|
19
|
+
## ๐ฆ Installation
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pnpm add vue-plugin-live2d @doki-land/live2d vue
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## ๐ Quick Start
|
|
26
|
+
|
|
27
|
+
```vue
|
|
28
|
+
<script setup lang="ts">
|
|
29
|
+
import { Live2D } from "vue-plugin-live2d";
|
|
30
|
+
</script>
|
|
31
|
+
|
|
32
|
+
<template>
|
|
33
|
+
<Live2D
|
|
34
|
+
model="/models/character.model3.json"
|
|
35
|
+
:width="480"
|
|
36
|
+
:height="640"
|
|
37
|
+
:prefer="['webgpu', 'webgl2', 'canvas2d']"
|
|
38
|
+
:autoplay="true"
|
|
39
|
+
:auto-sway="true"
|
|
40
|
+
@ready="(modelId) => console.log('ready', modelId)"
|
|
41
|
+
@hit="(payload) => console.log('hit', payload.area)"
|
|
42
|
+
@error="(error) => console.error(error)"
|
|
43
|
+
/>
|
|
44
|
+
</template>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## ๐๏ธ Component API
|
|
48
|
+
|
|
49
|
+
Use a template ref for runtime-level controls:
|
|
50
|
+
|
|
51
|
+
```vue
|
|
52
|
+
<script setup lang="ts">
|
|
53
|
+
import { ref } from "vue";
|
|
54
|
+
import { Live2D } from "vue-plugin-live2d";
|
|
55
|
+
|
|
56
|
+
const actor = ref<InstanceType<typeof Live2D> | null>(null);
|
|
57
|
+
|
|
58
|
+
function lookLeft() {
|
|
59
|
+
actor.value?.setParameter("PARAM_ANGLE_X", -15);
|
|
60
|
+
}
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<template>
|
|
64
|
+
<Live2D ref="actor" model="/models/character.model3.json" />
|
|
65
|
+
<button type="button" @click="lookLeft">Look left</button>
|
|
66
|
+
</template>
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The component exposes runtime access, parameter operations, parameter listing, manual-angle reset, and reload behavior
|
|
70
|
+
supported by the current implementation.
|
|
71
|
+
|
|
72
|
+
## ๐ Lifecycle
|
|
73
|
+
|
|
74
|
+
The component creates and destroys its runtime with the Vue component lifecycle. Model, size, renderer preference, and
|
|
75
|
+
autoplay changes can remount the canvas or reload the model depending on the affected state.
|
|
76
|
+
|
|
77
|
+
Avoid rapidly changing the model prop without handling loading and error states. Remote model requests may complete out
|
|
78
|
+
of order unless the runtime cancels stale generations.
|
|
79
|
+
|
|
80
|
+
## ๐ฎ Game Engine Guidance
|
|
81
|
+
|
|
82
|
+
Do not use this adapter merely because a game editor or shell contains Vue. If the game engine already owns the canvas
|
|
83
|
+
and frame loop, integrate `@doki-land/live2d` directly so the engine controls scheduling, input, resize, and resource
|
|
84
|
+
lifetime.
|
|
85
|
+
|
|
86
|
+
## ๐งช Development
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
pnpm --filter vue-plugin-live2d typecheck
|
|
90
|
+
pnpm --filter vue-plugin-live2d test
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Tests should cover repeated mount/unmount, prop-driven reloads, stale loads, pointer coordinates, event forwarding, and
|
|
94
|
+
resource cleanup.
|
|
95
|
+
|
|
96
|
+
## ๐ค Contributing
|
|
97
|
+
|
|
98
|
+
Keep the adapter thin. Shared pointer, stage, actor, animation, and rendering semantics belong in the runtime rather
|
|
99
|
+
than being reimplemented for Vue.
|
|
100
|
+
|
|
101
|
+
## ๐ License
|
|
102
|
+
|
|
103
|
+
See the repository license.
|
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vue-plugin-live2d",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "Vue
|
|
3
|
+
"version": "0.0.16",
|
|
4
|
+
"description": "Vue 3 <Live2D> component โ mount @doki-land/live2d with props, progress UI, and lifecycle.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"
|
|
7
|
+
"homepage": "https://github.com/doki-land/live2d.ts",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/doki-land/live2d.ts.git",
|
|
11
|
+
"directory": "projects/adaptors/vue-plugin-live2d"
|
|
12
|
+
},
|
|
8
13
|
"keywords": [
|
|
9
14
|
"live2d",
|
|
10
15
|
"vue",
|
|
@@ -18,7 +23,8 @@
|
|
|
18
23
|
},
|
|
19
24
|
"files": [
|
|
20
25
|
"dist",
|
|
21
|
-
"src"
|
|
26
|
+
"src",
|
|
27
|
+
"README.md"
|
|
22
28
|
],
|
|
23
29
|
"publishConfig": {
|
|
24
30
|
"access": "public"
|
|
@@ -31,11 +37,7 @@
|
|
|
31
37
|
"vue": "^3.4.0"
|
|
32
38
|
},
|
|
33
39
|
"dependencies": {
|
|
34
|
-
"@doki-land/live2d": "0.0.
|
|
40
|
+
"@doki-land/live2d": "0.0.16"
|
|
35
41
|
},
|
|
36
|
-
"sideEffects": false
|
|
37
|
-
"repository": {
|
|
38
|
-
"type": "git",
|
|
39
|
-
"url": "git+https://github.com/doki-land/live2d.ts.git"
|
|
40
|
-
}
|
|
42
|
+
"sideEffects": false
|
|
41
43
|
}
|