@j-kyoda/vue-three-vrm 0.9.1 → 0.10.1
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 +22 -1
- package/README.md.orig +158 -0
- package/dist/index.css +1 -1
- package/dist/vue-three-vrm.es.js +1629 -1007
- package/dist/vue-three-vrm.umd.js +16 -2
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ A Vue 3 component designed to render and display VRM models on your web pages.
|
|
|
7
7
|
Package is available on NPM: https://www.npmjs.com/package/@j-kyoda/vue-three-vrm
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm install @j-kyoda/vue-three-vrm three @pixiv/three-vrm
|
|
10
|
+
npm install @j-kyoda/vue-three-vrm three @pixiv/three-vrm @pixiv/three-vrm-animation
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
---
|
|
@@ -31,6 +31,10 @@ const model_name = 'chico_hoodie'
|
|
|
31
31
|
const pose_url = 'poses/chico_pose_goodjob_202506.json'
|
|
32
32
|
// toDo: Please enter your VRM model URL here.
|
|
33
33
|
const vrm_url = 'models/chico_hoodie.vrm'
|
|
34
|
+
// toDo: Please enter your VRMA file URL here.(OPTION)
|
|
35
|
+
const vrma_url = 'models/sample.vrma'
|
|
36
|
+
|
|
37
|
+
let _vrm_model = null
|
|
34
38
|
|
|
35
39
|
|
|
36
40
|
const context_initialized = async (context) => {
|
|
@@ -41,6 +45,9 @@ const context_initialized = async (context) => {
|
|
|
41
45
|
const model_loaded = (name, vrm_model) => {
|
|
42
46
|
const context = render_context.value
|
|
43
47
|
|
|
48
|
+
// save
|
|
49
|
+
_vrm_model = vrm_model
|
|
50
|
+
|
|
44
51
|
// add model to scene
|
|
45
52
|
const model = vrm_model.scene
|
|
46
53
|
model.name = name
|
|
@@ -49,6 +56,14 @@ const model_loaded = (name, vrm_model) => {
|
|
|
49
56
|
|
|
50
57
|
animation.value = true // Starting animation.
|
|
51
58
|
}
|
|
59
|
+
|
|
60
|
+
const cb_animate = (context) => {
|
|
61
|
+
const { deltaTime } = context
|
|
62
|
+
if (_vrm_model != null) {
|
|
63
|
+
// animate
|
|
64
|
+
_vrm_model.updateAnimation(deltaTime)
|
|
65
|
+
}
|
|
66
|
+
}
|
|
52
67
|
</script>
|
|
53
68
|
|
|
54
69
|
<template>
|
|
@@ -60,6 +75,7 @@ const model_loaded = (name, vrm_model) => {
|
|
|
60
75
|
:useAxesHelper="false"
|
|
61
76
|
:useDefaultLight="true"
|
|
62
77
|
v-on:initialized="context_initialized"
|
|
78
|
+
v-on:animate="cb_animate"
|
|
63
79
|
/>
|
|
64
80
|
</div>
|
|
65
81
|
<div v-if="context_ready">
|
|
@@ -67,6 +83,7 @@ const model_loaded = (name, vrm_model) => {
|
|
|
67
83
|
:model_name="model_name"
|
|
68
84
|
:pose_url="pose_url"
|
|
69
85
|
:vrm_url="vrm_url"
|
|
86
|
+
:vrma_url="vrma_url"
|
|
70
87
|
v-on:loaded="model_loaded"
|
|
71
88
|
/>
|
|
72
89
|
</div>
|
|
@@ -117,6 +134,7 @@ const model_loaded = (name, vrm_model) => {
|
|
|
117
134
|
VRMUtils,
|
|
118
135
|
camera, // Instance of THREE.PerspectiveCamera
|
|
119
136
|
controls, // Instance of OrbitControls
|
|
137
|
+
deltaTime, //
|
|
120
138
|
renderer, // Instance of THREE.WebGLRenderer
|
|
121
139
|
scene // Instance of THREE.Scene
|
|
122
140
|
}
|
|
@@ -138,6 +156,9 @@ const model_loaded = (name, vrm_model) => {
|
|
|
138
156
|
| vrm_name | String | 'vrm' | The name of the VRM model. |
|
|
139
157
|
| vrm_url | String | '' | The URL of the VRM model. |
|
|
140
158
|
| vrm_data | Object | null | The object for the VRM model. |
|
|
159
|
+
| vrma_name | String | '' | The name of the VRMA model. |
|
|
160
|
+
| vrma_url | String | null | The URL of the VRMA model. |
|
|
161
|
+
| vrma_data | Object | null | The object for the VRMA model. |
|
|
141
162
|
|
|
142
163
|
### Events (Emits)
|
|
143
164
|
|
package/README.md.orig
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# @j-kyoda/vue-three-vrm
|
|
2
|
+
|
|
3
|
+
A Vue 3 component designed to render and display VRM models on your web pages.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Package is available on NPM: https://www.npmjs.com/package/@j-kyoda/vue-three-vrm
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
npm install @j-kyoda/vue-three-vrm three @pixiv/three-vrm @pixiv/three-vrm-animation
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```vue
|
|
18
|
+
<script setup>
|
|
19
|
+
import { ref } from 'vue'
|
|
20
|
+
|
|
21
|
+
import { VroidControl, ThreeFrame } from '@j-kyoda/vue-three-vrm'
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
const context_ready = ref(false)
|
|
25
|
+
const render_context = ref(null)
|
|
26
|
+
const animation = ref(false)
|
|
27
|
+
|
|
28
|
+
// toDo: Please enter your model name here.
|
|
29
|
+
const model_name = 'chico_hoodie'
|
|
30
|
+
// toDo: Please enter your pose URL here.
|
|
31
|
+
const pose_url = 'poses/chico_pose_goodjob_202506.json'
|
|
32
|
+
// toDo: Please enter your VRM model URL here.
|
|
33
|
+
const vrm_url = 'models/chico_hoodie.vrm'
|
|
34
|
+
// toDo: Please enter your VRMA file URL here.(OPTION)
|
|
35
|
+
const vrma_url = 'models/sample.vrma'
|
|
36
|
+
|
|
37
|
+
const context_initialized = async (context) => {
|
|
38
|
+
render_context.value = context // save context
|
|
39
|
+
context_ready.value = true // Begin model loading.
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const model_loaded = (name, vrm_model) => {
|
|
43
|
+
const context = render_context.value
|
|
44
|
+
|
|
45
|
+
// add model to scene
|
|
46
|
+
const model = vrm_model.scene
|
|
47
|
+
model.name = name
|
|
48
|
+
vrm_model.setPosition({ x: 0, y: 0, z: 0 })
|
|
49
|
+
context.scene.add(model)
|
|
50
|
+
|
|
51
|
+
animation.value = true // Starting animation.
|
|
52
|
+
}
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<template>
|
|
56
|
+
<div class="frame">
|
|
57
|
+
<ThreeFrame
|
|
58
|
+
:animation="animation"
|
|
59
|
+
:useOrbitControls="true"
|
|
60
|
+
:useGridHelper="true"
|
|
61
|
+
:useAxesHelper="false"
|
|
62
|
+
:useDefaultLight="true"
|
|
63
|
+
v-on:initialized="context_initialized"
|
|
64
|
+
/>
|
|
65
|
+
</div>
|
|
66
|
+
<div v-if="context_ready">
|
|
67
|
+
<VroidControl
|
|
68
|
+
:model_name="model_name"
|
|
69
|
+
:pose_url="pose_url"
|
|
70
|
+
:vrm_url="vrm_url"
|
|
71
|
+
:vrma_url="vrma_url"
|
|
72
|
+
v-on:loaded="model_loaded"
|
|
73
|
+
/>
|
|
74
|
+
</div>
|
|
75
|
+
</template>
|
|
76
|
+
|
|
77
|
+
<style scoped>
|
|
78
|
+
.frame {
|
|
79
|
+
display: block;
|
|
80
|
+
width: 400px;
|
|
81
|
+
height: 400px;
|
|
82
|
+
margin: 0 auto;
|
|
83
|
+
padding: 0;
|
|
84
|
+
}
|
|
85
|
+
</style>
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## ThreeFrame
|
|
91
|
+
|
|
92
|
+
### Props
|
|
93
|
+
|
|
94
|
+
| ID | Type | Default | Description |
|
|
95
|
+
| :--------------- | :------- | :------ | :------------------------------------- |
|
|
96
|
+
| animation | Boolean | false | Controls animation loop execution. |
|
|
97
|
+
| clearAlpha | Number | 1.0 | Clear Alpha value. Ranges from 0 to 1. |
|
|
98
|
+
| clearColor | String | #7fbfff | Clear color value. |
|
|
99
|
+
| useOrbitControls | Boolean | false | Enables/disables `OrbitControls`. |
|
|
100
|
+
| useGridHelper | Boolean | false | Shows/hides the grid. |
|
|
101
|
+
| useAxesHelper | Boolean | false | Shows/hides the 3D axis arrows. |
|
|
102
|
+
| useDefaultLight | Boolean | false | Sets up default lighting. |
|
|
103
|
+
|
|
104
|
+
### Events (Emits)
|
|
105
|
+
|
|
106
|
+
| Event | Description | Payload |
|
|
107
|
+
| :----------- | :----------------------------------------------------- | :------------- |
|
|
108
|
+
| initialized | Occurs when the renderer setup is complete. | ContextObject |
|
|
109
|
+
| animate | Occurs before the rendering process in animation loop. | ContextObject |
|
|
110
|
+
|
|
111
|
+
## ContextObject
|
|
112
|
+
|
|
113
|
+
```
|
|
114
|
+
{
|
|
115
|
+
GLTFLoader,
|
|
116
|
+
THREE,
|
|
117
|
+
VRMExpressionPresetName,
|
|
118
|
+
VRMHumanBoneName,
|
|
119
|
+
VRMUtils,
|
|
120
|
+
camera, // Instance of THREE.PerspectiveCamera
|
|
121
|
+
controls, // Instance of OrbitControls
|
|
122
|
+
deltaTime, //
|
|
123
|
+
renderer, // Instance of THREE.WebGLRenderer
|
|
124
|
+
scene // Instance of THREE.Scene
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## VroidControl
|
|
129
|
+
|
|
130
|
+
### Props
|
|
131
|
+
|
|
132
|
+
| ID | Type | default | Description |
|
|
133
|
+
| :-------------- | :----- | :----------- | :------------------------------------------------------ |
|
|
134
|
+
| model_name | String | '' | The name of the VRoid model to display. **Required**. |
|
|
135
|
+
| expression_name | String | 'expression' | The name of the expression model. |
|
|
136
|
+
| expression_url | String | '' | The URL of the expression model. |
|
|
137
|
+
| expression_data | Object | null | The object for the expression model. |
|
|
138
|
+
| pose_name | String | 'pose' | The name of the pose model. |
|
|
139
|
+
| pose_url | String | '' | The URL of the pose model. |
|
|
140
|
+
| pose_data | Object | null | The object for the pose model. |
|
|
141
|
+
| vrm_name | String | 'vrm' | The name of the VRM model. |
|
|
142
|
+
| vrm_url | String | '' | The URL of the VRM model. |
|
|
143
|
+
| vrm_data | Object | null | The object for the VRM model. |
|
|
144
|
+
| vrma_name | String | '' | The name of the VRMA model. |
|
|
145
|
+
| vrma_url | String | null | The URL of the VRMA model. |
|
|
146
|
+
| vrma_data | Object | null | The object for the VRMA model. |
|
|
147
|
+
|
|
148
|
+
### Events (Emits)
|
|
149
|
+
|
|
150
|
+
| Event | Description | Payload |
|
|
151
|
+
| :--------- | :------------------------------------------------ | :----------------------------------- |
|
|
152
|
+
| loading | Occurs while the VRoid model is loading. | VRoid model name |
|
|
153
|
+
| loaded | Occurs when the VRoid model has finished loading. | VRoid model name, VRMModel instance |
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
## License
|
|
157
|
+
|
|
158
|
+
This project is licensed under the MIT License. For more details, please refer to the LICENSE file located at the root of the project.
|
package/dist/index.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.box[data-v-
|
|
1
|
+
.box[data-v-1e83d65e]{display:block;width:100%;height:100%}
|