├── .gitattributes ├── .gitignore ├── README.md ├── index.html └── js ├── Resources └── lafei_4 │ ├── lafei_4.moc3 │ ├── lafei_4.model3.json │ ├── lafei_4.physics3.json │ ├── motions │ ├── complete.motion3.json │ ├── home.motion3.json │ ├── idle.motion3.json │ ├── login.motion3.json │ ├── mail.motion3.json │ ├── main_1.motion3.json │ ├── main_2.motion3.json │ ├── main_3.motion3.json │ ├── mission.motion3.json │ ├── mission_complete.motion3.json │ ├── touch_body.motion3.json │ ├── touch_head.motion3.json │ ├── touch_special.motion3.json │ └── wedding.motion3.json │ └── textures │ └── texture_00.png ├── frame ├── live2dcubismcore.min.js └── pixi.min.js ├── l2d.js ├── live2dcubismframework.js ├── live2dcubismpixi.js └── main.js /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | assets/ 2 | js/js-old/ 3 | node_modules/ 4 | webpack.config.js 5 | test.html -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # l2d 2 | 3 | 本项目基于[AzurLaneL2DViewer](https://github.com/alg-wiki/AzurLaneL2DViewer)修改而来,支持点击对应区域触发动作(需要.model3.json格式规范,具体格式可参考[Json配置](http://live2d.pavostudio.com/doc/zh-cn/live2d/model-config/))。 4 | 5 | # 更新 6 | 7 | 2020.10.15 添加按Order排序功能 8 | 9 | # 使用方法 10 | 在网页上添加以下脚本即可 11 | ```html 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 38 | ``` 39 | # 预览 40 | 41 | [预览](https://aged-frost-ce9d.tohowtodoit.workers.dev/) 42 | 43 | # TODO 44 | 45 | * 格式化碧蓝模型 46 | * 支持较为完整的json配置 47 | * 声音支持 48 | * 文本支持 49 | * 模型切换 50 | -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | live2d-demo 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 34 | 36 | 37 | 38 | 39 |
40 | 41 | -------------------------------------------------------------------------------- /js/Resources/lafei_4/lafei_4.moc3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UsernameFull/l2d/c836e9a33fec42154cfd12d6d9b339df2fb7da38/js/Resources/lafei_4/lafei_4.moc3 -------------------------------------------------------------------------------- /js/Resources/lafei_4/lafei_4.model3.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 3, 3 | "FileReferences": { 4 | "Moc": "lafei_4.moc3", 5 | "Textures": [ 6 | "textures/texture_00.png" 7 | ], 8 | "Physics": "lafei_4.physics3.json", 9 | "Motions": { 10 | "Idle": [ 11 | { 12 | "Name": "idle", 13 | "File": "motions/idle.motion3.json" 14 | }, 15 | { 16 | "Name": "main_1", 17 | "File": "motions/main_1.motion3.json" 18 | }, 19 | { 20 | "Name": "mian_2", 21 | "File": "motions/main_2.motion3.json" 22 | }, 23 | { 24 | "Name": "main_3", 25 | "File": "motions/main_3.motion3.json" 26 | } 27 | ], 28 | "Start": [ 29 | { 30 | "Name": "login", 31 | "File": "motions/login.motion3.json" 32 | } 33 | ], 34 | "TapBody": [ 35 | { 36 | "Name": "touch_body", 37 | "File": "motions/touch_body.motion3.json", 38 | "Text": "touch_body", 39 | "TextDuration": 1000 40 | } 41 | ], 42 | "TapHead": [ 43 | { 44 | "Name": "touch_head", 45 | "File": "motions/touch_head.motion3.json" 46 | } 47 | ], 48 | "TapSpecial": [ 49 | { 50 | "Name": "touch_special", 51 | "File": "motions/touch_special.motion3.json" 52 | } 53 | ], 54 | "Tick": [ 55 | { 56 | "File": "motions/mail.motion3.json" 57 | } 58 | ], 59 | "Leave": [ 60 | { 61 | "File": "motions/complete.motion3.json" 62 | } 63 | ], 64 | "Shake": [ 65 | { 66 | "Name": "shake", 67 | "File": "motions/touch_head.motion3.json", 68 | "Text": "do not shake", 69 | "TextDuration": 1000 70 | } 71 | ] 72 | } 73 | }, 74 | "Controllers": { 75 | "ParamHit": { 76 | "Enabled": true 77 | }, 78 | "ParamLoop": {}, 79 | "KeyTrigger": { 80 | "Enabled": true 81 | }, 82 | "EyeBlink": { 83 | "MinInterval": 500, 84 | "MaxInterval": 6000, 85 | "Items": [ 86 | { 87 | "Id": "ParamEyeLOpen", 88 | "Min": 0.0, 89 | "Max": 1.0, 90 | "BlendMode": 2, 91 | "Input": 0 92 | }, 93 | { 94 | "Id": "ParamEyeROpen", 95 | "Min": 0.0, 96 | "Max": 1.0, 97 | "BlendMode": 2, 98 | "Input": 0 99 | } 100 | ], 101 | "Enabled": true 102 | }, 103 | "LipSync": { 104 | "Gain": 5.0, 105 | "Items": [ 106 | { 107 | "Id": "ParamMouthOpenY", 108 | "Min": 0.0, 109 | "Max": 1.0, 110 | "Input": 0 111 | } 112 | ], 113 | "Enabled": true 114 | }, 115 | "MouseTracking": { 116 | "SmoothTime": 0.15, 117 | "Enabled": true 118 | }, 119 | "AutoBreath": { 120 | "Enabled": true 121 | }, 122 | "ExtraMotion": { 123 | "Enabled": true 124 | }, 125 | "Accelerometer": { 126 | "Enabled": true 127 | }, 128 | "Microphone": { 129 | "Enabled": true 130 | }, 131 | "Transform": {}, 132 | "FaceTracking": { 133 | "Enabled": true 134 | }, 135 | "ParamValue": { 136 | "Enabled": true 137 | }, 138 | "PartOpacity": { 139 | "Enabled": true 140 | }, 141 | "ArtmeshOpacity": { 142 | "Enabled": true 143 | }, 144 | "ArtmeshColor": { 145 | "Enabled": true 146 | }, 147 | "ArtmeshCulling": { 148 | "DefaultMode": 0, 149 | "Enabled": true 150 | }, 151 | "IntimacySystem": { 152 | "Enabled": true 153 | } 154 | }, 155 | "HitAreas": [ 156 | { 157 | "Name": "Body", 158 | "Id": "TouchBody", 159 | "Motion": "TapBody" 160 | }, 161 | { 162 | "Name": "Head", 163 | "Id": "TouchHead", 164 | "Motion": "TapHead:touch_head" 165 | }, 166 | { 167 | "Name": "Special", 168 | "Id": "TouchSpecial", 169 | "Order": 1, 170 | "Motion": "TapSpecial:touch_special" 171 | } 172 | ], 173 | "Options": {} 174 | } -------------------------------------------------------------------------------- /js/Resources/lafei_4/lafei_4.physics3.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 3, 3 | "Meta": { 4 | "PhysicsSettingCount": 5, 5 | "TotalInputCount": 15, 6 | "TotalOutputCount": 10, 7 | "VertexCount": 10, 8 | "EffectiveForces": { 9 | "Gravity": { 10 | "X": 0, 11 | "Y": -1 12 | }, 13 | "Wind": { 14 | "X": 0, 15 | "Y": 0 16 | } 17 | }, 18 | "PhysicsDictionary": [ 19 | { 20 | "Id": "PhysicsSetting1", 21 | "Name": "刘海摇摆" 22 | }, 23 | { 24 | "Id": "PhysicsSetting2", 25 | "Name": "兔耳摇摆" 26 | }, 27 | { 28 | "Id": "PhysicsSetting3", 29 | "Name": "铃铛摇摆" 30 | }, 31 | { 32 | "Id": "PhysicsSetting4", 33 | "Name": "发丝摇摆" 34 | }, 35 | { 36 | "Id": "PhysicsSetting6", 37 | "Name": "舰装摇摆" 38 | } 39 | ] 40 | }, 41 | "PhysicsSettings": [ 42 | { 43 | "Id": "PhysicsSetting1", 44 | "Input": [ 45 | { 46 | "Source": { 47 | "Target": "Parameter", 48 | "Id": "ParamAngleX" 49 | }, 50 | "Weight": 45, 51 | "Type": "X", 52 | "Reflect": false 53 | }, 54 | { 55 | "Source": { 56 | "Target": "Parameter", 57 | "Id": "shouZ" 58 | }, 59 | "Weight": 60, 60 | "Type": "Angle", 61 | "Reflect": false 62 | }, 63 | { 64 | "Source": { 65 | "Target": "Parameter", 66 | "Id": "ParamBodyAngleZ" 67 | }, 68 | "Weight": 40, 69 | "Type": "Angle", 70 | "Reflect": false 71 | } 72 | ], 73 | "Output": [ 74 | { 75 | "Destination": { 76 | "Target": "Parameter", 77 | "Id": "ParamHairFront" 78 | }, 79 | "VertexIndex": 1, 80 | "Scale": 3, 81 | "Weight": 100, 82 | "Type": "Angle", 83 | "Reflect": false 84 | }, 85 | { 86 | "Destination": { 87 | "Target": "Parameter", 88 | "Id": "qianfashensuo" 89 | }, 90 | "VertexIndex": 1, 91 | "Scale": 2, 92 | "Weight": 100, 93 | "Type": "Angle", 94 | "Reflect": false 95 | } 96 | ], 97 | "Vertices": [ 98 | { 99 | "Position": { 100 | "X": 0, 101 | "Y": 0 102 | }, 103 | "Mobility": 1, 104 | "Delay": 1, 105 | "Acceleration": 1, 106 | "Radius": 0 107 | }, 108 | { 109 | "Position": { 110 | "X": 0, 111 | "Y": 15 112 | }, 113 | "Mobility": 0.95, 114 | "Delay": 0.9, 115 | "Acceleration": 1.5, 116 | "Radius": 15 117 | } 118 | ], 119 | "Normalization": { 120 | "Position": { 121 | "Minimum": -10, 122 | "Default": 0, 123 | "Maximum": 10 124 | }, 125 | "Angle": { 126 | "Minimum": -10, 127 | "Default": 0, 128 | "Maximum": 10 129 | } 130 | } 131 | }, 132 | { 133 | "Id": "PhysicsSetting2", 134 | "Input": [ 135 | { 136 | "Source": { 137 | "Target": "Parameter", 138 | "Id": "ParamAngleX" 139 | }, 140 | "Weight": 50, 141 | "Type": "X", 142 | "Reflect": false 143 | }, 144 | { 145 | "Source": { 146 | "Target": "Parameter", 147 | "Id": "shouZ" 148 | }, 149 | "Weight": 60, 150 | "Type": "Angle", 151 | "Reflect": false 152 | }, 153 | { 154 | "Source": { 155 | "Target": "Parameter", 156 | "Id": "ParamBodyAngleZ" 157 | }, 158 | "Weight": 40, 159 | "Type": "Angle", 160 | "Reflect": false 161 | } 162 | ], 163 | "Output": [ 164 | { 165 | "Destination": { 166 | "Target": "Parameter", 167 | "Id": "zuotueryaobai" 168 | }, 169 | "VertexIndex": 1, 170 | "Scale": 3, 171 | "Weight": 100, 172 | "Type": "Angle", 173 | "Reflect": false 174 | }, 175 | { 176 | "Destination": { 177 | "Target": "Parameter", 178 | "Id": "ztebx" 179 | }, 180 | "VertexIndex": 1, 181 | "Scale": 8, 182 | "Weight": 100, 183 | "Type": "Angle", 184 | "Reflect": false 185 | }, 186 | { 187 | "Destination": { 188 | "Target": "Parameter", 189 | "Id": "youtueryaobai" 190 | }, 191 | "VertexIndex": 1, 192 | "Scale": 3, 193 | "Weight": 100, 194 | "Type": "Angle", 195 | "Reflect": false 196 | }, 197 | { 198 | "Destination": { 199 | "Target": "Parameter", 200 | "Id": "ytebx" 201 | }, 202 | "VertexIndex": 1, 203 | "Scale": 8, 204 | "Weight": 100, 205 | "Type": "Angle", 206 | "Reflect": false 207 | } 208 | ], 209 | "Vertices": [ 210 | { 211 | "Position": { 212 | "X": 0, 213 | "Y": 0 214 | }, 215 | "Mobility": 1, 216 | "Delay": 1, 217 | "Acceleration": 1, 218 | "Radius": 0 219 | }, 220 | { 221 | "Position": { 222 | "X": 0, 223 | "Y": 15 224 | }, 225 | "Mobility": 0.95, 226 | "Delay": 0.9, 227 | "Acceleration": 1.5, 228 | "Radius": 15 229 | } 230 | ], 231 | "Normalization": { 232 | "Position": { 233 | "Minimum": -10, 234 | "Default": 0, 235 | "Maximum": 10 236 | }, 237 | "Angle": { 238 | "Minimum": -10, 239 | "Default": 0, 240 | "Maximum": 10 241 | } 242 | } 243 | }, 244 | { 245 | "Id": "PhysicsSetting3", 246 | "Input": [ 247 | { 248 | "Source": { 249 | "Target": "Parameter", 250 | "Id": "ParamAngleX" 251 | }, 252 | "Weight": 60, 253 | "Type": "X", 254 | "Reflect": false 255 | }, 256 | { 257 | "Source": { 258 | "Target": "Parameter", 259 | "Id": "shouZ" 260 | }, 261 | "Weight": 60, 262 | "Type": "Angle", 263 | "Reflect": false 264 | }, 265 | { 266 | "Source": { 267 | "Target": "Parameter", 268 | "Id": "ParamBodyAngleZ" 269 | }, 270 | "Weight": 40, 271 | "Type": "Angle", 272 | "Reflect": false 273 | } 274 | ], 275 | "Output": [ 276 | { 277 | "Destination": { 278 | "Target": "Parameter", 279 | "Id": "lingdangyaobai" 280 | }, 281 | "VertexIndex": 1, 282 | "Scale": 5, 283 | "Weight": 100, 284 | "Type": "Angle", 285 | "Reflect": false 286 | } 287 | ], 288 | "Vertices": [ 289 | { 290 | "Position": { 291 | "X": 0, 292 | "Y": 0 293 | }, 294 | "Mobility": 1, 295 | "Delay": 1, 296 | "Acceleration": 1, 297 | "Radius": 0 298 | }, 299 | { 300 | "Position": { 301 | "X": 0, 302 | "Y": 5 303 | }, 304 | "Mobility": 0.9, 305 | "Delay": 1.5, 306 | "Acceleration": 1, 307 | "Radius": 5 308 | } 309 | ], 310 | "Normalization": { 311 | "Position": { 312 | "Minimum": -10, 313 | "Default": 0, 314 | "Maximum": 10 315 | }, 316 | "Angle": { 317 | "Minimum": -10, 318 | "Default": 0, 319 | "Maximum": 10 320 | } 321 | } 322 | }, 323 | { 324 | "Id": "PhysicsSetting4", 325 | "Input": [ 326 | { 327 | "Source": { 328 | "Target": "Parameter", 329 | "Id": "ParamAngleX" 330 | }, 331 | "Weight": 60, 332 | "Type": "X", 333 | "Reflect": false 334 | }, 335 | { 336 | "Source": { 337 | "Target": "Parameter", 338 | "Id": "shouZ" 339 | }, 340 | "Weight": 60, 341 | "Type": "Angle", 342 | "Reflect": false 343 | }, 344 | { 345 | "Source": { 346 | "Target": "Parameter", 347 | "Id": "ParamBodyAngleZ" 348 | }, 349 | "Weight": 40, 350 | "Type": "Angle", 351 | "Reflect": false 352 | } 353 | ], 354 | "Output": [ 355 | { 356 | "Destination": { 357 | "Target": "Parameter", 358 | "Id": "ParamHairSide" 359 | }, 360 | "VertexIndex": 1, 361 | "Scale": 10, 362 | "Weight": 100, 363 | "Type": "Angle", 364 | "Reflect": false 365 | }, 366 | { 367 | "Destination": { 368 | "Target": "Parameter", 369 | "Id": "ParamHairBack" 370 | }, 371 | "VertexIndex": 1, 372 | "Scale": 8, 373 | "Weight": 100, 374 | "Type": "Angle", 375 | "Reflect": false 376 | } 377 | ], 378 | "Vertices": [ 379 | { 380 | "Position": { 381 | "X": 0, 382 | "Y": 0 383 | }, 384 | "Mobility": 1, 385 | "Delay": 1, 386 | "Acceleration": 1, 387 | "Radius": 0 388 | }, 389 | { 390 | "Position": { 391 | "X": 0, 392 | "Y": 15 393 | }, 394 | "Mobility": 0.95, 395 | "Delay": 1.5, 396 | "Acceleration": 1.5, 397 | "Radius": 15 398 | } 399 | ], 400 | "Normalization": { 401 | "Position": { 402 | "Minimum": -10, 403 | "Default": 0, 404 | "Maximum": 10 405 | }, 406 | "Angle": { 407 | "Minimum": -10, 408 | "Default": 0, 409 | "Maximum": 10 410 | } 411 | } 412 | }, 413 | { 414 | "Id": "PhysicsSetting6", 415 | "Input": [ 416 | { 417 | "Source": { 418 | "Target": "Parameter", 419 | "Id": "ParamAngleX" 420 | }, 421 | "Weight": 40, 422 | "Type": "X", 423 | "Reflect": false 424 | }, 425 | { 426 | "Source": { 427 | "Target": "Parameter", 428 | "Id": "shouZ" 429 | }, 430 | "Weight": 40, 431 | "Type": "Angle", 432 | "Reflect": false 433 | }, 434 | { 435 | "Source": { 436 | "Target": "Parameter", 437 | "Id": "ParamBodyAngleZ" 438 | }, 439 | "Weight": 40, 440 | "Type": "Angle", 441 | "Reflect": false 442 | } 443 | ], 444 | "Output": [ 445 | { 446 | "Destination": { 447 | "Target": "Parameter", 448 | "Id": "jianzhuanjiaodu" 449 | }, 450 | "VertexIndex": 1, 451 | "Scale": 1, 452 | "Weight": 100, 453 | "Type": "Angle", 454 | "Reflect": true 455 | } 456 | ], 457 | "Vertices": [ 458 | { 459 | "Position": { 460 | "X": 0, 461 | "Y": 0 462 | }, 463 | "Mobility": 1, 464 | "Delay": 1, 465 | "Acceleration": 1, 466 | "Radius": 0 467 | }, 468 | { 469 | "Position": { 470 | "X": 0, 471 | "Y": 15 472 | }, 473 | "Mobility": 0.9, 474 | "Delay": 0.5, 475 | "Acceleration": 1.5, 476 | "Radius": 15 477 | } 478 | ], 479 | "Normalization": { 480 | "Position": { 481 | "Minimum": -10, 482 | "Default": 0, 483 | "Maximum": 10 484 | }, 485 | "Angle": { 486 | "Minimum": -10, 487 | "Default": 0, 488 | "Maximum": 10 489 | } 490 | } 491 | } 492 | ] 493 | } -------------------------------------------------------------------------------- /js/Resources/lafei_4/motions/mission_complete.motion3.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 3, 3 | "Meta": { 4 | "Duration": 3.0, 5 | "Fps": 30.0, 6 | "Loop": false, 7 | "CurveCount": 170, 8 | "TotalSegmentCount": 335, 9 | "TotalPointCount": 377, 10 | "UserDataCount": 1, 11 | "TotalUserDataSize": 0, 12 | "FadeInTime": -1.0, 13 | "FadeOutTime": -1.0 14 | }, 15 | "Curves": [ 16 | { 17 | "Target": "Parameter", 18 | "Id": "zhuweibabianxing", 19 | "Segments": [ 20 | 0.0, 21 | 0.0, 22 | 0.0, 23 | 1.567, 24 | -1.0, 25 | 0.0, 26 | 3.0, 27 | 0.0 28 | ], 29 | "FadeInTime": -1.0, 30 | "FadeOutTime": -1.0 31 | }, 32 | { 33 | "Target": "Parameter", 34 | "Id": "zhupigushangxia", 35 | "Segments": [ 36 | 0.0, 37 | 0.0, 38 | 0.0, 39 | 0.733, 40 | 1.0, 41 | 1.0, 42 | 0.989, 43 | 1.0, 44 | 1.244, 45 | 0.681, 46 | 1.5, 47 | 0.0, 48 | 1.0, 49 | 1.744, 50 | -0.652, 51 | 1.989, 52 | -1.0, 53 | 2.233, 54 | -1.0, 55 | 0.0, 56 | 3.0, 57 | 0.0 58 | ], 59 | "FadeInTime": -1.0, 60 | "FadeOutTime": -1.0 61 | }, 62 | { 63 | "Target": "Parameter", 64 | "Id": "zhupiguzuoyou", 65 | "Segments": [ 66 | 0.0, 67 | -1.0, 68 | 1.0, 69 | 0.244, 70 | -1.0, 71 | 0.489, 72 | -0.652, 73 | 0.733, 74 | 0.0, 75 | 1.0, 76 | 0.989, 77 | 0.681, 78 | 1.244, 79 | 1.0, 80 | 1.5, 81 | 1.0, 82 | 1.0, 83 | 1.744, 84 | 1.0, 85 | 1.989, 86 | 0.652, 87 | 2.233, 88 | 0.0, 89 | 1.0, 90 | 2.489, 91 | -0.681, 92 | 2.744, 93 | -1.0, 94 | 3.0, 95 | -1.0 96 | ], 97 | "FadeInTime": -1.0, 98 | "FadeOutTime": -1.0 99 | }, 100 | { 101 | "Target": "Parameter", 102 | "Id": "shubianhua", 103 | "Segments": [ 104 | 0.0, 105 | 0.0, 106 | 0.0, 107 | 1.0, 108 | 5.0, 109 | 0.0, 110 | 3.0, 111 | 0.0 112 | ], 113 | "FadeInTime": -1.0, 114 | "FadeOutTime": -1.0 115 | }, 116 | { 117 | "Target": "Parameter", 118 | "Id": "shumujiaodu", 119 | "Segments": [ 120 | 0.0, 121 | 0.0, 122 | 0.0, 123 | 0.367, 124 | 0.1, 125 | 0.0, 126 | 1.433, 127 | -0.076, 128 | 0.0, 129 | 3.0, 130 | 0.0 131 | ], 132 | "FadeInTime": -1.0, 133 | "FadeOutTime": -1.0 134 | }, 135 | { 136 | "Target": "Parameter", 137 | "Id": "sz1dyb", 138 | "Segments": [ 139 | 0.0, 140 | 0.0, 141 | 0.0, 142 | 1.733, 143 | 0.707, 144 | 0.0, 145 | 3.0, 146 | 0.0 147 | ], 148 | "FadeInTime": -1.0, 149 | "FadeOutTime": -1.0 150 | }, 151 | { 152 | "Target": "Parameter", 153 | "Id": "sz2dyb", 154 | "Segments": [ 155 | 0.0, 156 | 0.0, 157 | 0.0, 158 | 1.3, 159 | -0.6, 160 | 0.0, 161 | 3.0, 162 | 0.0 163 | ], 164 | "FadeInTime": -1.0, 165 | "FadeOutTime": -1.0 166 | }, 167 | { 168 | "Target": "Parameter", 169 | "Id": "sz3dyb", 170 | "Segments": [ 171 | 0.0, 172 | 0.0, 173 | 0.0, 174 | 2.033, 175 | -0.5, 176 | 0.0, 177 | 3.0, 178 | 0.0 179 | ], 180 | "FadeInTime": -1.0, 181 | "FadeOutTime": -1.0 182 | }, 183 | { 184 | "Target": "Parameter", 185 | "Id": "ParamEyeLOpen", 186 | "Segments": [ 187 | 0.0, 188 | 1.0, 189 | 2.0, 190 | 0.167, 191 | 1.0, 192 | 0.0, 193 | 0.433, 194 | 0.0, 195 | 1.0, 196 | 0.566, 197 | 0.0, 198 | 0.7, 199 | 0.674, 200 | 0.833, 201 | 0.7, 202 | 1.0, 203 | 1.278, 204 | 0.786, 205 | 1.722, 206 | 0.8, 207 | 2.167, 208 | 0.8, 209 | 0.0, 210 | 2.4, 211 | 0.0, 212 | 0.0, 213 | 3.0, 214 | 1.0 215 | ], 216 | "FadeInTime": -1.0, 217 | "FadeOutTime": -1.0 218 | }, 219 | { 220 | "Target": "Parameter", 221 | "Id": "ParamEyeROpen", 222 | "Segments": [ 223 | 0.0, 224 | 1.0, 225 | 2.0, 226 | 0.167, 227 | 1.0, 228 | 0.0, 229 | 0.433, 230 | 0.0, 231 | 1.0, 232 | 0.566, 233 | 0.0, 234 | 0.7, 235 | 0.674, 236 | 0.833, 237 | 0.7, 238 | 1.0, 239 | 1.278, 240 | 0.786, 241 | 1.722, 242 | 0.8, 243 | 2.167, 244 | 0.8, 245 | 0.0, 246 | 2.4, 247 | 0.0, 248 | 0.0, 249 | 3.0, 250 | 1.0 251 | ], 252 | "FadeInTime": -1.0, 253 | "FadeOutTime": -1.0 254 | }, 255 | { 256 | "Target": "Parameter", 257 | "Id": "gaoguangdonghua", 258 | "Segments": [ 259 | 0.0, 260 | 0.0, 261 | 2.0, 262 | 0.4, 263 | 0.0, 264 | 0.0, 265 | 0.633, 266 | 1.0, 267 | 0.0, 268 | 0.833, 269 | 0.0, 270 | 0.0, 271 | 1.067, 272 | 0.795, 273 | 0.0, 274 | 1.3, 275 | 0.0, 276 | 2.0, 277 | 3.0, 278 | 0.0 279 | ], 280 | "FadeInTime": -1.0, 281 | "FadeOutTime": -1.0 282 | }, 283 | { 284 | "Target": "Parameter", 285 | "Id": "tongkongdaxiao", 286 | "Segments": [ 287 | 0.0, 288 | 0.0, 289 | 0.0, 290 | 0.433, 291 | 1.0, 292 | 0.0, 293 | 0.833, 294 | -1.0, 295 | 0.0, 296 | 1.067, 297 | 0.4, 298 | 0.0, 299 | 1.267, 300 | 0.0, 301 | 2.0, 302 | 2.167, 303 | 0.0, 304 | 0.0, 305 | 2.4, 306 | 1.0, 307 | 0.0, 308 | 3.0, 309 | 0.0 310 | ], 311 | "FadeInTime": -1.0, 312 | "FadeOutTime": -1.0 313 | }, 314 | { 315 | "Target": "Parameter", 316 | "Id": "ParamBrowLY", 317 | "Segments": [ 318 | 0.0, 319 | 0.0, 320 | 0.0, 321 | 0.433, 322 | -1.0, 323 | 0.0, 324 | 0.833, 325 | -0.3, 326 | 1.0, 327 | 1.278, 328 | -0.3, 329 | 1.722, 330 | -0.345, 331 | 2.167, 332 | -0.5, 333 | 1.0, 334 | 2.245, 335 | -0.527, 336 | 2.322, 337 | -1.0, 338 | 2.4, 339 | -1.0, 340 | 0.0, 341 | 3.0, 342 | 0.0 343 | ], 344 | "FadeInTime": -1.0, 345 | "FadeOutTime": -1.0 346 | }, 347 | { 348 | "Target": "Parameter", 349 | "Id": "ParamBrowRY", 350 | "Segments": [ 351 | 0.0, 352 | 0.0, 353 | 0.0, 354 | 0.433, 355 | -1.0, 356 | 0.0, 357 | 0.833, 358 | -0.3, 359 | 1.0, 360 | 1.278, 361 | -0.3, 362 | 1.722, 363 | -0.345, 364 | 2.167, 365 | -0.5, 366 | 1.0, 367 | 2.245, 368 | -0.527, 369 | 2.322, 370 | -1.0, 371 | 2.4, 372 | -1.0, 373 | 0.0, 374 | 3.0, 375 | 0.0 376 | ], 377 | "FadeInTime": -1.0, 378 | "FadeOutTime": -1.0 379 | }, 380 | { 381 | "Target": "Parameter", 382 | "Id": "ParamBrowLAngle", 383 | "Segments": [ 384 | 0.0, 385 | 0.0, 386 | 0.0, 387 | 1.167, 388 | 0.2, 389 | 0.0, 390 | 3.0, 391 | 0.0 392 | ], 393 | "FadeInTime": -1.0, 394 | "FadeOutTime": -1.0 395 | }, 396 | { 397 | "Target": "Parameter", 398 | "Id": "ParamBrowRAngle", 399 | "Segments": [ 400 | 0.0, 401 | 0.0, 402 | 0.0, 403 | 1.167, 404 | 0.3, 405 | 0.0, 406 | 3.0, 407 | 0.0 408 | ], 409 | "FadeInTime": -1.0, 410 | "FadeOutTime": -1.0 411 | }, 412 | { 413 | "Target": "Parameter", 414 | "Id": "ParamBrowLForm", 415 | "Segments": [ 416 | 0.0, 417 | 0.0, 418 | 0.0, 419 | 1.167, 420 | -0.3, 421 | 0.0, 422 | 3.0, 423 | 0.0 424 | ], 425 | "FadeInTime": -1.0, 426 | "FadeOutTime": -1.0 427 | }, 428 | { 429 | "Target": "Parameter", 430 | "Id": "ParamBrowRForm", 431 | "Segments": [ 432 | 0.0, 433 | 0.0, 434 | 0.0, 435 | 1.167, 436 | -0.2, 437 | 0.0, 438 | 3.0, 439 | 0.0 440 | ], 441 | "FadeInTime": -1.0, 442 | "FadeOutTime": -1.0 443 | }, 444 | { 445 | "Target": "Parameter", 446 | "Id": "ParamEyeBallX", 447 | "Segments": [ 448 | 0.0, 449 | 0.0, 450 | 0.0, 451 | 0.133, 452 | -1.0, 453 | 2.0, 454 | 0.2, 455 | -1.0, 456 | 0.0, 457 | 0.733, 458 | 0.7, 459 | 2.0, 460 | 0.8, 461 | 0.7, 462 | 0.0, 463 | 2.167, 464 | 1.0, 465 | 0.0, 466 | 3.0, 467 | 0.0 468 | ], 469 | "FadeInTime": -1.0, 470 | "FadeOutTime": -1.0 471 | }, 472 | { 473 | "Target": "Parameter", 474 | "Id": "ParamEyeBallY", 475 | "Segments": [ 476 | 0.0, 477 | 0.0, 478 | 2.0, 479 | 0.133, 480 | 0.0, 481 | 0.0, 482 | 0.2, 483 | -1.0, 484 | 2.0, 485 | 0.733, 486 | -1.0, 487 | 0.0, 488 | 0.8, 489 | -0.6, 490 | 0.0, 491 | 2.167, 492 | -1.0, 493 | 0.0, 494 | 3.0, 495 | 0.0 496 | ], 497 | "FadeInTime": -1.0, 498 | "FadeOutTime": -1.0 499 | }, 500 | { 501 | "Target": "Parameter", 502 | "Id": "liuhaigaoguang", 503 | "Segments": [ 504 | 0.0, 505 | 0.0, 506 | 0.0, 507 | 0.533, 508 | -0.487, 509 | 0.0, 510 | 1.367, 511 | 0.692, 512 | 0.0, 513 | 2.467, 514 | -0.487, 515 | 0.0, 516 | 3.0, 517 | 0.0 518 | ], 519 | "FadeInTime": -1.0, 520 | "FadeOutTime": -1.0 521 | }, 522 | { 523 | "Target": "Parameter", 524 | "Id": "ParamMouthForm", 525 | "Segments": [ 526 | 0.0, 527 | 0.0, 528 | 0.0, 529 | 1.2, 530 | -0.4, 531 | 0.0, 532 | 2.133, 533 | 0.0, 534 | 2.0, 535 | 3.0, 536 | 0.0 537 | ], 538 | "FadeInTime": -1.0, 539 | "FadeOutTime": -1.0 540 | }, 541 | { 542 | "Target": "Parameter", 543 | "Id": "zuoxiaotuixuanzhuan", 544 | "Segments": [ 545 | 0.0, 546 | 0.0, 547 | 0.0, 548 | 0.6, 549 | -0.1, 550 | 0.0, 551 | 1.433, 552 | 0.1, 553 | 0.0, 554 | 3.0, 555 | 0.0 556 | ], 557 | "FadeInTime": -1.0, 558 | "FadeOutTime": -1.0 559 | }, 560 | { 561 | "Target": "Parameter", 562 | "Id": "zuojiaoxuanzhuan", 563 | "Segments": [ 564 | 0.0, 565 | 0.0, 566 | 0.0, 567 | 0.433, 568 | 0.4, 569 | 0.0, 570 | 0.933, 571 | -0.5, 572 | 0.0, 573 | 1.767, 574 | 0.2, 575 | 0.0, 576 | 3.0, 577 | 0.0 578 | ], 579 | "FadeInTime": -1.0, 580 | "FadeOutTime": -1.0 581 | }, 582 | { 583 | "Target": "Parameter", 584 | "Id": "youxiaotuixuanzhuan", 585 | "Segments": [ 586 | 0.0, 587 | 0.0, 588 | 0.0, 589 | 0.633, 590 | 0.4, 591 | 0.0, 592 | 1.567, 593 | -0.074, 594 | 0.0, 595 | 3.0, 596 | 0.0 597 | ], 598 | "FadeInTime": -1.0, 599 | "FadeOutTime": -1.0 600 | }, 601 | { 602 | "Target": "Parameter", 603 | "Id": "youjiaoxuanzhuan", 604 | "Segments": [ 605 | 0.0, 606 | 0.0, 607 | 0.0, 608 | 0.4, 609 | -0.7, 610 | 0.0, 611 | 0.967, 612 | 0.4, 613 | 0.0, 614 | 1.767, 615 | -0.4, 616 | 0.0, 617 | 3.0, 618 | 0.0 619 | ], 620 | "FadeInTime": -1.0, 621 | "FadeOutTime": -1.0 622 | }, 623 | { 624 | "Target": "Parameter", 625 | "Id": "zuobixuanzhuan", 626 | "Segments": [ 627 | 0.0, 628 | 0.0, 629 | 0.0, 630 | 0.9, 631 | -0.026, 632 | 0.0, 633 | 2.3, 634 | 0.021, 635 | 0.0, 636 | 3.0, 637 | 0.0 638 | ], 639 | "FadeInTime": -1.0, 640 | "FadeOutTime": -1.0 641 | }, 642 | { 643 | "Target": "Parameter", 644 | "Id": "zuoxiabixuanzhuan", 645 | "Segments": [ 646 | 0.0, 647 | 0.0, 648 | 0.0, 649 | 0.733, 650 | -0.036, 651 | 2.0, 652 | 2.2, 653 | -0.036, 654 | 0.0, 655 | 3.0, 656 | 0.0 657 | ], 658 | "FadeInTime": -1.0, 659 | "FadeOutTime": -1.0 660 | }, 661 | { 662 | "Target": "Parameter", 663 | "Id": "zuozishousuo", 664 | "Segments": [ 665 | 0.0, 666 | 0.0, 667 | 0.0, 668 | 0.3, 669 | 1.0, 670 | 2.0, 671 | 0.733, 672 | 1.0, 673 | 2.0, 674 | 2.5, 675 | 1.0, 676 | 0.0, 677 | 3.0, 678 | 0.0 679 | ], 680 | "FadeInTime": -1.0, 681 | "FadeOutTime": -1.0 682 | }, 683 | { 684 | "Target": "Parameter", 685 | "Id": "zuoshoufanzhuan", 686 | "Segments": [ 687 | 0.0, 688 | 0.0, 689 | 2.0, 690 | 0.3, 691 | 0.0, 692 | 1.0, 693 | 0.444, 694 | 0.579, 695 | 0.589, 696 | 1.0, 697 | 0.733, 698 | 1.0, 699 | 2.0, 700 | 2.2, 701 | 1.0, 702 | 0.0, 703 | 2.5, 704 | 0.0, 705 | 2.0, 706 | 3.0, 707 | 0.0 708 | ], 709 | "FadeInTime": -1.0, 710 | "FadeOutTime": -1.0 711 | }, 712 | { 713 | "Target": "Parameter", 714 | "Id": "youbixuanzhuan", 715 | "Segments": [ 716 | 0.0, 717 | 0.0, 718 | 0.0, 719 | 0.733, 720 | -0.5, 721 | 1.0, 722 | 1.222, 723 | -0.5, 724 | 1.711, 725 | -0.414, 726 | 2.2, 727 | -0.2, 728 | 1.0, 729 | 2.467, 730 | -0.083, 731 | 2.733, 732 | 0.0, 733 | 3.0, 734 | 0.0 735 | ], 736 | "FadeInTime": -1.0, 737 | "FadeOutTime": -1.0 738 | }, 739 | { 740 | "Target": "Parameter", 741 | "Id": "youxiabixuanzhuan", 742 | "Segments": [ 743 | 0.0, 744 | 0.0, 745 | 0.0, 746 | 0.733, 747 | 0.9, 748 | 2.0, 749 | 2.2, 750 | 0.9, 751 | 0.0, 752 | 3.0, 753 | 0.0 754 | ], 755 | "FadeInTime": -1.0, 756 | "FadeOutTime": -1.0 757 | }, 758 | { 759 | "Target": "Parameter", 760 | "Id": "youxiabishensuo", 761 | "Segments": [ 762 | 0.0, 763 | 0.0, 764 | 0.0, 765 | 0.3, 766 | -1.0, 767 | 0.0, 768 | 0.9, 769 | 0.0, 770 | 0.0, 771 | 1.367, 772 | -0.446, 773 | 0.0, 774 | 2.2, 775 | -0.377, 776 | 0.0, 777 | 2.667, 778 | -1.0, 779 | 0.0, 780 | 3.0, 781 | 0.0 782 | ], 783 | "FadeInTime": -1.0, 784 | "FadeOutTime": -1.0 785 | }, 786 | { 787 | "Target": "Parameter", 788 | "Id": "youshouxuanzhuan", 789 | "Segments": [ 790 | 0.0, 791 | 0.0, 792 | 0.0, 793 | 0.333, 794 | 1.0, 795 | 0.0, 796 | 0.733, 797 | 0.4, 798 | 2.0, 799 | 2.2, 800 | 0.4, 801 | 0.0, 802 | 3.0, 803 | 0.0 804 | ], 805 | "FadeInTime": -1.0, 806 | "FadeOutTime": -1.0 807 | }, 808 | { 809 | "Target": "Parameter", 810 | "Id": "youshoufanzhuan", 811 | "Segments": [ 812 | 0.0, 813 | 0.0, 814 | 1.0, 815 | 0.278, 816 | 0.0, 817 | 0.555, 818 | 0.437, 819 | 0.833, 820 | 1.0, 821 | 1.0, 822 | 1.111, 823 | 1.563, 824 | 1.389, 825 | 1.73, 826 | 1.667, 827 | 1.73, 828 | 2.0, 829 | 2.167, 830 | 1.73, 831 | 0.0, 832 | 3.0, 833 | 0.0 834 | ], 835 | "FadeInTime": -1.0, 836 | "FadeOutTime": -1.0 837 | }, 838 | { 839 | "Target": "Parameter", 840 | "Id": "paotaijiaodu", 841 | "Segments": [ 842 | 0.0, 843 | 0.0, 844 | 0.0, 845 | 0.6, 846 | -0.4, 847 | 0.0, 848 | 1.867, 849 | 0.3, 850 | 0.0, 851 | 3.0, 852 | 0.0 853 | ], 854 | "FadeInTime": -1.0, 855 | "FadeOutTime": -1.0 856 | }, 857 | { 858 | "Target": "Parameter", 859 | "Id": "paoguangxuanzhuang", 860 | "Segments": [ 861 | 0.0, 862 | 0.0, 863 | 0.0, 864 | 0.533, 865 | -0.255, 866 | 0.0, 867 | 1.4, 868 | 0.336, 869 | 2.0, 870 | 2.3, 871 | 0.336, 872 | 0.0, 873 | 3.0, 874 | 0.0 875 | ], 876 | "FadeInTime": -1.0, 877 | "FadeOutTime": -1.0 878 | }, 879 | { 880 | "Target": "Parameter", 881 | "Id": "paotaixuanzhuang", 882 | "Segments": [ 883 | 0.0, 884 | 0.0, 885 | 0.0, 886 | 1.333, 887 | -0.5, 888 | 0.0, 889 | 3.0, 890 | 0.0 891 | ], 892 | "FadeInTime": -1.0, 893 | "FadeOutTime": -1.0 894 | }, 895 | { 896 | "Target": "Parameter", 897 | "Id": "yuleijiaodu1", 898 | "Segments": [ 899 | 0.0, 900 | 0.0, 901 | 0.0, 902 | 1.0, 903 | -0.3, 904 | 0.0, 905 | 3.0, 906 | 0.0 907 | ], 908 | "FadeInTime": -1.0, 909 | "FadeOutTime": -1.0 910 | }, 911 | { 912 | "Target": "Parameter", 913 | "Id": "yuleijiaodu2", 914 | "Segments": [ 915 | 0.0, 916 | 0.0, 917 | 0.0, 918 | 1.133, 919 | -0.3, 920 | 0.0, 921 | 3.0, 922 | 0.0 923 | ], 924 | "FadeInTime": -1.0, 925 | "FadeOutTime": -1.0 926 | }, 927 | { 928 | "Target": "Parameter", 929 | "Id": "yuleijiaodu3", 930 | "Segments": [ 931 | 0.0, 932 | 0.0, 933 | 0.0, 934 | 1.267, 935 | -0.3, 936 | 0.0, 937 | 3.0, 938 | 0.0 939 | ], 940 | "FadeInTime": -1.0, 941 | "FadeOutTime": -1.0 942 | }, 943 | { 944 | "Target": "Parameter", 945 | "Id": "yuleijiaodu4", 946 | "Segments": [ 947 | 0.0, 948 | 0.0, 949 | 0.0, 950 | 1.4, 951 | -0.3, 952 | 0.0, 953 | 3.0, 954 | 0.0 955 | ], 956 | "FadeInTime": -1.0, 957 | "FadeOutTime": -1.0 958 | }, 959 | { 960 | "Target": "Parameter", 961 | "Id": "yuleijiaodu5", 962 | "Segments": [ 963 | 0.0, 964 | 0.0, 965 | 0.0, 966 | 1.533, 967 | -0.3, 968 | 0.0, 969 | 3.0, 970 | 0.0 971 | ], 972 | "FadeInTime": -1.0, 973 | "FadeOutTime": -1.0 974 | }, 975 | { 976 | "Target": "Parameter", 977 | "Id": "shoudongwuli", 978 | "Segments": [ 979 | 0.0, 980 | 0.0, 981 | 0.0, 982 | 0.5, 983 | 1.0, 984 | 2.0, 985 | 2.333, 986 | 1.0, 987 | 0.0, 988 | 3.0, 989 | 0.0 990 | ], 991 | "FadeInTime": -1.0, 992 | "FadeOutTime": -1.0 993 | }, 994 | { 995 | "Target": "Parameter", 996 | "Id": "mwzy", 997 | "Segments": [ 998 | 0.0, 999 | 0.0, 1000 | 2.0, 1001 | 0.467, 1002 | 0.0, 1003 | 0.0, 1004 | 1.533, 1005 | 1.0, 1006 | 0.0, 1007 | 2.467, 1008 | 0.0, 1009 | 2.0, 1010 | 3.0, 1011 | 0.0 1012 | ], 1013 | "FadeInTime": -1.0, 1014 | "FadeOutTime": -1.0 1015 | }, 1016 | { 1017 | "Target": "Parameter", 1018 | "Id": "mwbx", 1019 | "Segments": [ 1020 | 0.0, 1021 | 0.0, 1022 | 0.0, 1023 | 0.933, 1024 | -1.0, 1025 | 0.0, 1026 | 2.0, 1027 | 1.0, 1028 | 0.0, 1029 | 3.0, 1030 | 0.0 1031 | ], 1032 | "FadeInTime": -1.0, 1033 | "FadeOutTime": -1.0 1034 | }, 1035 | { 1036 | "Target": "Parameter", 1037 | "Id": "youtuoxietuer", 1038 | "Segments": [ 1039 | 0.0, 1040 | 0.0, 1041 | 0.0, 1042 | 0.867, 1043 | 0.472, 1044 | 0.0, 1045 | 1.633, 1046 | -0.528, 1047 | 0.0, 1048 | 2.467, 1049 | 0.472, 1050 | 0.0, 1051 | 3.0, 1052 | 0.0 1053 | ], 1054 | "FadeInTime": -1.0, 1055 | "FadeOutTime": -1.0 1056 | }, 1057 | { 1058 | "Target": "Parameter", 1059 | "Id": "zuotuoxietuer", 1060 | "Segments": [ 1061 | 0.0, 1062 | 0.0, 1063 | 0.0, 1064 | 0.867, 1065 | 0.472, 1066 | 0.0, 1067 | 1.633, 1068 | -0.728, 1069 | 0.0, 1070 | 2.467, 1071 | 0.572, 1072 | 0.0, 1073 | 3.0, 1074 | 0.0 1075 | ], 1076 | "FadeInTime": -1.0, 1077 | "FadeOutTime": -1.0 1078 | }, 1079 | { 1080 | "Target": "Parameter", 1081 | "Id": "sdztryb", 1082 | "Segments": [ 1083 | 0.0, 1084 | 0.0, 1085 | 0.0, 1086 | 0.533, 1087 | 1.0, 1088 | 0.0, 1089 | 1.5, 1090 | -1.0, 1091 | 0.0, 1092 | 2.4, 1093 | 1.0, 1094 | 0.0, 1095 | 3.0, 1096 | 0.0 1097 | ], 1098 | "FadeInTime": -1.0, 1099 | "FadeOutTime": -1.0 1100 | }, 1101 | { 1102 | "Target": "Parameter", 1103 | "Id": "sdzebx", 1104 | "Segments": [ 1105 | 0.0, 1106 | 0.0, 1107 | 0.0, 1108 | 0.3, 1109 | -0.404, 1110 | 0.0, 1111 | 0.833, 1112 | 0.451, 1113 | 0.0, 1114 | 1.9, 1115 | -0.404, 1116 | 0.0, 1117 | 2.633, 1118 | 0.4, 1119 | 0.0, 1120 | 3.0, 1121 | 0.0 1122 | ], 1123 | "FadeInTime": -1.0, 1124 | "FadeOutTime": -1.0 1125 | }, 1126 | { 1127 | "Target": "Parameter", 1128 | "Id": "sdyeyb", 1129 | "Segments": [ 1130 | 0.0, 1131 | 0.0, 1132 | 0.0, 1133 | 0.533, 1134 | 1.0, 1135 | 0.0, 1136 | 1.5, 1137 | -1.0, 1138 | 0.0, 1139 | 2.4, 1140 | 1.0, 1141 | 0.0, 1142 | 3.0, 1143 | 0.0 1144 | ], 1145 | "FadeInTime": -1.0, 1146 | "FadeOutTime": -1.0 1147 | }, 1148 | { 1149 | "Target": "Parameter", 1150 | "Id": "sdyebx", 1151 | "Segments": [ 1152 | 0.0, 1153 | 0.0, 1154 | 0.0, 1155 | 0.3, 1156 | -0.404, 1157 | 0.0, 1158 | 0.833, 1159 | 0.451, 1160 | 0.0, 1161 | 1.9, 1162 | -0.404, 1163 | 0.0, 1164 | 2.633, 1165 | 0.4, 1166 | 0.0, 1167 | 3.0, 1168 | 0.0 1169 | ], 1170 | "FadeInTime": -1.0, 1171 | "FadeOutTime": -1.0 1172 | }, 1173 | { 1174 | "Target": "Parameter", 1175 | "Id": "sdjzjd", 1176 | "Segments": [ 1177 | 0.0, 1178 | 0.0, 1179 | 0.0, 1180 | 0.367, 1181 | -0.157, 1182 | 0.0, 1183 | 1.8, 1184 | 0.253, 1185 | 0.0, 1186 | 3.0, 1187 | 0.0 1188 | ], 1189 | "FadeInTime": -1.0, 1190 | "FadeOutTime": -1.0 1191 | }, 1192 | { 1193 | "Target": "Parameter", 1194 | "Id": "zuoshuxiujiaodu", 1195 | "Segments": [ 1196 | 0.0, 1197 | 0.0, 1198 | 0.0, 1199 | 1.267, 1200 | -0.589, 1201 | 0.0, 1202 | 2.6, 1203 | 0.564, 1204 | 0.0, 1205 | 3.0, 1206 | 0.0 1207 | ], 1208 | "FadeInTime": -1.0, 1209 | "FadeOutTime": -1.0 1210 | }, 1211 | { 1212 | "Target": "Parameter", 1213 | "Id": "zuoshuxiuyaobai", 1214 | "Segments": [ 1215 | 0.0, 1216 | 0.0, 1217 | 0.0, 1218 | 0.7, 1219 | 0.484, 1220 | 0.0, 1221 | 2.0, 1222 | -0.541, 1223 | 0.0, 1224 | 3.0, 1225 | 0.0 1226 | ], 1227 | "FadeInTime": -1.0, 1228 | "FadeOutTime": -1.0 1229 | }, 1230 | { 1231 | "Target": "Parameter", 1232 | "Id": "youshuxiujiaodu", 1233 | "Segments": [ 1234 | 0.0, 1235 | 0.0, 1236 | 0.0, 1237 | 1.167, 1238 | -0.622, 1239 | 0.0, 1240 | 2.5, 1241 | 0.671, 1242 | 0.0, 1243 | 3.0, 1244 | 0.0 1245 | ], 1246 | "FadeInTime": -1.0, 1247 | "FadeOutTime": -1.0 1248 | }, 1249 | { 1250 | "Target": "Parameter", 1251 | "Id": "youshuxiudaiyaobai", 1252 | "Segments": [ 1253 | 0.0, 1254 | 0.0, 1255 | 0.0, 1256 | 0.6, 1257 | 0.698, 1258 | 0.0, 1259 | 1.8, 1260 | -0.606, 1261 | 0.0, 1262 | 3.0, 1263 | 0.0 1264 | ], 1265 | "FadeInTime": -1.0, 1266 | "FadeOutTime": -1.0 1267 | }, 1268 | { 1269 | "Target": "Parameter", 1270 | "Id": "zldbx", 1271 | "Segments": [ 1272 | 0.0, 1273 | 0.0, 1274 | 0.0, 1275 | 1.0, 1276 | -0.5, 1277 | 0.0, 1278 | 3.0, 1279 | 0.0 1280 | ], 1281 | "FadeInTime": -1.0, 1282 | "FadeOutTime": -1.0 1283 | }, 1284 | { 1285 | "Target": "Parameter", 1286 | "Id": "yldbx", 1287 | "Segments": [ 1288 | 0.0, 1289 | 0.0, 1290 | 0.0, 1291 | 0.5, 1292 | -0.5, 1293 | 0.0, 1294 | 2.467, 1295 | 0.5, 1296 | 0.0, 1297 | 3.0, 1298 | 0.0 1299 | ], 1300 | "FadeInTime": -1.0, 1301 | "FadeOutTime": -1.0 1302 | }, 1303 | { 1304 | "Target": "Parameter", 1305 | "Id": "youopdaibianxing", 1306 | "Segments": [ 1307 | 0.0, 1308 | 0.0, 1309 | 0.0, 1310 | 0.967, 1311 | 1.0, 1312 | 0.0, 1313 | 2.233, 1314 | -1.0, 1315 | 0.0, 1316 | 3.0, 1317 | 0.0 1318 | ], 1319 | "FadeInTime": -1.0, 1320 | "FadeOutTime": -1.0 1321 | }, 1322 | { 1323 | "Target": "Parameter", 1324 | "Id": "zxdyb", 1325 | "Segments": [ 1326 | 0.0, 1327 | 0.0, 1328 | 0.0, 1329 | 1.233, 1330 | -1.0, 1331 | 0.0, 1332 | 3.0, 1333 | 0.0 1334 | ], 1335 | "FadeInTime": -1.0, 1336 | "FadeOutTime": -1.0 1337 | }, 1338 | { 1339 | "Target": "Parameter", 1340 | "Id": "youxiongdaijiaodu", 1341 | "Segments": [ 1342 | 0.0, 1343 | 0.0, 1344 | 0.0, 1345 | 0.933, 1346 | -1.0, 1347 | 0.0, 1348 | 2.033, 1349 | 1.0, 1350 | 0.0, 1351 | 3.0, 1352 | 0.0 1353 | ], 1354 | "FadeInTime": -1.0, 1355 | "FadeOutTime": -1.0 1356 | }, 1357 | { 1358 | "Target": "Parameter", 1359 | "Id": "yxdyb", 1360 | "Segments": [ 1361 | 0.0, 1362 | 0.0, 1363 | 0.0, 1364 | 0.467, 1365 | 0.7, 1366 | 0.0, 1367 | 1.467, 1368 | -0.6, 1369 | 0.0, 1370 | 2.567, 1371 | 0.5, 1372 | 0.0, 1373 | 3.0, 1374 | 0.0 1375 | ], 1376 | "FadeInTime": -1.0, 1377 | "FadeOutTime": -1.0 1378 | }, 1379 | { 1380 | "Target": "Parameter", 1381 | "Id": "ParamAngleY", 1382 | "Segments": [ 1383 | 0.0, 1384 | 0.0, 1385 | 0.0, 1386 | 0.567, 1387 | 19.056, 1388 | 0.0, 1389 | 1.633, 1390 | -30.0, 1391 | 0.0, 1392 | 3.0, 1393 | 0.0 1394 | ], 1395 | "FadeInTime": -1.0, 1396 | "FadeOutTime": -1.0 1397 | }, 1398 | { 1399 | "Target": "Parameter", 1400 | "Id": "ParamBodyAngleXX", 1401 | "Segments": [ 1402 | 0.0, 1403 | 0.0, 1404 | 0.0, 1405 | 0.667, 1406 | -0.3, 1407 | 1.0, 1408 | 1.122, 1409 | -0.3, 1410 | 1.578, 1411 | -0.291, 1412 | 2.033, 1413 | -0.2, 1414 | 1.0, 1415 | 2.355, 1416 | -0.136, 1417 | 2.678, 1418 | 0.0, 1419 | 3.0, 1420 | 0.0 1421 | ], 1422 | "FadeInTime": -1.0, 1423 | "FadeOutTime": -1.0 1424 | }, 1425 | { 1426 | "Target": "Parameter", 1427 | "Id": "ParamBreath", 1428 | "Segments": [ 1429 | 0.0, 1430 | 0.0, 1431 | 0.0, 1432 | 1.0, 1433 | 1.0, 1434 | 0.0, 1435 | 3.0, 1436 | 0.0 1437 | ], 1438 | "FadeInTime": -1.0, 1439 | "FadeOutTime": -1.0 1440 | }, 1441 | { 1442 | "Target": "Parameter", 1443 | "Id": "yifuzuoyou", 1444 | "Segments": [ 1445 | 0.0, 1446 | 0.0, 1447 | 0.0, 1448 | 1.3, 1449 | 1.0, 1450 | 0.0, 1451 | 3.0, 1452 | 0.0 1453 | ], 1454 | "FadeInTime": -1.0, 1455 | "FadeOutTime": -1.0 1456 | }, 1457 | { 1458 | "Target": "Parameter", 1459 | "Id": "yifubianxing", 1460 | "Segments": [ 1461 | 0.0, 1462 | 0.0, 1463 | 0.0, 1464 | 0.667, 1465 | -30.0, 1466 | 0.0, 1467 | 2.067, 1468 | 30.0, 1469 | 0.0, 1470 | 3.0, 1471 | 0.0 1472 | ], 1473 | "FadeInTime": -1.0, 1474 | "FadeOutTime": -1.0 1475 | }, 1476 | { 1477 | "Target": "Parameter", 1478 | "Id": "baozhaguodu", 1479 | "Segments": [ 1480 | 0.0, 1481 | 0.0, 1482 | 0.0, 1483 | 3.0, 1484 | 0.0 1485 | ], 1486 | "FadeInTime": -1.0, 1487 | "FadeOutTime": -1.0 1488 | }, 1489 | { 1490 | "Target": "Parameter", 1491 | "Id": "baimaotmd", 1492 | "Segments": [ 1493 | 0.0, 1494 | 0.0, 1495 | 0.0, 1496 | 3.0, 1497 | 0.0 1498 | ], 1499 | "FadeInTime": -1.0, 1500 | "FadeOutTime": -1.0 1501 | }, 1502 | { 1503 | "Target": "Parameter", 1504 | "Id": "baimaoshensuo", 1505 | "Segments": [ 1506 | 0.0, 1507 | 0.0, 1508 | 0.0, 1509 | 3.0, 1510 | 0.0 1511 | ], 1512 | "FadeInTime": -1.0, 1513 | "FadeOutTime": -1.0 1514 | }, 1515 | { 1516 | "Target": "Parameter", 1517 | "Id": "baimaojiya", 1518 | "Segments": [ 1519 | 0.0, 1520 | 0.0, 1521 | 0.0, 1522 | 3.0, 1523 | 0.0 1524 | ], 1525 | "FadeInTime": -1.0, 1526 | "FadeOutTime": -1.0 1527 | }, 1528 | { 1529 | "Target": "Parameter", 1530 | "Id": "maozuoyou", 1531 | "Segments": [ 1532 | 0.0, 1533 | 0.0, 1534 | 0.0, 1535 | 3.0, 1536 | 0.0 1537 | ], 1538 | "FadeInTime": -1.0, 1539 | "FadeOutTime": -1.0 1540 | }, 1541 | { 1542 | "Target": "Parameter", 1543 | "Id": "maoshangxia", 1544 | "Segments": [ 1545 | 0.0, 1546 | 0.0, 1547 | 0.0, 1548 | 3.0, 1549 | 0.0 1550 | ], 1551 | "FadeInTime": -1.0, 1552 | "FadeOutTime": -1.0 1553 | }, 1554 | { 1555 | "Target": "Parameter", 1556 | "Id": "maojiaodu", 1557 | "Segments": [ 1558 | 0.0, 1559 | 0.0, 1560 | 0.0, 1561 | 3.0, 1562 | 0.0 1563 | ], 1564 | "FadeInTime": -1.0, 1565 | "FadeOutTime": -1.0 1566 | }, 1567 | { 1568 | "Target": "Parameter", 1569 | "Id": "maoliandai", 1570 | "Segments": [ 1571 | 0.0, 1572 | 0.0, 1573 | 0.0, 1574 | 3.0, 1575 | 0.0 1576 | ], 1577 | "FadeInTime": -1.0, 1578 | "FadeOutTime": -1.0 1579 | }, 1580 | { 1581 | "Target": "Parameter", 1582 | "Id": "maoerduo", 1583 | "Segments": [ 1584 | 0.0, 1585 | 0.0, 1586 | 0.0, 1587 | 3.0, 1588 | 0.0 1589 | ], 1590 | "FadeInTime": -1.0, 1591 | "FadeOutTime": -1.0 1592 | }, 1593 | { 1594 | "Target": "Parameter", 1595 | "Id": "maozhayan", 1596 | "Segments": [ 1597 | 0.0, 1598 | 0.0, 1599 | 0.0, 1600 | 3.0, 1601 | 0.0 1602 | ], 1603 | "FadeInTime": -1.0, 1604 | "FadeOutTime": -1.0 1605 | }, 1606 | { 1607 | "Target": "Parameter", 1608 | "Id": "maogaoguang", 1609 | "Segments": [ 1610 | 0.0, 1611 | 0.0, 1612 | 0.0, 1613 | 3.0, 1614 | 0.0 1615 | ], 1616 | "FadeInTime": -1.0, 1617 | "FadeOutTime": -1.0 1618 | }, 1619 | { 1620 | "Target": "Parameter", 1621 | "Id": "maozui", 1622 | "Segments": [ 1623 | 0.0, 1624 | 0.0, 1625 | 0.0, 1626 | 3.0, 1627 | 0.0 1628 | ], 1629 | "FadeInTime": -1.0, 1630 | "FadeOutTime": -1.0 1631 | }, 1632 | { 1633 | "Target": "Parameter", 1634 | "Id": "maozuishetou", 1635 | "Segments": [ 1636 | 0.0, 1637 | 0.0, 1638 | 0.0, 1639 | 3.0, 1640 | 0.0 1641 | ], 1642 | "FadeInTime": -1.0, 1643 | "FadeOutTime": -1.0 1644 | }, 1645 | { 1646 | "Target": "Parameter", 1647 | "Id": "maohongyun", 1648 | "Segments": [ 1649 | 0.0, 1650 | 0.0, 1651 | 0.0, 1652 | 3.0, 1653 | 0.0 1654 | ], 1655 | "FadeInTime": -1.0, 1656 | "FadeOutTime": -1.0 1657 | }, 1658 | { 1659 | "Target": "Parameter", 1660 | "Id": "maozishensuo", 1661 | "Segments": [ 1662 | 0.0, 1663 | 0.0, 1664 | 0.0, 1665 | 3.0, 1666 | 0.0 1667 | ], 1668 | "FadeInTime": -1.0, 1669 | "FadeOutTime": -1.0 1670 | }, 1671 | { 1672 | "Target": "Parameter", 1673 | "Id": "maoshou", 1674 | "Segments": [ 1675 | 0.0, 1676 | -1.0, 1677 | 0.0, 1678 | 3.0, 1679 | -1.0 1680 | ], 1681 | "FadeInTime": -1.0, 1682 | "FadeOutTime": -1.0 1683 | }, 1684 | { 1685 | "Target": "Parameter", 1686 | "Id": "maoweibajiaodu", 1687 | "Segments": [ 1688 | 0.0, 1689 | 0.0, 1690 | 0.0, 1691 | 3.0, 1692 | 0.0 1693 | ], 1694 | "FadeInTime": -1.0, 1695 | "FadeOutTime": -1.0 1696 | }, 1697 | { 1698 | "Target": "Parameter", 1699 | "Id": "maoweibabianxing", 1700 | "Segments": [ 1701 | 0.0, 1702 | 0.0, 1703 | 0.0, 1704 | 3.0, 1705 | 0.0 1706 | ], 1707 | "FadeInTime": -1.0, 1708 | "FadeOutTime": -1.0 1709 | }, 1710 | { 1711 | "Target": "Parameter", 1712 | "Id": "maozuojiao", 1713 | "Segments": [ 1714 | 0.0, 1715 | 0.0, 1716 | 0.0, 1717 | 3.0, 1718 | 0.0 1719 | ], 1720 | "FadeInTime": -1.0, 1721 | "FadeOutTime": -1.0 1722 | }, 1723 | { 1724 | "Target": "Parameter", 1725 | "Id": "maoyoujiao", 1726 | "Segments": [ 1727 | 0.0, 1728 | 0.0, 1729 | 0.0, 1730 | 3.0, 1731 | 0.0 1732 | ], 1733 | "FadeInTime": -1.0, 1734 | "FadeOutTime": -1.0 1735 | }, 1736 | { 1737 | "Target": "Parameter", 1738 | "Id": "ParamEyeLSmile", 1739 | "Segments": [ 1740 | 0.0, 1741 | 0.0, 1742 | 0.0, 1743 | 3.0, 1744 | 0.0 1745 | ], 1746 | "FadeInTime": -1.0, 1747 | "FadeOutTime": -1.0 1748 | }, 1749 | { 1750 | "Target": "Parameter", 1751 | "Id": "ParamEyeRSmile", 1752 | "Segments": [ 1753 | 0.0, 1754 | 0.0, 1755 | 0.0, 1756 | 3.0, 1757 | 0.0 1758 | ], 1759 | "FadeInTime": -1.0, 1760 | "FadeOutTime": -1.0 1761 | }, 1762 | { 1763 | "Target": "Parameter", 1764 | "Id": "ParamBrowLX", 1765 | "Segments": [ 1766 | 0.0, 1767 | 0.0, 1768 | 0.0, 1769 | 3.0, 1770 | 0.0 1771 | ], 1772 | "FadeInTime": -1.0, 1773 | "FadeOutTime": -1.0 1774 | }, 1775 | { 1776 | "Target": "Parameter", 1777 | "Id": "ParamBrowRX", 1778 | "Segments": [ 1779 | 0.0, 1780 | 0.0, 1781 | 0.0, 1782 | 3.0, 1783 | 0.0 1784 | ], 1785 | "FadeInTime": -1.0, 1786 | "FadeOutTime": -1.0 1787 | }, 1788 | { 1789 | "Target": "Parameter", 1790 | "Id": "muyudaxiao", 1791 | "Segments": [ 1792 | 0.0, 1793 | 0.0, 1794 | 0.0, 1795 | 3.0, 1796 | 0.0 1797 | ], 1798 | "FadeInTime": -1.0, 1799 | "FadeOutTime": -1.0 1800 | }, 1801 | { 1802 | "Target": "Parameter", 1803 | "Id": "muyuqiehuan", 1804 | "Segments": [ 1805 | 0.0, 1806 | 0.0, 1807 | 0.0, 1808 | 3.0, 1809 | 0.0 1810 | ], 1811 | "FadeInTime": -1.0, 1812 | "FadeOutTime": -1.0 1813 | }, 1814 | { 1815 | "Target": "Parameter", 1816 | "Id": "gaoguangtoumingdu", 1817 | "Segments": [ 1818 | 0.0, 1819 | 0.0, 1820 | 0.0, 1821 | 3.0, 1822 | 0.0 1823 | ], 1824 | "FadeInTime": -1.0, 1825 | "FadeOutTime": -1.0 1826 | }, 1827 | { 1828 | "Target": "Parameter", 1829 | "Id": "ParamMouthOpenY", 1830 | "Segments": [ 1831 | 0.0, 1832 | 0.0, 1833 | 0.0, 1834 | 3.0, 1835 | 0.0 1836 | ], 1837 | "FadeInTime": -1.0, 1838 | "FadeOutTime": -1.0 1839 | }, 1840 | { 1841 | "Target": "Parameter", 1842 | "Id": "ParamCheek", 1843 | "Segments": [ 1844 | 0.0, 1845 | 0.0, 1846 | 0.0, 1847 | 3.0, 1848 | 0.0 1849 | ], 1850 | "FadeInTime": -1.0, 1851 | "FadeOutTime": -1.0 1852 | }, 1853 | { 1854 | "Target": "Parameter", 1855 | "Id": "yunbianxing", 1856 | "Segments": [ 1857 | 0.0, 1858 | -1.0, 1859 | 0.0, 1860 | 3.0, 1861 | -1.0 1862 | ], 1863 | "FadeInTime": -1.0, 1864 | "FadeOutTime": -1.0 1865 | }, 1866 | { 1867 | "Target": "Parameter", 1868 | "Id": "expyun1", 1869 | "Segments": [ 1870 | 0.0, 1871 | 0.0, 1872 | 0.0, 1873 | 3.0, 1874 | 0.0 1875 | ], 1876 | "FadeInTime": -1.0, 1877 | "FadeOutTime": -1.0 1878 | }, 1879 | { 1880 | "Target": "Parameter", 1881 | "Id": "yunjiaodu", 1882 | "Segments": [ 1883 | 0.0, 1884 | 0.0, 1885 | 0.0, 1886 | 3.0, 1887 | 0.0 1888 | ], 1889 | "FadeInTime": -1.0, 1890 | "FadeOutTime": -1.0 1891 | }, 1892 | { 1893 | "Target": "Parameter", 1894 | "Id": "shuijiaozzz", 1895 | "Segments": [ 1896 | 0.0, 1897 | 0.0, 1898 | 0.0, 1899 | 3.0, 1900 | 0.0 1901 | ], 1902 | "FadeInTime": -1.0, 1903 | "FadeOutTime": -1.0 1904 | }, 1905 | { 1906 | "Target": "Parameter", 1907 | "Id": "shuijiaozzztmd", 1908 | "Segments": [ 1909 | 0.0, 1910 | 0.0, 1911 | 0.0, 1912 | 3.0, 1913 | 0.0 1914 | ], 1915 | "FadeInTime": -1.0, 1916 | "FadeOutTime": -1.0 1917 | }, 1918 | { 1919 | "Target": "Parameter", 1920 | "Id": "shuijiaoyidong", 1921 | "Segments": [ 1922 | 0.0, 1923 | 0.0, 1924 | 0.0, 1925 | 3.0, 1926 | 0.0 1927 | ], 1928 | "FadeInTime": -1.0, 1929 | "FadeOutTime": -1.0 1930 | }, 1931 | { 1932 | "Target": "Parameter", 1933 | "Id": "dingjjj", 1934 | "Segments": [ 1935 | 0.0, 1936 | 0.0, 1937 | 0.0, 1938 | 3.0, 1939 | 0.0 1940 | ], 1941 | "FadeInTime": -1.0, 1942 | "FadeOutTime": -1.0 1943 | }, 1944 | { 1945 | "Target": "Parameter", 1946 | "Id": "youshoutui", 1947 | "Segments": [ 1948 | 0.0, 1949 | 0.0, 1950 | 0.0, 1951 | 3.0, 1952 | 0.0 1953 | ], 1954 | "FadeInTime": -1.0, 1955 | "FadeOutTime": -1.0 1956 | }, 1957 | { 1958 | "Target": "Parameter", 1959 | "Id": "youtuiqiehuan", 1960 | "Segments": [ 1961 | 0.0, 1962 | 1.0, 1963 | 0.0, 1964 | 3.0, 1965 | 1.0 1966 | ], 1967 | "FadeInTime": -1.0, 1968 | "FadeOutTime": -1.0 1969 | }, 1970 | { 1971 | "Target": "Parameter", 1972 | "Id": "zuoshoutui", 1973 | "Segments": [ 1974 | 0.0, 1975 | 0.0, 1976 | 0.0, 1977 | 3.0, 1978 | 0.0 1979 | ], 1980 | "FadeInTime": -1.0, 1981 | "FadeOutTime": -1.0 1982 | }, 1983 | { 1984 | "Target": "Parameter", 1985 | "Id": "zuotuiqiehuan", 1986 | "Segments": [ 1987 | 0.0, 1988 | 1.0, 1989 | 0.0, 1990 | 3.0, 1991 | 1.0 1992 | ], 1993 | "FadeInTime": -1.0, 1994 | "FadeOutTime": -1.0 1995 | }, 1996 | { 1997 | "Target": "Parameter", 1998 | "Id": "zuotuixuanzhuan", 1999 | "Segments": [ 2000 | 0.0, 2001 | 0.0, 2002 | 0.0, 2003 | 3.0, 2004 | 0.0 2005 | ], 2006 | "FadeInTime": -1.0, 2007 | "FadeOutTime": -1.0 2008 | }, 2009 | { 2010 | "Target": "Parameter", 2011 | "Id": "zuotuizuoyou", 2012 | "Segments": [ 2013 | 0.0, 2014 | 0.0, 2015 | 0.0, 2016 | 3.0, 2017 | 0.0 2018 | ], 2019 | "FadeInTime": -1.0, 2020 | "FadeOutTime": -1.0 2021 | }, 2022 | { 2023 | "Target": "Parameter", 2024 | "Id": "zuotuishangxia", 2025 | "Segments": [ 2026 | 0.0, 2027 | 0.0, 2028 | 0.0, 2029 | 3.0, 2030 | 0.0 2031 | ], 2032 | "FadeInTime": -1.0, 2033 | "FadeOutTime": -1.0 2034 | }, 2035 | { 2036 | "Target": "Parameter", 2037 | "Id": "zuotuidaxiao", 2038 | "Segments": [ 2039 | 0.0, 2040 | 0.0, 2041 | 0.0, 2042 | 3.0, 2043 | 0.0 2044 | ], 2045 | "FadeInTime": -1.0, 2046 | "FadeOutTime": -1.0 2047 | }, 2048 | { 2049 | "Target": "Parameter", 2050 | "Id": "youtuixuanzhuan", 2051 | "Segments": [ 2052 | 0.0, 2053 | 0.0, 2054 | 0.0, 2055 | 3.0, 2056 | 0.0 2057 | ], 2058 | "FadeInTime": -1.0, 2059 | "FadeOutTime": -1.0 2060 | }, 2061 | { 2062 | "Target": "Parameter", 2063 | "Id": "youtuizuoyou", 2064 | "Segments": [ 2065 | 0.0, 2066 | 0.0, 2067 | 0.0, 2068 | 3.0, 2069 | 0.0 2070 | ], 2071 | "FadeInTime": -1.0, 2072 | "FadeOutTime": -1.0 2073 | }, 2074 | { 2075 | "Target": "Parameter", 2076 | "Id": "youtuishangxia", 2077 | "Segments": [ 2078 | 0.0, 2079 | 0.0, 2080 | 0.0, 2081 | 3.0, 2082 | 0.0 2083 | ], 2084 | "FadeInTime": -1.0, 2085 | "FadeOutTime": -1.0 2086 | }, 2087 | { 2088 | "Target": "Parameter", 2089 | "Id": "youtuidaxiao", 2090 | "Segments": [ 2091 | 0.0, 2092 | 0.0, 2093 | 0.0, 2094 | 3.0, 2095 | 0.0 2096 | ], 2097 | "FadeInTime": -1.0, 2098 | "FadeOutTime": -1.0 2099 | }, 2100 | { 2101 | "Target": "Parameter", 2102 | "Id": "zuoxiaotuishensuo", 2103 | "Segments": [ 2104 | 0.0, 2105 | 0.0, 2106 | 0.0, 2107 | 3.0, 2108 | 0.0 2109 | ], 2110 | "FadeInTime": -1.0, 2111 | "FadeOutTime": -1.0 2112 | }, 2113 | { 2114 | "Target": "Parameter", 2115 | "Id": "zuobaijiao", 2116 | "Segments": [ 2117 | 0.0, 2118 | -0.7, 2119 | 0.0, 2120 | 3.0, 2121 | -0.7 2122 | ], 2123 | "FadeInTime": -1.0, 2124 | "FadeOutTime": -1.0 2125 | }, 2126 | { 2127 | "Target": "Parameter", 2128 | "Id": "youxiaotuishensuo", 2129 | "Segments": [ 2130 | 0.0, 2131 | 0.0, 2132 | 0.0, 2133 | 3.0, 2134 | 0.0 2135 | ], 2136 | "FadeInTime": -1.0, 2137 | "FadeOutTime": -1.0 2138 | }, 2139 | { 2140 | "Target": "Parameter", 2141 | "Id": "youbaijiao", 2142 | "Segments": [ 2143 | 0.0, 2144 | -0.7, 2145 | 0.0, 2146 | 3.0, 2147 | -0.7 2148 | ], 2149 | "FadeInTime": -1.0, 2150 | "FadeOutTime": -1.0 2151 | }, 2152 | { 2153 | "Target": "Parameter", 2154 | "Id": "zuobishensuo", 2155 | "Segments": [ 2156 | 0.0, 2157 | 0.0, 2158 | 0.0, 2159 | 3.0, 2160 | 0.0 2161 | ], 2162 | "FadeInTime": -1.0, 2163 | "FadeOutTime": -1.0 2164 | }, 2165 | { 2166 | "Target": "Parameter", 2167 | "Id": "zuoxiabishensuo", 2168 | "Segments": [ 2169 | 0.0, 2170 | 0.0, 2171 | 0.0, 2172 | 3.0, 2173 | 0.0 2174 | ], 2175 | "FadeInTime": -1.0, 2176 | "FadeOutTime": -1.0 2177 | }, 2178 | { 2179 | "Target": "Parameter", 2180 | "Id": "zuoshouxuanzhuan", 2181 | "Segments": [ 2182 | 0.0, 2183 | 0.0, 2184 | 0.0, 2185 | 3.0, 2186 | 0.0 2187 | ], 2188 | "FadeInTime": -1.0, 2189 | "FadeOutTime": -1.0 2190 | }, 2191 | { 2192 | "Target": "Parameter", 2193 | "Id": "xingfengtmd", 2194 | "Segments": [ 2195 | 0.0, 2196 | 0.0, 2197 | 0.0, 2198 | 3.0, 2199 | 0.0 2200 | ], 2201 | "FadeInTime": -1.0, 2202 | "FadeOutTime": -1.0 2203 | }, 2204 | { 2205 | "Target": "Parameter", 2206 | "Id": "xingfengjiaodu", 2207 | "Segments": [ 2208 | 0.0, 2209 | 0.0, 2210 | 0.0, 2211 | 3.0, 2212 | 0.0 2213 | ], 2214 | "FadeInTime": -1.0, 2215 | "FadeOutTime": -1.0 2216 | }, 2217 | { 2218 | "Target": "Parameter", 2219 | "Id": "youbishensuo", 2220 | "Segments": [ 2221 | 0.0, 2222 | 0.0, 2223 | 0.0, 2224 | 3.0, 2225 | 0.0 2226 | ], 2227 | "FadeInTime": -1.0, 2228 | "FadeOutTime": -1.0 2229 | }, 2230 | { 2231 | "Target": "Parameter", 2232 | "Id": "youbijiya", 2233 | "Segments": [ 2234 | 0.0, 2235 | 0.0, 2236 | 0.0, 2237 | 3.0, 2238 | 0.0 2239 | ], 2240 | "FadeInTime": -1.0, 2241 | "FadeOutTime": -1.0 2242 | }, 2243 | { 2244 | "Target": "Parameter", 2245 | "Id": "shangzimianx", 2246 | "Segments": [ 2247 | 0.0, 2248 | 0.0, 2249 | 0.0, 2250 | 3.0, 2251 | 0.0 2252 | ], 2253 | "FadeInTime": -1.0, 2254 | "FadeOutTime": -1.0 2255 | }, 2256 | { 2257 | "Target": "Parameter", 2258 | "Id": "yssztmd", 2259 | "Segments": [ 2260 | 0.0, 2261 | 0.0, 2262 | 0.0, 2263 | 3.0, 2264 | 0.0 2265 | ], 2266 | "FadeInTime": -1.0, 2267 | "FadeOutTime": -1.0 2268 | }, 2269 | { 2270 | "Target": "Parameter", 2271 | "Id": "yousizi", 2272 | "Segments": [ 2273 | 0.0, 2274 | -1.0, 2275 | 0.0, 2276 | 3.0, 2277 | -1.0 2278 | ], 2279 | "FadeInTime": -1.0, 2280 | "FadeOutTime": -1.0 2281 | }, 2282 | { 2283 | "Target": "Parameter", 2284 | "Id": "paotaichanrao", 2285 | "Segments": [ 2286 | 0.0, 2287 | 4.0, 2288 | 0.0, 2289 | 3.0, 2290 | 4.0 2291 | ], 2292 | "FadeInTime": -1.0, 2293 | "FadeOutTime": -1.0 2294 | }, 2295 | { 2296 | "Target": "Parameter", 2297 | "Id": "paodishenchu", 2298 | "Segments": [ 2299 | 0.0, 2300 | 1.0, 2301 | 0.0, 2302 | 3.0, 2303 | 1.0 2304 | ], 2305 | "FadeInTime": -1.0, 2306 | "FadeOutTime": -1.0 2307 | }, 2308 | { 2309 | "Target": "Parameter", 2310 | "Id": "yuleichangrao", 2311 | "Segments": [ 2312 | 0.0, 2313 | 6.0, 2314 | 0.0, 2315 | 3.0, 2316 | 6.0 2317 | ], 2318 | "FadeInTime": -1.0, 2319 | "FadeOutTime": -1.0 2320 | }, 2321 | { 2322 | "Target": "Parameter", 2323 | "Id": "paotaishensuo", 2324 | "Segments": [ 2325 | 0.0, 2326 | 0.0, 2327 | 0.0, 2328 | 3.0, 2329 | 0.0 2330 | ], 2331 | "FadeInTime": -1.0, 2332 | "FadeOutTime": -1.0 2333 | }, 2334 | { 2335 | "Target": "Parameter", 2336 | "Id": "yuleiweiyi1", 2337 | "Segments": [ 2338 | 0.0, 2339 | 0.0, 2340 | 0.0, 2341 | 3.0, 2342 | 0.0 2343 | ], 2344 | "FadeInTime": -1.0, 2345 | "FadeOutTime": -1.0 2346 | }, 2347 | { 2348 | "Target": "Parameter", 2349 | "Id": "yuleiweiyi2", 2350 | "Segments": [ 2351 | 0.0, 2352 | 0.0, 2353 | 0.0, 2354 | 3.0, 2355 | 0.0 2356 | ], 2357 | "FadeInTime": -1.0, 2358 | "FadeOutTime": -1.0 2359 | }, 2360 | { 2361 | "Target": "Parameter", 2362 | "Id": "yuleiweiyi3", 2363 | "Segments": [ 2364 | 0.0, 2365 | 0.0, 2366 | 0.0, 2367 | 3.0, 2368 | 0.0 2369 | ], 2370 | "FadeInTime": -1.0, 2371 | "FadeOutTime": -1.0 2372 | }, 2373 | { 2374 | "Target": "Parameter", 2375 | "Id": "yuleiweiyi5", 2376 | "Segments": [ 2377 | 0.0, 2378 | 0.0, 2379 | 0.0, 2380 | 3.0, 2381 | 0.0 2382 | ], 2383 | "FadeInTime": -1.0, 2384 | "FadeOutTime": -1.0 2385 | }, 2386 | { 2387 | "Target": "Parameter", 2388 | "Id": "yuleiweiyi4", 2389 | "Segments": [ 2390 | 0.0, 2391 | 0.0, 2392 | 0.0, 2393 | 3.0, 2394 | 0.0 2395 | ], 2396 | "FadeInTime": -1.0, 2397 | "FadeOutTime": -1.0 2398 | }, 2399 | { 2400 | "Target": "Parameter", 2401 | "Id": "jianzhuanjiaodu", 2402 | "Segments": [ 2403 | 0.0, 2404 | 0.0, 2405 | 0.0, 2406 | 3.0, 2407 | 0.0 2408 | ], 2409 | "FadeInTime": -1.0, 2410 | "FadeOutTime": -1.0 2411 | }, 2412 | { 2413 | "Target": "Parameter", 2414 | "Id": "jianzhuanshangxia", 2415 | "Segments": [ 2416 | 0.0, 2417 | 0.0, 2418 | 0.0, 2419 | 3.0, 2420 | 0.0 2421 | ], 2422 | "FadeInTime": -1.0, 2423 | "FadeOutTime": -1.0 2424 | }, 2425 | { 2426 | "Target": "Parameter", 2427 | "Id": "jianzhuangqumian", 2428 | "Segments": [ 2429 | 0.0, 2430 | 0.0, 2431 | 0.0, 2432 | 3.0, 2433 | 0.0 2434 | ], 2435 | "FadeInTime": -1.0, 2436 | "FadeOutTime": -1.0 2437 | }, 2438 | { 2439 | "Target": "Parameter", 2440 | "Id": "liuhaiyaobai", 2441 | "Segments": [ 2442 | 0.0, 2443 | 0.0, 2444 | 0.0, 2445 | 3.0, 2446 | 0.0 2447 | ], 2448 | "FadeInTime": -1.0, 2449 | "FadeOutTime": -1.0 2450 | }, 2451 | { 2452 | "Target": "Parameter", 2453 | "Id": "zuotueryaobai", 2454 | "Segments": [ 2455 | 0.0, 2456 | 0.0, 2457 | 0.0, 2458 | 3.0, 2459 | 0.0 2460 | ], 2461 | "FadeInTime": -1.0, 2462 | "FadeOutTime": -1.0 2463 | }, 2464 | { 2465 | "Target": "Parameter", 2466 | "Id": "ztebx", 2467 | "Segments": [ 2468 | 0.0, 2469 | 0.0, 2470 | 0.0, 2471 | 3.0, 2472 | 0.0 2473 | ], 2474 | "FadeInTime": -1.0, 2475 | "FadeOutTime": -1.0 2476 | }, 2477 | { 2478 | "Target": "Parameter", 2479 | "Id": "youtueryaobai", 2480 | "Segments": [ 2481 | 0.0, 2482 | 0.0, 2483 | 0.0, 2484 | 3.0, 2485 | 0.0 2486 | ], 2487 | "FadeInTime": -1.0, 2488 | "FadeOutTime": -1.0 2489 | }, 2490 | { 2491 | "Target": "Parameter", 2492 | "Id": "ytebx", 2493 | "Segments": [ 2494 | 0.0, 2495 | 0.0, 2496 | 0.0, 2497 | 3.0, 2498 | 0.0 2499 | ], 2500 | "FadeInTime": -1.0, 2501 | "FadeOutTime": -1.0 2502 | }, 2503 | { 2504 | "Target": "Parameter", 2505 | "Id": "ParamHairFront", 2506 | "Segments": [ 2507 | 0.0, 2508 | 0.0, 2509 | 0.0, 2510 | 3.0, 2511 | 0.0 2512 | ], 2513 | "FadeInTime": -1.0, 2514 | "FadeOutTime": -1.0 2515 | }, 2516 | { 2517 | "Target": "Parameter", 2518 | "Id": "qianfashensuo", 2519 | "Segments": [ 2520 | 0.0, 2521 | 0.0, 2522 | 0.0, 2523 | 3.0, 2524 | 0.0 2525 | ], 2526 | "FadeInTime": -1.0, 2527 | "FadeOutTime": -1.0 2528 | }, 2529 | { 2530 | "Target": "Parameter", 2531 | "Id": "ParamHairSide", 2532 | "Segments": [ 2533 | 0.0, 2534 | 0.0, 2535 | 0.0, 2536 | 3.0, 2537 | 0.0 2538 | ], 2539 | "FadeInTime": -1.0, 2540 | "FadeOutTime": -1.0 2541 | }, 2542 | { 2543 | "Target": "Parameter", 2544 | "Id": "ParamHairBack", 2545 | "Segments": [ 2546 | 0.0, 2547 | 0.0, 2548 | 0.0, 2549 | 3.0, 2550 | 0.0 2551 | ], 2552 | "FadeInTime": -1.0, 2553 | "FadeOutTime": -1.0 2554 | }, 2555 | { 2556 | "Target": "Parameter", 2557 | "Id": "lingdangyaobai", 2558 | "Segments": [ 2559 | 0.0, 2560 | 0.0, 2561 | 0.0, 2562 | 3.0, 2563 | 0.0 2564 | ], 2565 | "FadeInTime": -1.0, 2566 | "FadeOutTime": -1.0 2567 | }, 2568 | { 2569 | "Target": "Parameter", 2570 | "Id": "ParamAngleX", 2571 | "Segments": [ 2572 | 0.0, 2573 | 0.0, 2574 | 0.0, 2575 | 3.0, 2576 | 0.0 2577 | ], 2578 | "FadeInTime": -1.0, 2579 | "FadeOutTime": -1.0 2580 | }, 2581 | { 2582 | "Target": "Parameter", 2583 | "Id": "shouZ", 2584 | "Segments": [ 2585 | 0.0, 2586 | 0.0, 2587 | 0.0, 2588 | 3.0, 2589 | 0.0 2590 | ], 2591 | "FadeInTime": -1.0, 2592 | "FadeOutTime": -1.0 2593 | }, 2594 | { 2595 | "Target": "Parameter", 2596 | "Id": "zuocefatuceng", 2597 | "Segments": [ 2598 | 0.0, 2599 | 0.0, 2600 | 0.0, 2601 | 3.0, 2602 | 0.0 2603 | ], 2604 | "FadeInTime": -1.0, 2605 | "FadeOutTime": -1.0 2606 | }, 2607 | { 2608 | "Target": "Parameter", 2609 | "Id": "ParamBodyAngleY", 2610 | "Segments": [ 2611 | 0.0, 2612 | 0.0, 2613 | 0.0, 2614 | 3.0, 2615 | 0.0 2616 | ], 2617 | "FadeInTime": -1.0, 2618 | "FadeOutTime": -1.0 2619 | }, 2620 | { 2621 | "Target": "Parameter", 2622 | "Id": "ParamBodyAngleZ", 2623 | "Segments": [ 2624 | 0.0, 2625 | 0.0, 2626 | 0.0, 2627 | 3.0, 2628 | 0.0 2629 | ], 2630 | "FadeInTime": -1.0, 2631 | "FadeOutTime": -1.0 2632 | }, 2633 | { 2634 | "Target": "Parameter", 2635 | "Id": "jblsbx", 2636 | "Segments": [ 2637 | 0.0, 2638 | 0.5, 2639 | 0.0, 2640 | 3.0, 2641 | 0.5 2642 | ], 2643 | "FadeInTime": -1.0, 2644 | "FadeOutTime": -1.0 2645 | }, 2646 | { 2647 | "Target": "Parameter", 2648 | "Id": "slszy", 2649 | "Segments": [ 2650 | 0.0, 2651 | -1.24, 2652 | 0.0, 2653 | 3.0, 2654 | -1.24 2655 | ], 2656 | "FadeInTime": -1.0, 2657 | "FadeOutTime": -1.0 2658 | }, 2659 | { 2660 | "Target": "Parameter", 2661 | "Id": "szlssx", 2662 | "Segments": [ 2663 | 0.0, 2664 | 0.0, 2665 | 0.0, 2666 | 3.0, 2667 | 0.0 2668 | ], 2669 | "FadeInTime": -1.0, 2670 | "FadeOutTime": -1.0 2671 | }, 2672 | { 2673 | "Target": "Parameter", 2674 | "Id": "slsjd", 2675 | "Segments": [ 2676 | 0.0, 2677 | 0.0, 2678 | 0.0, 2679 | 3.0, 2680 | 0.0 2681 | ], 2682 | "FadeInTime": -1.0, 2683 | "FadeOutTime": -1.0 2684 | }, 2685 | { 2686 | "Target": "Parameter", 2687 | "Id": "szlsbx", 2688 | "Segments": [ 2689 | 0.0, 2690 | 0.0, 2691 | 0.0, 2692 | 3.0, 2693 | 0.0 2694 | ], 2695 | "FadeInTime": -1.0, 2696 | "FadeOutTime": -1.0 2697 | }, 2698 | { 2699 | "Target": "Parameter", 2700 | "Id": "szlstc", 2701 | "Segments": [ 2702 | 0.0, 2703 | 0.0, 2704 | 0.0, 2705 | 3.0, 2706 | 0.0 2707 | ], 2708 | "FadeInTime": -1.0, 2709 | "FadeOutTime": -1.0 2710 | }, 2711 | { 2712 | "Target": "Parameter", 2713 | "Id": "yifuxingtai", 2714 | "Segments": [ 2715 | 0.0, 2716 | 0.0, 2717 | 0.0, 2718 | 3.0, 2719 | 0.0 2720 | ], 2721 | "FadeInTime": -1.0, 2722 | "FadeOutTime": -1.0 2723 | }, 2724 | { 2725 | "Target": "Parameter", 2726 | "Id": "yifuyaobai", 2727 | "Segments": [ 2728 | 0.0, 2729 | 0.0, 2730 | 0.0, 2731 | 3.0, 2732 | 0.0 2733 | ], 2734 | "FadeInTime": -1.0, 2735 | "FadeOutTime": -1.0 2736 | }, 2737 | { 2738 | "Target": "Parameter", 2739 | "Id": "xiashujiaodu", 2740 | "Segments": [ 2741 | 0.0, 2742 | 0.0, 2743 | 0.0, 2744 | 3.0, 2745 | 0.0 2746 | ], 2747 | "FadeInTime": -1.0, 2748 | "FadeOutTime": -1.0 2749 | }, 2750 | { 2751 | "Target": "Parameter", 2752 | "Id": "shentishangxia", 2753 | "Segments": [ 2754 | 0.0, 2755 | 0.0, 2756 | 0.0, 2757 | 3.0, 2758 | 0.0 2759 | ], 2760 | "FadeInTime": -1.0, 2761 | "FadeOutTime": -1.0 2762 | }, 2763 | { 2764 | "Target": "Parameter", 2765 | "Id": "shentidaxiao", 2766 | "Segments": [ 2767 | 0.0, 2768 | 0.0, 2769 | 0.0, 2770 | 3.0, 2771 | 0.0 2772 | ], 2773 | "FadeInTime": -1.0, 2774 | "FadeOutTime": -1.0 2775 | }, 2776 | { 2777 | "Target": "Parameter", 2778 | "Id": "shangshenshangxia", 2779 | "Segments": [ 2780 | 0.0, 2781 | 0.0, 2782 | 0.0, 2783 | 3.0, 2784 | 0.0 2785 | ], 2786 | "FadeInTime": -1.0, 2787 | "FadeOutTime": -1.0 2788 | }, 2789 | { 2790 | "Target": "Parameter", 2791 | "Id": "shangshenjiaodu", 2792 | "Segments": [ 2793 | 0.0, 2794 | 0.0, 2795 | 0.0, 2796 | 3.0, 2797 | 0.0 2798 | ], 2799 | "FadeInTime": -1.0, 2800 | "FadeOutTime": -1.0 2801 | }, 2802 | { 2803 | "Target": "Parameter", 2804 | "Id": "ParamBodyAngleYY", 2805 | "Segments": [ 2806 | 0.0, 2807 | 0.0, 2808 | 0.0, 2809 | 3.0, 2810 | 0.0 2811 | ], 2812 | "FadeInTime": 0.0, 2813 | "FadeOutTime": 0.0 2814 | }, 2815 | { 2816 | "Target": "Parameter", 2817 | "Id": "expyun2", 2818 | "Segments": [ 2819 | 0.0, 2820 | 0.0, 2821 | 0.0, 2822 | 3.0, 2823 | 0.0 2824 | ], 2825 | "FadeInTime": 0.0, 2826 | "FadeOutTime": 0.0 2827 | }, 2828 | { 2829 | "Target": "Parameter", 2830 | "Id": "expyun3", 2831 | "Segments": [ 2832 | 0.0, 2833 | 0.0, 2834 | 0.0, 2835 | 3.0, 2836 | 0.0 2837 | ], 2838 | "FadeInTime": 0.0, 2839 | "FadeOutTime": 0.0 2840 | }, 2841 | { 2842 | "Target": "Parameter", 2843 | "Id": "heihuatmd", 2844 | "Segments": [ 2845 | 0.0, 2846 | 0.0, 2847 | 0.0, 2848 | 3.0, 2849 | 0.0 2850 | ], 2851 | "FadeInTime": 0.0, 2852 | "FadeOutTime": 0.0 2853 | } 2854 | ], 2855 | "UserData": [ 2856 | { 2857 | "Time": 2.5 2858 | } 2859 | ] 2860 | } -------------------------------------------------------------------------------- /js/Resources/lafei_4/textures/texture_00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/UsernameFull/l2d/c836e9a33fec42154cfd12d6d9b339df2fb7da38/js/Resources/lafei_4/textures/texture_00.png -------------------------------------------------------------------------------- /js/l2d.js: -------------------------------------------------------------------------------- 1 | // const PIXI = require('./l2d/pixi.min.js') 2 | // const LIVE2DCUBISMFRAMEWORK = require('./live2dcubismframework.js') 3 | 4 | // import PIXI from 5 | class L2D { 6 | constructor (basePath) { 7 | this.basePath = basePath; 8 | this.loader = new PIXI.loaders.Loader(this.basePath); 9 | this.animatorBuilder = new LIVE2DCUBISMFRAMEWORK.AnimatorBuilder(); 10 | this.timeScale = 1; 11 | this.models = {}; 12 | //建立一个触发事件(触摸,加载等)和动作的对应表 13 | this.TriggerMotions = new Map(); 14 | //建立一个触发区域和对应动作的对应表 15 | this.TapAreas = new Map(); 16 | 17 | } 18 | 19 | setPhysics3Json (value) { 20 | if (!this.physicsRigBuilder) { 21 | this.physicsRigBuilder = new LIVE2DCUBISMFRAMEWORK.PhysicsRigBuilder(); 22 | } 23 | this.physicsRigBuilder.setPhysics3Json(value); 24 | 25 | return this; 26 | } 27 | 28 | load (name, v) { 29 | console.log("loading:", name) 30 | if (!this.models[name]) { 31 | let modelDir = name+'/'; 32 | let modelPath = name+'.model3.json'; 33 | let textures = new Array(); 34 | let textureCount = 0; 35 | let motionNames = new Array(); 36 | let modelNames = new Array(); 37 | let _=this; 38 | 39 | //if (!modelNames.includes(name+'_model')){ 40 | this.loader.add(name+'_model', modelDir+modelPath, { xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.JSON }); 41 | modelNames.push(name+'_model'); 42 | //} 43 | 44 | this.loader.load((loader, resources) => { 45 | let model3Obj = resources[name+'_model'].data; 46 | if (typeof(model3Obj['FileReferences']['Moc']) !== "undefined") { 47 | loader.add(name+'_moc', modelDir+model3Obj['FileReferences']['Moc'], { xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.BUFFER }); 48 | } 49 | 50 | if (typeof(model3Obj['FileReferences']['Textures']) !== "undefined") { 51 | model3Obj['FileReferences']['Textures'].forEach((element) => { 52 | loader.add(name+'_texture'+textureCount, modelDir+element); 53 | textureCount++; 54 | }); 55 | } 56 | 57 | if (typeof(model3Obj['FileReferences']['Physics']) !== "undefined") { 58 | loader.add(name+'_physics', modelDir+model3Obj['FileReferences']['Physics'], { xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.JSON }); 59 | } 60 | if (typeof(model3Obj['FileReferences']['Motions']) !== "undefined") { 61 | for (let group in model3Obj['FileReferences']['Motions']) { 62 | var groupmotionNames = []; 63 | model3Obj['FileReferences']['Motions'][group].forEach((element) => { 64 | 65 | let motionName = element['File'].split('/').pop().split('.').shift(); 66 | if (!motionNames.includes(motionName)){ 67 | loader.add(motionName, modelDir+element['File'], { xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.JSON }); 68 | motionNames.push(motionName); 69 | } else { 70 | var n = motionName+String(Date.now()); 71 | loader.add(n, modelDir+element['File'], { xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.JSON }); 72 | motionNames.push(motionName); 73 | } 74 | groupmotionNames.push(motionName) 75 | }); 76 | _.TriggerMotions.set(group,groupmotionNames) 77 | 78 | } 79 | } 80 | 81 | let groups = null; 82 | // 原始代码好像不太对劲。。typeof的括号位置不对 83 | // if (typeof(model3Obj['Groups'] !== "undefined")) { 84 | // groups = LIVE2DCUBISMFRAMEWORK.Groups.fromModel3Json(model3Obj); 85 | // } 86 | if (typeof(model3Obj['Groups']) !== 'undefined') { 87 | groups = LIVE2DCUBISMFRAMEWORK.Groups.fromModel3Json(model3Obj); 88 | } 89 | //从HitAreas配置中拿到点击区域和动作的对应关系,输入格式为 90 | /* 91 | // "HitAreas": [ 92 | // { 93 | // "Id": "TouchBody", 94 | // "Motion": "TapBody" 95 | // }, 96 | // { 97 | // "Id": "TouchHead", 98 | // "Motion": "TapHead:touch_head,main" 99 | // } 100 | // ] 101 | */ 102 | if (typeof(model3Obj['HitAreas']) !== 'undefined'){ 103 | let tempHitAreas = model3Obj['HitAreas']; 104 | //按Order排序,Order值越大,越靠前,没有Order的设置为默认值0 105 | tempHitAreas.forEach((e)=>{if(!e.Order){e.Order = 0}}) 106 | tempHitAreas.sort(function(a, b){return b.Order - a.Order}); 107 | console.log(tempHitAreas); 108 | tempHitAreas.forEach((e)=>{ 109 | let [MotionsGroup,MotionsItems] = e.Motion.split(':') 110 | if(MotionsItems){ 111 | _.TapAreas.set(e.Id,MotionsItems.split(',')) 112 | }else{ 113 | _.TapAreas.set(e.Id,_.TriggerMotions.get(MotionsGroup)) 114 | } 115 | }) 116 | } 117 | loader.load((l, r) => { 118 | let moc = null; 119 | if (typeof(r[name+'_moc']) !== "undefined") { 120 | moc = Live2DCubismCore.Moc.fromArrayBuffer(r[name+'_moc'].data); 121 | } 122 | 123 | if (typeof(r[name+'_texture'+0]) !== "undefined") { 124 | for (let i = 0; i < textureCount; i++) { 125 | textures.splice(i, 0, r[name+'_texture'+i].texture); 126 | } 127 | } 128 | 129 | if (typeof(r[name+'_physics']) !== "undefined") { 130 | this.setPhysics3Json(r[name+'_physics'].data); 131 | } 132 | //这里只是把加载了动作数据和动作名,没有把动作和触发事件联系起来 133 | let motions = new Map(); 134 | motionNames.forEach((e) => { 135 | motions.set(e, LIVE2DCUBISMFRAMEWORK.Animation.fromMotion3Json(r[e].data)); 136 | }); 137 | 138 | let model = null; 139 | 140 | let coreModel = Live2DCubismCore.Model.fromMoc(moc); 141 | 142 | if (coreModel == null) { 143 | return; 144 | } 145 | 146 | let animator = this.animatorBuilder 147 | .setTarget(coreModel) 148 | .setTimeScale(this.timeScale) 149 | .build(); 150 | let physicsRig = this.physicsRigBuilder 151 | .setTarget(coreModel) 152 | .setTimeScale(this.timeScale) 153 | .build(); 154 | 155 | let userData = null; 156 | 157 | model = LIVE2DCUBISMPIXI.Model._create(coreModel, textures, animator, physicsRig, userData, groups); 158 | model.motions = motions; 159 | this.models[name] = model; 160 | 161 | v.changeCanvas(model); 162 | }); 163 | }); 164 | } else { 165 | v.changeCanvas(this.models[name]); 166 | } 167 | } 168 | } -------------------------------------------------------------------------------- /js/live2dcubismframework.js: -------------------------------------------------------------------------------- 1 | var LIVE2DCUBISMFRAMEWORK; 2 | (function (LIVE2DCUBISMFRAMEWORK) { 3 | var AnimationPoint = (function () { 4 | function AnimationPoint(time, value) { 5 | this.time = time; 6 | this.value = value; 7 | } 8 | return AnimationPoint; 9 | }()); 10 | LIVE2DCUBISMFRAMEWORK.AnimationPoint = AnimationPoint; 11 | var AnimationUserDataBody = (function () { 12 | function AnimationUserDataBody(time, value) { 13 | this.time = time; 14 | this.value = value; 15 | } 16 | ; 17 | return AnimationUserDataBody; 18 | }()); 19 | LIVE2DCUBISMFRAMEWORK.AnimationUserDataBody = AnimationUserDataBody; 20 | var BuiltinAnimationSegmentEvaluators = (function () { 21 | function BuiltinAnimationSegmentEvaluators() { 22 | } 23 | BuiltinAnimationSegmentEvaluators.lerp = function (a, b, t) { 24 | return new AnimationPoint((a.time + ((b.time - a.time) * t)), (a.value + ((b.value - a.value) * t))); 25 | }; 26 | BuiltinAnimationSegmentEvaluators.LINEAR = function (points, offset, time) { 27 | var p0 = points[offset + 0]; 28 | var p1 = points[offset + 1]; 29 | var t = (time - p0.time) / (p1.time - p0.time); 30 | return (p0.value + ((p1.value - p0.value) * t)); 31 | }; 32 | BuiltinAnimationSegmentEvaluators.BEZIER = function (points, offset, time) { 33 | var t = (time - points[offset + 0].time) / (points[offset + 3].time - points[offset].time); 34 | var p01 = BuiltinAnimationSegmentEvaluators.lerp(points[offset + 0], points[offset + 1], t); 35 | var p12 = BuiltinAnimationSegmentEvaluators.lerp(points[offset + 1], points[offset + 2], t); 36 | var p23 = BuiltinAnimationSegmentEvaluators.lerp(points[offset + 2], points[offset + 3], t); 37 | var p012 = BuiltinAnimationSegmentEvaluators.lerp(p01, p12, t); 38 | var p123 = BuiltinAnimationSegmentEvaluators.lerp(p12, p23, t); 39 | return BuiltinAnimationSegmentEvaluators.lerp(p012, p123, t).value; 40 | }; 41 | BuiltinAnimationSegmentEvaluators.STEPPED = function (points, offset, time) { 42 | return points[offset + 0].value; 43 | }; 44 | BuiltinAnimationSegmentEvaluators.INVERSE_STEPPED = function (points, offset, time) { 45 | return points[offset + 1].value; 46 | }; 47 | return BuiltinAnimationSegmentEvaluators; 48 | }()); 49 | LIVE2DCUBISMFRAMEWORK.BuiltinAnimationSegmentEvaluators = BuiltinAnimationSegmentEvaluators; 50 | var AnimationSegment = (function () { 51 | function AnimationSegment(offset, evaluate) { 52 | this.offset = offset; 53 | this.evaluate = evaluate; 54 | } 55 | return AnimationSegment; 56 | }()); 57 | LIVE2DCUBISMFRAMEWORK.AnimationSegment = AnimationSegment; 58 | var AnimationTrack = (function () { 59 | function AnimationTrack(targetId, points, segments) { 60 | this.targetId = targetId; 61 | this.points = points; 62 | this.segments = segments; 63 | } 64 | AnimationTrack.prototype.evaluate = function (time) { 65 | var s = 0; 66 | var lastS = this.segments.length - 1; 67 | for (; s < lastS; ++s) { 68 | if (this.points[this.segments[s + 1].offset].time < time) { 69 | continue; 70 | } 71 | break; 72 | } 73 | return this.segments[s].evaluate(this.points, this.segments[s].offset, time); 74 | }; 75 | return AnimationTrack; 76 | }()); 77 | LIVE2DCUBISMFRAMEWORK.AnimationTrack = AnimationTrack; 78 | var Animation = (function () { 79 | function Animation(motion3Json) { 80 | var _this = this; 81 | this.modelTracks = new Array(); 82 | this.parameterTracks = new Array(); 83 | this.partOpacityTracks = new Array(); 84 | this.userDataBodys = new Array(); 85 | this.duration = motion3Json['Meta']['Duration']; 86 | this.fps = motion3Json['Meta']['Fps']; 87 | this.loop = motion3Json['Meta']['Loop']; 88 | this.userDataCount = motion3Json['Meta']['UserDataCount']; 89 | this.totalUserDataSize = motion3Json['Meta']['TotalUserDataSize']; 90 | if (motion3Json['UserData'] != null) { 91 | motion3Json['UserData'].forEach(function (u) { 92 | _this.userDataBodys.push(new AnimationUserDataBody(u['Time'], u['Value'])); 93 | }); 94 | console.assert(this.userDataBodys.length === this.userDataCount); 95 | } 96 | motion3Json['Curves'].forEach(function (c) { 97 | var s = c['Segments']; 98 | var points = new Array(); 99 | var segments = new Array(); 100 | points.push(new AnimationPoint(s[0], s[1])); 101 | for (var t = 2; t < s.length; t += 3) { 102 | var offset = points.length - 1; 103 | var evaluate = BuiltinAnimationSegmentEvaluators.LINEAR; 104 | var type = s[t]; 105 | if (type == 1) { 106 | evaluate = BuiltinAnimationSegmentEvaluators.BEZIER; 107 | points.push(new AnimationPoint(s[t + 1], s[t + 2])); 108 | points.push(new AnimationPoint(s[t + 3], s[t + 4])); 109 | t += 4; 110 | } 111 | else if (type == 2) { 112 | evaluate = BuiltinAnimationSegmentEvaluators.STEPPED; 113 | } 114 | else if (type == 3) { 115 | evaluate = BuiltinAnimationSegmentEvaluators.INVERSE_STEPPED; 116 | } 117 | else if (type != 0) { 118 | } 119 | points.push(new AnimationPoint(s[t + 1], s[t + 2])); 120 | segments.push(new AnimationSegment(offset, evaluate)); 121 | } 122 | var track = new AnimationTrack(c['Id'], points, segments); 123 | if (c['Target'] == 'Model') { 124 | _this.modelTracks.push(track); 125 | } 126 | else if (c['Target'] == 'Parameter') { 127 | _this.parameterTracks.push(track); 128 | } 129 | else if (c['Target'] == 'PartOpacity') { 130 | _this.partOpacityTracks.push(track); 131 | } 132 | else { 133 | } 134 | }); 135 | } 136 | Animation.fromMotion3Json = function (motion3Json) { 137 | if (motion3Json == null) { 138 | console.log(motion3Json) 139 | return null; 140 | } 141 | var animation = new Animation(motion3Json); 142 | // console.log(animation) 143 | return (animation.isValid) 144 | ? animation 145 | : null; 146 | }; 147 | Animation.prototype.addAnimationCallback = function (callbackFunc) { 148 | if (this._callbackFunctions == null) 149 | this._callbackFunctions = new Array(); 150 | this._callbackFunctions.push(callbackFunc); 151 | }; 152 | Animation.prototype.removeAnimationCallback = function (callbackFunc) { 153 | if (this._callbackFunctions != null) { 154 | var _target = -1; 155 | for (var _index = 0; _index < this._callbackFunctions.length; _index++) { 156 | if (this._callbackFunctions[_index] === callbackFunc) { 157 | _target = _index; 158 | break; 159 | } 160 | } 161 | if (_target >= 0) 162 | this._callbackFunctions.splice(_target, 1); 163 | } 164 | }; 165 | Animation.prototype.clearAnimationCallback = function () { 166 | this._callbackFunctions = []; 167 | }; 168 | Animation.prototype.callAnimationCallback = function (value) { 169 | if (this._callbackFunctions.length > 0) 170 | this._callbackFunctions.forEach(function (func) { func(value); }); 171 | }; 172 | Animation.prototype.evaluate = function (time, weight, blend, target, stackFlags, groups) { 173 | if (groups === void 0) { groups = null; } 174 | if (weight <= 0.01) { 175 | return; 176 | } 177 | if (this.loop) { 178 | while (time > this.duration) { 179 | time -= this.duration; 180 | } 181 | } 182 | this.parameterTracks.forEach(function (t) { 183 | var p = target.parameters.ids.indexOf(t.targetId); 184 | if (p >= 0) { 185 | var sample = t.evaluate(time); 186 | if (stackFlags[0][p] != true) { 187 | target.parameters.values[p] = target.parameters.defaultValues[p]; 188 | stackFlags[0][p] = true; 189 | } 190 | target.parameters.values[p] = blend(target.parameters.values[p], sample, t.evaluate(0), weight); 191 | } 192 | }); 193 | this.partOpacityTracks.forEach(function (t) { 194 | var p = target.parts.ids.indexOf(t.targetId); 195 | if (p >= 0) { 196 | var sample = t.evaluate(time); 197 | if (stackFlags[1][p] != true) { 198 | target.parts.opacities[p] = 1; 199 | stackFlags[1][p] = true; 200 | } 201 | target.parts.opacities[p] = blend(target.parts.opacities[p], sample, t.evaluate(0), weight); 202 | } 203 | }); 204 | this.modelTracks.forEach(function (t) { 205 | if (groups != null) { 206 | var g = groups.getGroupById(t.targetId); 207 | if (g != null && g.target === "Parameter") { 208 | for (var _i = 0, _a = g.ids; _i < _a.length; _i++) { 209 | var tid = _a[_i]; 210 | var p = target.parameters.ids.indexOf(tid); 211 | if (p >= 0) { 212 | var sample = t.evaluate(time); 213 | if (stackFlags[0][p] != true) { 214 | target.parameters.values[p] = target.parameters.defaultValues[p]; 215 | stackFlags[0][p] = true; 216 | } 217 | target.parameters.values[p] = blend(target.parameters.values[p], sample, t.evaluate(0), weight); 218 | } 219 | } 220 | } 221 | } 222 | }); 223 | if (this._callbackFunctions != null) { 224 | for (var _i = 0, _a = this.userDataBodys; _i < _a.length; _i++) { 225 | var ud = _a[_i]; 226 | if (this.isEventTriggered(ud.time, time, this._lastTime, this.duration)) 227 | this.callAnimationCallback(ud.value); 228 | } 229 | } 230 | this._lastTime = time; 231 | }; 232 | Animation.prototype.isEventTriggered = function (timeEvaluate, timeForward, timeBack, duration) { 233 | if (timeForward > timeBack) { 234 | if (timeEvaluate > timeBack && timeEvaluate < timeForward) 235 | return true; 236 | } 237 | else { 238 | if (timeEvaluate > 0 && timeEvaluate < timeForward 239 | || timeEvaluate > timeBack && timeEvaluate < duration) 240 | return true; 241 | } 242 | return false; 243 | }; 244 | Object.defineProperty(Animation.prototype, "isValid", { 245 | get: function () { 246 | return true; 247 | }, 248 | enumerable: true, 249 | configurable: true 250 | }); 251 | return Animation; 252 | }()); 253 | LIVE2DCUBISMFRAMEWORK.Animation = Animation; 254 | var BuiltinCrossfadeWeighters = (function () { 255 | function BuiltinCrossfadeWeighters() { 256 | } 257 | BuiltinCrossfadeWeighters.LINEAR = function (time, duration) { 258 | return (time / duration); 259 | }; 260 | return BuiltinCrossfadeWeighters; 261 | }()); 262 | LIVE2DCUBISMFRAMEWORK.BuiltinCrossfadeWeighters = BuiltinCrossfadeWeighters; 263 | var AnimationState = (function () { 264 | function AnimationState() { 265 | } 266 | return AnimationState; 267 | }()); 268 | LIVE2DCUBISMFRAMEWORK.AnimationState = AnimationState; 269 | var BuiltinAnimationBlenders = (function () { 270 | function BuiltinAnimationBlenders() { 271 | } 272 | BuiltinAnimationBlenders.OVERRIDE = function (source, destination, initial, weight) { 273 | return ((destination * weight) + source * (1 - weight)); 274 | }; 275 | BuiltinAnimationBlenders.ADD = function (source, destination, initial, weight) { 276 | return (source + ((destination - initial) * weight)); 277 | }; 278 | BuiltinAnimationBlenders.MULTIPLY = function (source, destination, weight) { 279 | return (source * (1 + ((destination - 1) * weight))); 280 | }; 281 | return BuiltinAnimationBlenders; 282 | }()); 283 | LIVE2DCUBISMFRAMEWORK.BuiltinAnimationBlenders = BuiltinAnimationBlenders; 284 | var AnimationLayer = (function () { 285 | function AnimationLayer() { 286 | this.weight = 1; 287 | } 288 | Object.defineProperty(AnimationLayer.prototype, "currentAnimation", { 289 | get: function () { 290 | return this._animation; 291 | }, 292 | enumerable: true, 293 | configurable: true 294 | }); 295 | Object.defineProperty(AnimationLayer.prototype, "currentTime", { 296 | get: function () { 297 | return this._time; 298 | }, 299 | set: function (value) { 300 | this._time = value; 301 | }, 302 | enumerable: true, 303 | configurable: true 304 | }); 305 | Object.defineProperty(AnimationLayer.prototype, "isPlaying", { 306 | get: function () { 307 | return this._play; 308 | }, 309 | enumerable: true, 310 | configurable: true 311 | }); 312 | AnimationLayer.prototype.play = function (animation, fadeDuration) { 313 | if (fadeDuration === void 0) { fadeDuration = 0; } 314 | if (this._animation && fadeDuration > 0) { 315 | this._goalAnimation = animation; 316 | this._goalTime = 0; 317 | this._fadeTime = 0; 318 | this._fadeDuration = fadeDuration; 319 | } 320 | else { 321 | this._animation = animation; 322 | this.currentTime = 0; 323 | this._play = true; 324 | } 325 | }; 326 | AnimationLayer.prototype.resume = function () { 327 | this._play = true; 328 | }; 329 | AnimationLayer.prototype.pause = function () { 330 | this._play = false; 331 | }; 332 | AnimationLayer.prototype.stop = function () { 333 | this._play = false; 334 | this.currentTime = 0; 335 | }; 336 | AnimationLayer.prototype._update = function (deltaTime) { 337 | if (!this._play) { 338 | return; 339 | } 340 | this._time += deltaTime; 341 | this._goalTime += deltaTime; 342 | this._fadeTime += deltaTime; 343 | if (this._animation == null || (!this._animation.loop && this._time > this._animation.duration)) { 344 | this.stop(); 345 | this._animation = null; 346 | } 347 | }; 348 | AnimationLayer.prototype._evaluate = function (target, stackFlags) { 349 | if (this._animation == null) { 350 | return; 351 | } 352 | var weight = (this.weight < 1) 353 | ? this.weight 354 | : 1; 355 | var animationWeight = (this._goalAnimation != null) 356 | ? (weight * this.weightCrossfade(this._fadeTime, this._fadeDuration)) 357 | : weight; 358 | this._animation.evaluate(this._time, animationWeight, this.blend, target, stackFlags, this.groups); 359 | if (this._goalAnimation != null) { 360 | animationWeight = 1 - (weight * this.weightCrossfade(this._fadeTime, this._fadeDuration)); 361 | this._goalAnimation.evaluate(this._goalTime, animationWeight, this.blend, target, stackFlags, this.groups); 362 | if (this._fadeTime > this._fadeDuration) { 363 | this._animation = this._goalAnimation; 364 | this._time = this._goalTime; 365 | this._goalAnimation = null; 366 | } 367 | } 368 | }; 369 | return AnimationLayer; 370 | }()); 371 | LIVE2DCUBISMFRAMEWORK.AnimationLayer = AnimationLayer; 372 | var Animator = (function () { 373 | function Animator(target, timeScale, layers) { 374 | this._target = target; 375 | this.timeScale = timeScale; 376 | this._layers = layers; 377 | } 378 | Object.defineProperty(Animator.prototype, "target", { 379 | get: function () { 380 | return this._target; 381 | }, 382 | enumerable: true, 383 | configurable: true 384 | }); 385 | Object.defineProperty(Animator.prototype, "isPlaying", { 386 | get: function () { 387 | var ret = false; 388 | this._layers.forEach(function (l) { 389 | if (l.isPlaying) { 390 | ret = true; 391 | return; 392 | } 393 | }); 394 | return ret; 395 | }, 396 | enumerable: true, 397 | configurable: true 398 | }); 399 | Animator.prototype.addLayer = function (name, blender, weight) { 400 | if (blender === void 0) { blender = BuiltinAnimationBlenders.OVERRIDE; } 401 | if (weight === void 0) { weight = 1; } 402 | var layer = new AnimationLayer(); 403 | layer.blend = blender; 404 | layer.weightCrossfade = BuiltinCrossfadeWeighters.LINEAR; 405 | layer.weight = weight; 406 | layer.groups = this.groups; 407 | this._layers.set(name, layer); 408 | }; 409 | Animator.prototype.getLayer = function (name) { 410 | return this._layers.has(name) 411 | ? this._layers.get(name) 412 | : null; 413 | }; 414 | Animator.prototype.removeLayer = function (name) { 415 | return this._layers.has(name) 416 | ? this._layers.delete(name) 417 | : null; 418 | }; 419 | Animator.prototype.clearLayers = function () { 420 | this._layers.clear(); 421 | }; 422 | Animator.prototype.updateAndEvaluate = function (deltaTime) { 423 | var _this = this; 424 | deltaTime *= ((this.timeScale > 0) 425 | ? this.timeScale 426 | : 0); 427 | if (deltaTime > 0.001) { 428 | this._layers.forEach(function (l) { 429 | l._update(deltaTime); 430 | }); 431 | } 432 | var paramStackFlags = new Array(this._target.parameters.count).fill(false); 433 | var partsStackFlags = new Array(this._target.parts.count).fill(false); 434 | var stackFlags = new Array(paramStackFlags, partsStackFlags); 435 | this._layers.forEach(function (l) { 436 | l._evaluate(_this._target, stackFlags); 437 | }); 438 | }; 439 | Animator._create = function (target, timeScale, layers) { 440 | var animator = new Animator(target, timeScale, layers); 441 | return animator.isValid 442 | ? animator 443 | : null; 444 | }; 445 | Object.defineProperty(Animator.prototype, "isValid", { 446 | get: function () { 447 | return this._target != null; 448 | }, 449 | enumerable: true, 450 | configurable: true 451 | }); 452 | return Animator; 453 | }()); 454 | LIVE2DCUBISMFRAMEWORK.Animator = Animator; 455 | var AnimatorBuilder = (function () { 456 | function AnimatorBuilder() { 457 | this._timeScale = 1; 458 | this._layerNames = new Array(); 459 | this._layerBlenders = new Array(); 460 | this._layerCrossfadeWeighters = new Array(); 461 | this._layerWeights = new Array(); 462 | } 463 | AnimatorBuilder.prototype.setTarget = function (value) { 464 | this._target = value; 465 | return this; 466 | }; 467 | AnimatorBuilder.prototype.setTimeScale = function (value) { 468 | this._timeScale = value; 469 | return this; 470 | }; 471 | AnimatorBuilder.prototype.addLayer = function (name, blender, weight) { 472 | if (blender === void 0) { blender = BuiltinAnimationBlenders.OVERRIDE; } 473 | if (weight === void 0) { weight = 1; } 474 | this._layerNames.push(name); 475 | this._layerBlenders.push(blender); 476 | this._layerCrossfadeWeighters.push(BuiltinCrossfadeWeighters.LINEAR); 477 | this._layerWeights.push(weight); 478 | return this; 479 | }; 480 | AnimatorBuilder.prototype.build = function () { 481 | var layers = new Map(); 482 | for (var l = 0; l < this._layerNames.length; ++l) { 483 | var layer = new AnimationLayer(); 484 | layer.blend = this._layerBlenders[l]; 485 | layer.weightCrossfade = this._layerCrossfadeWeighters[l]; 486 | layer.weight = this._layerWeights[l]; 487 | layers.set(this._layerNames[l], layer); 488 | } 489 | return Animator._create(this._target, this._timeScale, layers); 490 | }; 491 | return AnimatorBuilder; 492 | }()); 493 | LIVE2DCUBISMFRAMEWORK.AnimatorBuilder = AnimatorBuilder; 494 | var PhysicsVector2 = (function () { 495 | function PhysicsVector2(x, y) { 496 | this.x = x; 497 | this.y = y; 498 | } 499 | PhysicsVector2.distance = function (a, b) { 500 | return Math.abs(a.substract(b).length); 501 | }; 502 | PhysicsVector2.dot = function (a, b) { 503 | return ((a.x * b.x) + (a.y * b.y)); 504 | }; 505 | Object.defineProperty(PhysicsVector2.prototype, "length", { 506 | get: function () { 507 | return Math.sqrt(PhysicsVector2.dot(this, this)); 508 | }, 509 | enumerable: true, 510 | configurable: true 511 | }); 512 | PhysicsVector2.prototype.add = function (vector2) { 513 | return new PhysicsVector2(this.x + vector2.x, this.y + vector2.y); 514 | }; 515 | PhysicsVector2.prototype.substract = function (vector2) { 516 | return new PhysicsVector2(this.x - vector2.x, this.y - vector2.y); 517 | }; 518 | PhysicsVector2.prototype.multiply = function (vector2) { 519 | return new PhysicsVector2(this.x * vector2.x, this.y * vector2.y); 520 | }; 521 | PhysicsVector2.prototype.multiplyByScalar = function (scalar) { 522 | return this.multiply(new PhysicsVector2(scalar, scalar)); 523 | }; 524 | PhysicsVector2.prototype.divide = function (vector2) { 525 | return new PhysicsVector2(this.x / vector2.x, this.y / vector2.y); 526 | }; 527 | PhysicsVector2.prototype.divideByScalar = function (scalar) { 528 | return this.divide(new PhysicsVector2(scalar, scalar)); 529 | }; 530 | PhysicsVector2.prototype.rotateByRadians = function (radians) { 531 | var x = (this.x * Math.cos(radians)) - (this.y * Math.sin(radians)); 532 | var y = (this.x * Math.sin(radians)) + (this.y * Math.cos(radians)); 533 | return new PhysicsVector2(x, y); 534 | }; 535 | PhysicsVector2.prototype.normalize = function () { 536 | var length = this.length; 537 | var x = this.x / length; 538 | var y = this.y / length; 539 | return new PhysicsVector2(x, y); 540 | }; 541 | PhysicsVector2.zero = new PhysicsVector2(0, 0); 542 | return PhysicsVector2; 543 | }()); 544 | LIVE2DCUBISMFRAMEWORK.PhysicsVector2 = PhysicsVector2; 545 | var Physics = (function () { 546 | function Physics() { 547 | } 548 | Physics.clampScalar = function (scalar, lower, upper) { 549 | if (scalar < lower) { 550 | return lower; 551 | } 552 | if (scalar > upper) { 553 | return upper; 554 | } 555 | return scalar; 556 | }; 557 | Physics.directionToDegrees = function (from, to) { 558 | var radians = Physics.directionToRadians(from, to); 559 | var degrees = Physics.radiansToDegrees(radians); 560 | return ((to.x - from.x) > 0) 561 | ? -degrees 562 | : degrees; 563 | }; 564 | Physics.radiansToDegrees = function (radians) { 565 | return ((radians * 180) / Math.PI); 566 | }; 567 | Physics.radiansToDirection = function (radians) { 568 | return new PhysicsVector2(Math.sin(radians), Math.cos(radians)); 569 | }; 570 | Physics.degreesToRadians = function (degrees) { 571 | return ((degrees / 180) * Math.PI); 572 | }; 573 | Physics.directionToRadians = function (from, to) { 574 | var dot = PhysicsVector2.dot(from, to); 575 | var magnitude = from.length * to.length; 576 | if (magnitude == 0) { 577 | return 0; 578 | } 579 | var cosTheta = (dot / magnitude); 580 | return (Math.abs(cosTheta) <= 1.0) 581 | ? Math.acos(cosTheta) 582 | : 0; 583 | }; 584 | Physics.gravity = new PhysicsVector2(0, -1); 585 | Physics.wind = new PhysicsVector2(0, 0); 586 | Physics.maximumWeight = 100; 587 | Physics.airResistance = 5; 588 | Physics.movementThreshold = 0.001; 589 | Physics.correctAngles = true; 590 | return Physics; 591 | }()); 592 | LIVE2DCUBISMFRAMEWORK.Physics = Physics; 593 | var PhysicsParticle = (function () { 594 | function PhysicsParticle(initialPosition, mobility, delay, acceleration, radius) { 595 | this.initialPosition = initialPosition; 596 | this.mobility = mobility; 597 | this.delay = delay; 598 | this.acceleration = acceleration; 599 | this.radius = radius; 600 | this.position = initialPosition; 601 | this.lastPosition = this.position; 602 | this.lastGravity = new PhysicsVector2(0, -1); 603 | this.force = new PhysicsVector2(0, 0); 604 | this.velocity = new PhysicsVector2(0, 0); 605 | } 606 | return PhysicsParticle; 607 | }()); 608 | LIVE2DCUBISMFRAMEWORK.PhysicsParticle = PhysicsParticle; 609 | var PhysicsFactorTuple = (function () { 610 | function PhysicsFactorTuple(x, y, angle) { 611 | this.x = x; 612 | this.y = y; 613 | this.angle = angle; 614 | } 615 | PhysicsFactorTuple.prototype.add = function (factor) { 616 | var x = this.x + factor.x; 617 | var y = this.y + factor.y; 618 | var angle = this.angle + factor.angle; 619 | return new PhysicsFactorTuple(x, y, angle); 620 | }; 621 | return PhysicsFactorTuple; 622 | }()); 623 | LIVE2DCUBISMFRAMEWORK.PhysicsFactorTuple = PhysicsFactorTuple; 624 | var PhysicsNormalizationTuple = (function () { 625 | function PhysicsNormalizationTuple(minimum, maximum, def) { 626 | this.minimum = minimum; 627 | this.maximum = maximum; 628 | this.def = def; 629 | } 630 | return PhysicsNormalizationTuple; 631 | }()); 632 | LIVE2DCUBISMFRAMEWORK.PhysicsNormalizationTuple = PhysicsNormalizationTuple; 633 | var PhysicsNormalizationOptions = (function () { 634 | function PhysicsNormalizationOptions(position, angle) { 635 | this.position = position; 636 | this.angle = angle; 637 | } 638 | return PhysicsNormalizationOptions; 639 | }()); 640 | LIVE2DCUBISMFRAMEWORK.PhysicsNormalizationOptions = PhysicsNormalizationOptions; 641 | var PhysicsInput = (function () { 642 | function PhysicsInput(targetId, weight, factor, invert) { 643 | this.targetId = targetId; 644 | this.weight = weight; 645 | this.factor = factor; 646 | this.invert = invert; 647 | } 648 | Object.defineProperty(PhysicsInput.prototype, "normalizedWeight", { 649 | get: function () { 650 | return Physics.clampScalar(this.weight / Physics.maximumWeight, 0, 1); 651 | }, 652 | enumerable: true, 653 | configurable: true 654 | }); 655 | PhysicsInput.prototype.evaluateFactor = function (parameterValue, parameterMinimum, parameterMaximum, parameterDefault, normalization) { 656 | console.assert(parameterMaximum > parameterMinimum); 657 | var parameterMiddle = this.getMiddleValue(parameterMinimum, parameterMaximum); 658 | var value = parameterValue - parameterMiddle; 659 | switch (Math.sign(value)) { 660 | case 1: 661 | { 662 | var parameterRange = parameterMaximum - parameterMiddle; 663 | if (parameterRange == 0) { 664 | value = normalization.angle.def; 665 | } 666 | else { 667 | var normalizationRange = normalization.angle.maximum - normalization.angle.def; 668 | if (normalizationRange == 0) { 669 | value = normalization.angle.maximum; 670 | } 671 | else { 672 | value *= Math.abs(normalizationRange / parameterRange); 673 | value += normalization.angle.def; 674 | } 675 | } 676 | } 677 | break; 678 | case -1: 679 | { 680 | var parameterRange = parameterMiddle - parameterMinimum; 681 | if (parameterRange == 0) { 682 | value = normalization.angle.def; 683 | } 684 | else { 685 | var normalizationRange = normalization.angle.def - normalization.angle.minimum; 686 | if (normalizationRange == 0) { 687 | value = normalization.angle.minimum; 688 | } 689 | else { 690 | value *= Math.abs(normalizationRange / parameterRange); 691 | value += normalization.angle.def; 692 | } 693 | } 694 | } 695 | break; 696 | case 0: 697 | { 698 | value = normalization.angle.def; 699 | } 700 | break; 701 | } 702 | var weight = (this.weight / Physics.maximumWeight); 703 | value *= (this.invert) ? 1 : -1; 704 | return new PhysicsFactorTuple(value * this.factor.x * weight, value * this.factor.y * weight, value * this.factor.angle * weight); 705 | }; 706 | PhysicsInput.prototype.getRangeValue = function (min, max) { 707 | var maxValue = Math.max(min, max); 708 | var minValue = Math.min(min, max); 709 | return Math.abs(maxValue - minValue); 710 | }; 711 | PhysicsInput.prototype.getMiddleValue = function (min, max) { 712 | var minValue = Math.min(min, max); 713 | return minValue + (this.getRangeValue(min, max) / 2); 714 | }; 715 | return PhysicsInput; 716 | }()); 717 | LIVE2DCUBISMFRAMEWORK.PhysicsInput = PhysicsInput; 718 | var PhysicsOutput = (function () { 719 | function PhysicsOutput(targetId, particleIndex, weight, angleScale, factor, invert) { 720 | this.targetId = targetId; 721 | this.particleIndex = particleIndex; 722 | this.weight = weight; 723 | this.factor = factor; 724 | this.invert = invert; 725 | this.factor.angle *= angleScale; 726 | } 727 | Object.defineProperty(PhysicsOutput.prototype, "normalizedWeight", { 728 | get: function () { 729 | return Physics.clampScalar(this.weight / Physics.maximumWeight, 0, 1); 730 | }, 731 | enumerable: true, 732 | configurable: true 733 | }); 734 | PhysicsOutput.prototype.evaluateValue = function (translation, particles) { 735 | var value = (translation.x * this.factor.x) + (translation.y * this.factor.y); 736 | if (this.factor.angle > 0) { 737 | var parentGravity = Physics.gravity; 738 | if (Physics.correctAngles && this.particleIndex > 1) { 739 | parentGravity = particles[this.particleIndex - 2].position 740 | .substract(particles[this.particleIndex - 1].position); 741 | } 742 | var angleResult = (Physics.directionToRadians(parentGravity, translation)); 743 | value += (((translation.x - parentGravity.x) > 0) ? -angleResult : angleResult) * this.factor.angle; 744 | } 745 | value *= ((this.invert) 746 | ? -1 747 | : 1); 748 | return value; 749 | }; 750 | return PhysicsOutput; 751 | }()); 752 | LIVE2DCUBISMFRAMEWORK.PhysicsOutput = PhysicsOutput; 753 | var PhysicsSubRig = (function () { 754 | function PhysicsSubRig(input, output, particles, normalization) { 755 | this.input = input; 756 | this.output = output; 757 | this.particles = particles; 758 | this.normalization = normalization; 759 | } 760 | PhysicsSubRig.prototype._update = function (deltaTime, target) { 761 | var _this = this; 762 | var parameters = target.parameters; 763 | var factor = new PhysicsFactorTuple(0, 0, 0); 764 | this.input.forEach(function (i) { 765 | var parameterIndex = parameters.ids.indexOf(i.targetId); 766 | if (parameterIndex == -1) { 767 | return; 768 | } 769 | factor = factor.add(i.evaluateFactor(parameters.values[parameterIndex], parameters.minimumValues[parameterIndex], parameters.maximumValues[parameterIndex], parameters.defaultValues[parameterIndex], _this.normalization)); 770 | }); 771 | var a = Physics.degreesToRadians(-factor.angle); 772 | var xy = new PhysicsVector2(factor.x, factor.y).rotateByRadians(a); 773 | factor.x = xy.x; 774 | factor.y = xy.y; 775 | var factorRadians = a; 776 | var gravityDirection = Physics 777 | .radiansToDirection(factorRadians) 778 | .normalize(); 779 | this.particles.forEach(function (p, i) { 780 | if (i == 0) { 781 | p.position = new PhysicsVector2(factor.x, factor.y); 782 | return; 783 | } 784 | p.force = gravityDirection.multiplyByScalar(p.acceleration).add(Physics.wind); 785 | p.lastPosition = p.position; 786 | var delay = p.delay * deltaTime * 30; 787 | var direction = p.position.substract(_this.particles[i - 1].position); 788 | var distance = PhysicsVector2.distance(PhysicsVector2.zero, direction); 789 | var angle = Physics.directionToDegrees(p.lastGravity, gravityDirection); 790 | var radians = Physics.degreesToRadians(angle) / Physics.airResistance; 791 | direction = direction 792 | .rotateByRadians(radians) 793 | .normalize(); 794 | p.position = _this.particles[i - 1].position.add(direction.multiplyByScalar(distance)); 795 | var velocity = p.velocity.multiplyByScalar(delay); 796 | var force = p.force 797 | .multiplyByScalar(delay) 798 | .multiplyByScalar(delay); 799 | p.position = p.position 800 | .add(velocity) 801 | .add(force); 802 | var newDirection = p.position 803 | .substract(_this.particles[i - 1].position) 804 | .normalize(); 805 | p.position = _this.particles[i - 1].position.add(newDirection.multiplyByScalar(p.radius)); 806 | if (Math.abs(p.position.x) < Physics.movementThreshold) { 807 | p.position.x = 0; 808 | } 809 | if (delay != 0) { 810 | p.velocity = p.position 811 | .substract(p.lastPosition) 812 | .divideByScalar(delay) 813 | .multiplyByScalar(p.mobility); 814 | } 815 | else { 816 | p.velocity = PhysicsVector2.zero; 817 | } 818 | p.force = PhysicsVector2.zero; 819 | p.lastGravity = gravityDirection; 820 | }); 821 | }; 822 | PhysicsSubRig.prototype._evaluate = function (target) { 823 | var _this = this; 824 | var parameters = target.parameters; 825 | this.output.forEach(function (o) { 826 | if (o.particleIndex < 1 || o.particleIndex >= _this.particles.length) { 827 | return; 828 | } 829 | var parameterIndex = parameters.ids.indexOf(o.targetId); 830 | if (parameterIndex == -1) { 831 | return; 832 | } 833 | var translation = _this.particles[o.particleIndex - 1].position.substract(_this.particles[o.particleIndex].position); 834 | var value = Physics.clampScalar(o.evaluateValue(translation, _this.particles), parameters.minimumValues[parameterIndex], parameters.maximumValues[parameterIndex]); 835 | var unclampedParameterValue = (parameters.values[parameterIndex] * (1 - o.normalizedWeight)) + (value * o.normalizedWeight); 836 | parameters.values[parameterIndex] = Physics.clampScalar(unclampedParameterValue, parameters.minimumValues[parameterIndex], parameters.maximumValues[parameterIndex]); 837 | }); 838 | }; 839 | return PhysicsSubRig; 840 | }()); 841 | LIVE2DCUBISMFRAMEWORK.PhysicsSubRig = PhysicsSubRig; 842 | var PhysicsRig = (function () { 843 | function PhysicsRig(target, timeScale, physics3Json) { 844 | var _this = this; 845 | this.timeScale = 1; 846 | this.timeScale = timeScale; 847 | this._target = target; 848 | if (!target) { 849 | return; 850 | } 851 | this._subRigs = new Array(); 852 | physics3Json['PhysicsSettings'].forEach(function (r) { 853 | var input = new Array(); 854 | r['Input'].forEach(function (i) { 855 | var factor = new PhysicsFactorTuple(1, 0, 0); 856 | if (i['Type'] == 'Y') { 857 | factor.x = 0; 858 | factor.y = 1; 859 | } 860 | else if (i['Type'] == 'Angle') { 861 | factor.x = 0; 862 | factor.angle = 1; 863 | } 864 | input.push(new PhysicsInput(i['Source']['Id'], i['Weight'], factor, i['Reflect'])); 865 | }); 866 | var output = new Array(); 867 | r['Output'].forEach(function (o) { 868 | var factor = new PhysicsFactorTuple(1, 0, 0); 869 | if (o['Type'] == 'Y') { 870 | factor.x = 0; 871 | factor.y = 1; 872 | } 873 | else if (o['Type'] == 'Angle') { 874 | factor.x = 0; 875 | factor.angle = 1; 876 | } 877 | output.push(new PhysicsOutput(o['Destination']['Id'], o['VertexIndex'], o['Weight'], o['Scale'], factor, o['Reflect'])); 878 | }); 879 | var particles = new Array(); 880 | r['Vertices'].forEach(function (p) { 881 | var initialPosition = new PhysicsVector2(p['Position']['X'], p['Position']['Y']); 882 | particles.push(new PhysicsParticle(initialPosition, p['Mobility'], p['Delay'], p['Acceleration'], p['Radius'])); 883 | }); 884 | var jsonOptions = r['Normalization']; 885 | var positionsOption = new PhysicsNormalizationTuple(jsonOptions['Position']['Minimum'], jsonOptions['Position']['Maximum'], jsonOptions['Position']['Default']); 886 | var anglesOption = new PhysicsNormalizationTuple(jsonOptions['Angle']['Minimum'], jsonOptions['Angle']['Maximum'], jsonOptions['Angle']['Default']); 887 | var normalization = new PhysicsNormalizationOptions(positionsOption, anglesOption); 888 | _this._subRigs.push(new PhysicsSubRig(input, output, particles, normalization)); 889 | }); 890 | } 891 | PhysicsRig.prototype.updateAndEvaluate = function (deltaTime) { 892 | var _this = this; 893 | deltaTime *= ((this.timeScale > 0) 894 | ? this.timeScale 895 | : 0); 896 | if (deltaTime > 0.01) { 897 | this._subRigs.forEach(function (r) { 898 | r._update(deltaTime, _this._target); 899 | }); 900 | } 901 | this._subRigs.forEach(function (r) { 902 | r._evaluate(_this._target); 903 | }); 904 | }; 905 | PhysicsRig._fromPhysics3Json = function (target, timeScale, physics3Json) { 906 | var rig = new PhysicsRig(target, timeScale, physics3Json); 907 | return (rig._isValid) 908 | ? rig 909 | : null; 910 | }; 911 | Object.defineProperty(PhysicsRig.prototype, "_isValid", { 912 | get: function () { 913 | return this._target != null; 914 | }, 915 | enumerable: true, 916 | configurable: true 917 | }); 918 | return PhysicsRig; 919 | }()); 920 | LIVE2DCUBISMFRAMEWORK.PhysicsRig = PhysicsRig; 921 | var PhysicsRigBuilder = (function () { 922 | function PhysicsRigBuilder() { 923 | this._timeScale = 1; 924 | } 925 | PhysicsRigBuilder.prototype.setTarget = function (value) { 926 | this._target = value; 927 | return this; 928 | }; 929 | PhysicsRigBuilder.prototype.setTimeScale = function (value) { 930 | this._timeScale = value; 931 | return this; 932 | }; 933 | PhysicsRigBuilder.prototype.setPhysics3Json = function (value) { 934 | this._physics3Json = value; 935 | return this; 936 | }; 937 | PhysicsRigBuilder.prototype.build = function () { 938 | return PhysicsRig._fromPhysics3Json(this._target, this._timeScale, this._physics3Json); 939 | }; 940 | return PhysicsRigBuilder; 941 | }()); 942 | LIVE2DCUBISMFRAMEWORK.PhysicsRigBuilder = PhysicsRigBuilder; 943 | var UserData = (function () { 944 | function UserData(target, userData3Json) { 945 | var _this = this; 946 | this._target = target; 947 | if (!target) { 948 | return; 949 | } 950 | this._version = userData3Json['Version']; 951 | this._userDataCount = userData3Json['Meta']['UserDataCount']; 952 | this._totalUserDataSize = userData3Json['Meta']['TotalUserDataSize']; 953 | if (userData3Json['UserData'] != null) { 954 | this._userDataBodys = new Array(); 955 | userData3Json['UserData'].forEach(function (u) { 956 | _this._userDataBodys.push(new UserDataBody(u['Target'], u['Id'], u['Value'])); 957 | }); 958 | console.assert(this._userDataBodys.length === this._userDataCount); 959 | } 960 | } 961 | UserData._fromUserData3Json = function (target, userData3Json) { 962 | var userdata = new UserData(target, userData3Json); 963 | return (userdata._isValid) 964 | ? userdata 965 | : null; 966 | }; 967 | Object.defineProperty(UserData.prototype, "_isValid", { 968 | get: function () { 969 | return this._target != null; 970 | }, 971 | enumerable: true, 972 | configurable: true 973 | }); 974 | Object.defineProperty(UserData.prototype, "userDataCount", { 975 | get: function () { 976 | if (this._userDataBodys == null) 977 | return 0; 978 | return this._userDataCount; 979 | }, 980 | enumerable: true, 981 | configurable: true 982 | }); 983 | Object.defineProperty(UserData.prototype, "totalUserDataSize", { 984 | get: function () { 985 | if (this._userDataBodys == null) 986 | return 0; 987 | return this._totalUserDataSize; 988 | }, 989 | enumerable: true, 990 | configurable: true 991 | }); 992 | Object.defineProperty(UserData.prototype, "userDataBodys", { 993 | get: function () { 994 | if (this._userDataBodys == null) 995 | return null; 996 | return this._userDataBodys; 997 | }, 998 | enumerable: true, 999 | configurable: true 1000 | }); 1001 | UserData.prototype.isExistUserDataById = function (id_) { 1002 | if (this._userDataBodys == null) 1003 | return false; 1004 | for (var _i = 0, _a = this._userDataBodys; _i < _a.length; _i++) { 1005 | var ud = _a[_i]; 1006 | if (ud.id === id_) 1007 | return true; 1008 | } 1009 | return false; 1010 | }; 1011 | UserData.prototype.getUserDataValueById = function (id_) { 1012 | if (this._userDataBodys == null) 1013 | return null; 1014 | for (var _i = 0, _a = this._userDataBodys; _i < _a.length; _i++) { 1015 | var ud = _a[_i]; 1016 | if (ud.id === id_) 1017 | return ud.value; 1018 | } 1019 | return null; 1020 | }; 1021 | UserData.prototype.getUserDataTargetById = function (id_) { 1022 | if (this._userDataBodys == null) 1023 | return null; 1024 | for (var _i = 0, _a = this._userDataBodys; _i < _a.length; _i++) { 1025 | var ud = _a[_i]; 1026 | if (ud.id === id_) 1027 | return ud.target; 1028 | } 1029 | return null; 1030 | }; 1031 | UserData.prototype.getUserDataBodyById = function (id_) { 1032 | if (this._userDataBodys == null) 1033 | return null; 1034 | for (var _i = 0, _a = this._userDataBodys; _i < _a.length; _i++) { 1035 | var ud = _a[_i]; 1036 | if (ud.id === id_) 1037 | return ud; 1038 | } 1039 | return null; 1040 | }; 1041 | return UserData; 1042 | }()); 1043 | LIVE2DCUBISMFRAMEWORK.UserData = UserData; 1044 | var UserDataBuilder = (function () { 1045 | function UserDataBuilder() { 1046 | } 1047 | UserDataBuilder.prototype.setTarget = function (value) { 1048 | this._target = value; 1049 | return this; 1050 | }; 1051 | UserDataBuilder.prototype.setUserData3Json = function (value) { 1052 | return this._userData3Json = value; 1053 | }; 1054 | UserDataBuilder.prototype.build = function () { 1055 | return UserData._fromUserData3Json(this._target, this._userData3Json); 1056 | }; 1057 | return UserDataBuilder; 1058 | }()); 1059 | LIVE2DCUBISMFRAMEWORK.UserDataBuilder = UserDataBuilder; 1060 | var UserDataBody = (function () { 1061 | function UserDataBody(target, id, value) { 1062 | this.target = target; 1063 | this.id = id; 1064 | this.value = value; 1065 | } 1066 | return UserDataBody; 1067 | }()); 1068 | LIVE2DCUBISMFRAMEWORK.UserDataBody = UserDataBody; 1069 | var UserDataTargetType; 1070 | (function (UserDataTargetType) { 1071 | UserDataTargetType[UserDataTargetType["UNKNOWN"] = 0] = "UNKNOWN"; 1072 | UserDataTargetType[UserDataTargetType["ArtMesh"] = 1] = "ArtMesh"; 1073 | })(UserDataTargetType || (UserDataTargetType = {})); 1074 | var Groups = (function () { 1075 | function Groups(model3Json) { 1076 | var _this = this; 1077 | if (typeof (model3Json['Groups']) !== "undefined") { 1078 | this._groupBodys = new Array(); 1079 | model3Json['Groups'].forEach(function (u) { 1080 | _this._groupBodys.push(new GroupBody(u['Target'], u['Name'], u['Ids'])); 1081 | }); 1082 | } 1083 | else { 1084 | this._groupBodys = null; 1085 | } 1086 | } 1087 | Object.defineProperty(Groups.prototype, "data", { 1088 | get: function () { 1089 | if (this._groupBodys == null) 1090 | return null; 1091 | return this._groupBodys; 1092 | }, 1093 | enumerable: true, 1094 | configurable: true 1095 | }); 1096 | Groups.fromModel3Json = function (model3Json) { 1097 | return new Groups(model3Json); 1098 | }; 1099 | Groups.prototype.getGroupById = function (targetId) { 1100 | if (this._groupBodys != null) { 1101 | for (var _i = 0, _a = this._groupBodys; _i < _a.length; _i++) { 1102 | var body = _a[_i]; 1103 | if (body.name === targetId) 1104 | return body; 1105 | } 1106 | } 1107 | return null; 1108 | }; 1109 | return Groups; 1110 | }()); 1111 | LIVE2DCUBISMFRAMEWORK.Groups = Groups; 1112 | var GroupBody = (function () { 1113 | function GroupBody(target, name, ids) { 1114 | this.target = target; 1115 | this.name = name; 1116 | this.ids = ids; 1117 | } 1118 | return GroupBody; 1119 | }()); 1120 | LIVE2DCUBISMFRAMEWORK.GroupBody = GroupBody; 1121 | })(LIVE2DCUBISMFRAMEWORK || (LIVE2DCUBISMFRAMEWORK = {})); 1122 | 1123 | -------------------------------------------------------------------------------- /js/live2dcubismpixi.js: -------------------------------------------------------------------------------- 1 | var __extends = (this && this.__extends) || (function () { 2 | var extendStatics = function (d, b) { 3 | extendStatics = Object.setPrototypeOf || 4 | ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || 5 | function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; 6 | return extendStatics(d, b); 7 | }; 8 | return function (d, b) { 9 | extendStatics(d, b); 10 | function __() { this.constructor = d; } 11 | d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 12 | }; 13 | })(); 14 | var LIVE2DCUBISMPIXI; 15 | (function (LIVE2DCUBISMPIXI) { 16 | var Model = (function (_super) { 17 | __extends(Model, _super); 18 | function Model(coreModel, textures, animator, physicsRig, userData, groups) { 19 | var _this = _super.call(this) || this; 20 | _this._coreModel = coreModel; 21 | _this._textures = textures; 22 | _this._animator = animator; 23 | _this._physicsRig = physicsRig; 24 | _this._userData = userData; 25 | _this._groups = groups; 26 | _this._animator.groups = _this._groups; 27 | if (_this._coreModel == null) { 28 | return _this; 29 | } 30 | _this._meshes = new Array(_this._coreModel.drawables.ids.length); 31 | for (var m = 0; m < _this._meshes.length; ++m) { 32 | var uvs = _this._coreModel.drawables.vertexUvs[m].slice(0, _this._coreModel.drawables.vertexUvs[m].length); 33 | for (var v = 1; v < uvs.length; v += 2) { 34 | uvs[v] = 1 - uvs[v]; 35 | } 36 | _this._meshes[m] = new CubismMesh(textures[_this._coreModel.drawables.textureIndices[m]], _this._coreModel.drawables.vertexPositions[m], uvs, _this._coreModel.drawables.indices[m], PIXI.DRAW_MODES.TRIANGLES); 37 | _this._meshes[m].name = _this._coreModel.drawables.ids[m]; 38 | _this._meshes[m].scale.y *= -1; 39 | _this._meshes[m].isCulling = !Live2DCubismCore.Utils.hasIsDoubleSidedBit(_this._coreModel.drawables.constantFlags[m]); 40 | if (Live2DCubismCore.Utils.hasBlendAdditiveBit(_this._coreModel.drawables.constantFlags[m])) { 41 | if (_this._coreModel.drawables.maskCounts[m] > 0) { 42 | var addFilter = new PIXI.Filter(); 43 | addFilter.blendMode = PIXI.BLEND_MODES.ADD; 44 | _this._meshes[m].filters = [addFilter]; 45 | } 46 | else { 47 | _this._meshes[m].blendMode = PIXI.BLEND_MODES.ADD; 48 | } 49 | } 50 | else if (Live2DCubismCore.Utils.hasBlendMultiplicativeBit(_this._coreModel.drawables.constantFlags[m])) { 51 | if (_this._coreModel.drawables.maskCounts[m] > 0) { 52 | var multiplyFilter = new PIXI.Filter(); 53 | multiplyFilter.blendMode = PIXI.BLEND_MODES.MULTIPLY; 54 | _this._meshes[m].filters = [multiplyFilter]; 55 | } 56 | else { 57 | _this._meshes[m].blendMode = PIXI.BLEND_MODES.MULTIPLY; 58 | } 59 | } 60 | _this.addChild(_this._meshes[m]); 61 | } 62 | ; 63 | _this._maskSpriteContainer = new MaskSpriteContainer(coreModel, _this); 64 | return _this; 65 | } 66 | Object.defineProperty(Model.prototype, "parameters", { 67 | get: function () { 68 | return this._coreModel.parameters; 69 | }, 70 | enumerable: true, 71 | configurable: true 72 | }); 73 | Object.defineProperty(Model.prototype, "parts", { 74 | get: function () { 75 | return this._coreModel.parts; 76 | }, 77 | enumerable: true, 78 | configurable: true 79 | }); 80 | Object.defineProperty(Model.prototype, "drawables", { 81 | get: function () { 82 | return this._coreModel.drawables; 83 | }, 84 | enumerable: true, 85 | configurable: true 86 | }); 87 | Object.defineProperty(Model.prototype, "canvasinfo", { 88 | get: function () { 89 | return this._coreModel.canvasinfo; 90 | }, 91 | enumerable: true, 92 | configurable: true 93 | }); 94 | Object.defineProperty(Model.prototype, "textures", { 95 | get: function () { 96 | return this._textures; 97 | }, 98 | enumerable: true, 99 | configurable: true 100 | }); 101 | Object.defineProperty(Model.prototype, "animator", { 102 | get: function () { 103 | return this._animator; 104 | }, 105 | enumerable: true, 106 | configurable: true 107 | }); 108 | Object.defineProperty(Model.prototype, "userData", { 109 | get: function () { 110 | return this._userData; 111 | }, 112 | enumerable: true, 113 | configurable: true 114 | }); 115 | Object.defineProperty(Model.prototype, "meshes", { 116 | get: function () { 117 | return this._meshes; 118 | }, 119 | enumerable: true, 120 | configurable: true 121 | }); 122 | Object.defineProperty(Model.prototype, "masks", { 123 | get: function () { 124 | return this._maskSpriteContainer; 125 | }, 126 | enumerable: true, 127 | configurable: true 128 | }); 129 | Object.defineProperty(Model.prototype, "groups", { 130 | get: function () { 131 | return this._groups; 132 | }, 133 | enumerable: true, 134 | configurable: true 135 | }); 136 | Model.prototype.update = function (delta) { 137 | var _this = this; 138 | var deltaTime = 0.016 * delta; 139 | this._animator.updateAndEvaluate(deltaTime); 140 | if (this._physicsRig) { 141 | this._physicsRig.updateAndEvaluate(deltaTime); 142 | } 143 | this._coreModel.update(); 144 | var sort = false; 145 | for (var m = 0; m < this._meshes.length; ++m) { 146 | this._meshes[m].alpha = this._coreModel.drawables.opacities[m]; 147 | this._meshes[m].visible = Live2DCubismCore.Utils.hasIsVisibleBit(this._coreModel.drawables.dynamicFlags[m]); 148 | if (Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(this._coreModel.drawables.dynamicFlags[m])) { 149 | this._meshes[m].vertices = this._coreModel.drawables.vertexPositions[m]; 150 | this._meshes[m].dirtyVertex = true; 151 | } 152 | if (Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(this._coreModel.drawables.dynamicFlags[m])) { 153 | sort = true; 154 | } 155 | } 156 | if (sort) { 157 | this.children.sort(function (a, b) { 158 | var aIndex = _this._meshes.indexOf(a); 159 | var bIndex = _this._meshes.indexOf(b); 160 | var aRenderOrder = _this._coreModel.drawables.renderOrders[aIndex]; 161 | var bRenderOrder = _this._coreModel.drawables.renderOrders[bIndex]; 162 | return aRenderOrder - bRenderOrder; 163 | }); 164 | } 165 | this._coreModel.drawables.resetDynamicFlags(); 166 | }; 167 | Model.prototype.destroy = function (options) { 168 | if (this._coreModel != null) { 169 | this._coreModel.release(); 170 | } 171 | _super.prototype.destroy.call(this, options); 172 | this.masks.destroy(); 173 | this._meshes.forEach(function (m) { 174 | m.destroy(); 175 | }); 176 | if (options == true || options.texture) { 177 | this._textures.forEach(function (t) { 178 | t.destroy(); 179 | }); 180 | } 181 | }; 182 | Model.prototype.getModelMeshById = function (id) { 183 | if (this._meshes == null) 184 | return null; 185 | for (var _i = 0, _a = this._meshes; _i < _a.length; _i++) { 186 | var mesh = _a[_i]; 187 | if (mesh.name === id) 188 | return mesh; 189 | } 190 | return null; 191 | }; 192 | Model.prototype.addParameterValueById = function (id, value) { 193 | var p = this._coreModel.parameters.ids.indexOf(id); 194 | if (p == -1) { 195 | return; 196 | } 197 | this._coreModel.parameters.values[p] = this._coreModel.parameters.values[p] + value; 198 | }; 199 | Model._create = function (coreModel, textures, animator, physicsRig, userData, groups) { 200 | if (physicsRig === void 0) { physicsRig = null; } 201 | if (userData === void 0) { userData = null; } 202 | if (groups === void 0) { groups = null; } 203 | var model = new Model(coreModel, textures, animator, physicsRig, userData, groups); 204 | if (!model.isValid) { 205 | model.destroy(); 206 | return null; 207 | } 208 | return model; 209 | }; 210 | Object.defineProperty(Model.prototype, "isValid", { 211 | get: function () { 212 | return this._coreModel != null; 213 | }, 214 | enumerable: true, 215 | configurable: true 216 | }); 217 | return Model; 218 | }(PIXI.Container)); 219 | LIVE2DCUBISMPIXI.Model = Model; 220 | var MaskSpriteContainer = (function (_super) { 221 | __extends(MaskSpriteContainer, _super); 222 | function MaskSpriteContainer(coreModel, pixiModel) { 223 | var _this = _super.call(this) || this; 224 | _this._maskShaderVertSrc = new String("\n attribute vec2 aVertexPosition;\n attribute vec2 aTextureCoord;\n uniform mat3 projectionMatrix;\n varying vec2 vTextureCoord;\n void main(void){\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n }\n "); 225 | _this._maskShaderFragSrc = new String("\n varying vec2 vTextureCoord;\n uniform sampler2D uSampler;\n void main(void){\n vec4 c = texture2D(uSampler, vTextureCoord);\n c.r = c.a;\n c.g = 0.0;\n c.b = 0.0;\n gl_FragColor = c;\n }\n "); 226 | _this._maskShader = new PIXI.Filter(_this._maskShaderVertSrc.toString(), _this._maskShaderFragSrc.toString()); 227 | var _maskCounts = coreModel.drawables.maskCounts; 228 | var _maskRelationList = coreModel.drawables.masks; 229 | _this._maskMeshContainers = new Array(); 230 | _this._maskTextures = new Array(); 231 | _this._maskSprites = new Array(); 232 | for (var m = 0; m < pixiModel.meshes.length; ++m) { 233 | if (_maskCounts[m] > 0) { 234 | var newContainer = new PIXI.Container; 235 | for (var n = 0; n < _maskRelationList[m].length; ++n) { 236 | var meshMaskID = coreModel.drawables.masks[m][n]; 237 | var maskMesh = new CubismMesh(pixiModel.meshes[meshMaskID].texture, pixiModel.meshes[meshMaskID].vertices, pixiModel.meshes[meshMaskID].uvs, pixiModel.meshes[meshMaskID].indices, PIXI.DRAW_MODES.TRIANGLES); 238 | maskMesh.name = pixiModel.meshes[meshMaskID].name; 239 | maskMesh.transform = pixiModel.meshes[meshMaskID].transform; 240 | maskMesh.worldTransform = pixiModel.meshes[meshMaskID].worldTransform; 241 | maskMesh.localTransform = pixiModel.meshes[meshMaskID].localTransform; 242 | maskMesh.isCulling = pixiModel.meshes[meshMaskID].isCulling; 243 | maskMesh.isMaskMesh = true; 244 | maskMesh.filters = [_this._maskShader]; 245 | newContainer.addChild(maskMesh); 246 | } 247 | newContainer.transform = pixiModel.transform; 248 | newContainer.worldTransform = pixiModel.worldTransform; 249 | newContainer.localTransform = pixiModel.localTransform; 250 | _this._maskMeshContainers.push(newContainer); 251 | var newTexture = PIXI.RenderTexture.create(0, 0); 252 | _this._maskTextures.push(newTexture); 253 | var newSprite = new PIXI.Sprite(newTexture); 254 | _this._maskSprites.push(newSprite); 255 | _this.addChild(newSprite); 256 | pixiModel.meshes[m].mask = newSprite; 257 | } 258 | } 259 | return _this; 260 | } 261 | Object.defineProperty(MaskSpriteContainer.prototype, "maskSprites", { 262 | get: function () { 263 | return this._maskSprites; 264 | }, 265 | enumerable: true, 266 | configurable: true 267 | }); 268 | Object.defineProperty(MaskSpriteContainer.prototype, "maskMeshes", { 269 | get: function () { 270 | return this._maskMeshContainers; 271 | }, 272 | enumerable: true, 273 | configurable: true 274 | }); 275 | MaskSpriteContainer.prototype.destroy = function (options) { 276 | this._maskSprites.forEach(function (m) { 277 | m.destroy(); 278 | }); 279 | this._maskTextures.forEach(function (m) { 280 | m.destroy(); 281 | }); 282 | this._maskMeshContainers.forEach(function (m) { 283 | m.destroy(); 284 | }); 285 | this._maskShader = null; 286 | }; 287 | MaskSpriteContainer.prototype.update = function (appRenderer) { 288 | for (var m = 0; m < this._maskSprites.length; ++m) { 289 | appRenderer.render(this._maskMeshContainers[m], this._maskTextures[m], true, null, false); 290 | } 291 | }; 292 | MaskSpriteContainer.prototype.resize = function (viewWidth, viewHeight) { 293 | for (var m = 0; m < this._maskTextures.length; ++m) { 294 | this._maskTextures[m].resize(viewWidth, viewHeight, false); 295 | } 296 | }; 297 | return MaskSpriteContainer; 298 | }(PIXI.Container)); 299 | LIVE2DCUBISMPIXI.MaskSpriteContainer = MaskSpriteContainer; 300 | var ModelBuilder = (function () { 301 | function ModelBuilder() { 302 | this._textures = new Array(); 303 | this._timeScale = 1; 304 | this._animatorBuilder = new LIVE2DCUBISMFRAMEWORK.AnimatorBuilder(); 305 | } 306 | ModelBuilder.prototype.setMoc = function (value) { 307 | this._moc = value; 308 | return this; 309 | }; 310 | ModelBuilder.prototype.setTimeScale = function (value) { 311 | this._timeScale = value; 312 | return this; 313 | }; 314 | ModelBuilder.prototype.setPhysics3Json = function (value) { 315 | if (!this._physicsRigBuilder) { 316 | this._physicsRigBuilder = new LIVE2DCUBISMFRAMEWORK.PhysicsRigBuilder(); 317 | } 318 | this._physicsRigBuilder.setPhysics3Json(value); 319 | return this; 320 | }; 321 | ModelBuilder.prototype.setUserData3Json = function (value) { 322 | if (!this._userDataBuilder) { 323 | this._userDataBuilder = new LIVE2DCUBISMFRAMEWORK.UserDataBuilder(); 324 | } 325 | this._userDataBuilder.setUserData3Json(value); 326 | return this; 327 | }; 328 | ModelBuilder.prototype.addTexture = function (index, texture) { 329 | this._textures.splice(index, 0, texture); 330 | return this; 331 | }; 332 | ModelBuilder.prototype.addAnimatorLayer = function (name, blender, weight) { 333 | if (blender === void 0) { blender = LIVE2DCUBISMFRAMEWORK.BuiltinAnimationBlenders.OVERRIDE; } 334 | if (weight === void 0) { weight = 1; } 335 | this._animatorBuilder.addLayer(name, blender, weight); 336 | return this; 337 | }; 338 | ModelBuilder.prototype.addGroups = function (groups) { 339 | this._groups = groups; 340 | return this; 341 | }; 342 | ModelBuilder.prototype.buildFromModel3Json = function (loader, model3Obj, callbackFunc) { 343 | var _this = this; 344 | console.log(model3Obj); 345 | var model3URL = model3Obj.url; 346 | var modelDir = model3URL.substring(0, model3URL.lastIndexOf("/") + 1); 347 | var textureCount = 0; 348 | if (typeof (model3Obj.data['FileReferences']['Moc']) !== "undefined") 349 | loader.add('moc', modelDir + model3Obj.data['FileReferences']['Moc'], { xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.BUFFER }); 350 | if (typeof (model3Obj.data['FileReferences']['Textures']) !== "undefined") { 351 | model3Obj.data['FileReferences']['Textures'].forEach(function (element) { 352 | loader.add('texture' + textureCount, modelDir + element); 353 | textureCount++; 354 | }); 355 | } 356 | if (typeof (model3Obj.data['FileReferences']['Physics']) !== "undefined") 357 | loader.add('physics', modelDir + model3Obj.data['FileReferences']['Physics'], { xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.JSON }); 358 | if (typeof (model3Obj.data['FileReferences']['UserData']) !== "undefined") 359 | loader.add('userdata', modelDir + model3Obj.data['FileReferences']['UserData'], { xhrType: PIXI.loaders.Resource.XHR_RESPONSE_TYPE.JSON }); 360 | if (typeof (model3Obj.data['Groups'] !== "undefined")) 361 | this._groups = LIVE2DCUBISMFRAMEWORK.Groups.fromModel3Json(model3Obj.data); 362 | loader.load(function (loader, resources) { 363 | if (typeof (resources['moc']) !== "undefined") 364 | _this.setMoc(Live2DCubismCore.Moc.fromArrayBuffer(resources['moc'].data)); 365 | if (typeof (resources['texture' + 0]) !== "undefined") { 366 | for (var i = 0; i < textureCount; i++) 367 | _this.addTexture(i, resources['texture' + i].texture); 368 | } 369 | if (typeof (resources['physics']) !== "undefined") 370 | _this.setPhysics3Json(resources['physics'].data); 371 | if (typeof (resources['userdata']) !== "undefined") 372 | _this.setUserData3Json(resources['userdata'].data); 373 | var model = _this.build(); 374 | callbackFunc(model); 375 | }); 376 | }; 377 | ModelBuilder.prototype.build = function () { 378 | var coreModel = Live2DCubismCore.Model.fromMoc(this._moc); 379 | if (coreModel == null) { 380 | return null; 381 | } 382 | var animator = this._animatorBuilder 383 | .setTarget(coreModel) 384 | .setTimeScale(this._timeScale) 385 | .build(); 386 | var physicsRig = null; 387 | if (this._physicsRigBuilder) { 388 | physicsRig = this._physicsRigBuilder 389 | .setTarget(coreModel) 390 | .setTimeScale(this._timeScale) 391 | .build(); 392 | } 393 | var userData = null; 394 | if (this._userDataBuilder) { 395 | userData = this._userDataBuilder 396 | .setTarget(coreModel) 397 | .build(); 398 | } 399 | return Model._create(coreModel, this._textures, animator, physicsRig, userData, this._groups); 400 | }; 401 | return ModelBuilder; 402 | }()); 403 | LIVE2DCUBISMPIXI.ModelBuilder = ModelBuilder; 404 | var CubismMesh = (function (_super) { 405 | __extends(CubismMesh, _super); 406 | function CubismMesh() { 407 | var _this = _super !== null && _super.apply(this, arguments) || this; 408 | _this.isCulling = false; 409 | _this.isMaskMesh = false; 410 | return _this; 411 | } 412 | CubismMesh.prototype._renderWebGL = function (renderer) { 413 | if (this.isMaskMesh === true) 414 | renderer.state.setFrontFace(1); 415 | else 416 | renderer.state.setFrontFace(0); 417 | if (this.isCulling === true) 418 | renderer.state.setCullFace(1); 419 | else 420 | renderer.state.setCullFace(0); 421 | _super.prototype._renderWebGL.call(this, renderer); 422 | renderer.state.setFrontFace(0); 423 | }; 424 | return CubismMesh; 425 | }(PIXI.mesh.Mesh)); 426 | LIVE2DCUBISMPIXI.CubismMesh = CubismMesh; 427 | })(LIVE2DCUBISMPIXI || (LIVE2DCUBISMPIXI = {})); 428 | -------------------------------------------------------------------------------- /js/main.js: -------------------------------------------------------------------------------- 1 | class Viewer { 2 | constructor (config) { 3 | let width = config.width || 800 4 | let height = config.height || 600 5 | let role = config.role 6 | let left = config.left //|| '0px' 7 | let top = config.top //|| '0px' 8 | let right = config.right //|| '0px' 9 | let bottom = config.bottom //|| '0px' 10 | let bg = config.background 11 | let opa = config.opacity 12 | let mobile = config.mobile 13 | let _ = this 14 | 15 | if(!mobile){ 16 | if(this.isMobile()) return; 17 | } 18 | this.l2d = new L2D(config.basePath); 19 | this.canvas = document.getElementById("L2dCanvas"); 20 | this.l2d.load(role, this); 21 | 22 | this.app = new PIXI.Application({ 23 | width: width, 24 | height: height, 25 | transparent: true, 26 | antialias: true // 抗锯齿 27 | }); 28 | 29 | this.canvas.appendChild(this.app.view); 30 | this.canvas.style.position = 'fixed' 31 | if(bg){ 32 | this.canvas.style.background = `url("${bg}")` 33 | this.canvas.style.backgroundSize = 'cover' 34 | } 35 | if(opa) 36 | this.canvas.style.opacity = opa 37 | if(top) 38 | this.canvas.style.top = top 39 | if(right) 40 | this.canvas.style.right = right 41 | if(bottom) 42 | this.canvas.style.bottom = bottom 43 | if(left) 44 | this.canvas.style.left = left 45 | 46 | this.app.ticker.add((deltaTime) => { 47 | if (!this.model) { 48 | return; 49 | } 50 | 51 | this.model.update(_,deltaTime); 52 | this.model.masks.update(this.app.renderer); 53 | }); 54 | //窗口大小改变时重绘 55 | window.onresize = (event) => { 56 | if (event === void 0) { event = null; } 57 | 58 | this.app.view.style.width = width + "px"; 59 | this.app.view.style.height = height + "px"; 60 | this.app.renderer.resize(width, height); 61 | 62 | if (this.model) { 63 | this.model.position = new PIXI.Point((width * 0.5), (height * 0.5)); 64 | this.model.scale = new PIXI.Point((this.model.position.x * 0.06), (this.model.position.x * 0.06)); 65 | this.model.masks.resize(this.app.view.width, this.app.view.height); 66 | 67 | } 68 | 69 | }; 70 | this.isClick = false; 71 | this.app.view.addEventListener('mousedown', (event) => { 72 | this.isClick = true; 73 | }); 74 | 75 | this.app.view.addEventListener('mousemove', (event) => { 76 | this.isClick = false; 77 | if (this.model) { 78 | this.model.inDrag = true; 79 | } 80 | 81 | if (this.model) { 82 | let mouse_x = this.model.position.x - event.offsetX; 83 | let mouse_y = this.model.position.y - event.offsetY; 84 | this.model.pointerX = -mouse_x / this.app.view.height; 85 | this.model.pointerY = -mouse_y / this.app.view.width; 86 | } 87 | }); 88 | this.app.view.addEventListener('mouseup', (event) => { 89 | if (!this.model) { 90 | return; 91 | } 92 | this.isClick = true; 93 | let templatestr = '' 94 | let i = 0 95 | console.log(this.l2d.TapAreas); 96 | if (this.l2d.TapAreas){ 97 | for(let item of this.l2d.TapAreas){ 98 | console.log(item) 99 | templatestr=templatestr+(i==0?"if":"else if") 100 | if (item[0]){ 101 | templatestr=templatestr+ 102 | `(this.isHit("`+item[0]+`", event.offsetX, event.offsetY)) { 103 | this.startAnimation("`+item[1][0]+`", "base") 104 | }` 105 | } 106 | i++ 107 | } 108 | } 109 | eval(templatestr); 110 | this.isClick = false; 111 | this.model.inDrag = false; 112 | }); 113 | console.log("Init finished.") 114 | } 115 | //每次载入模型时触发 116 | changeCanvas (model) { 117 | this.app.stage.removeChildren(); 118 | 119 | model.motions.forEach((value, key) => { 120 | if (key != "effect") { 121 | let btn = document.createElement("button"); 122 | let label = document.createTextNode(key); 123 | btn.appendChild(label); 124 | btn.className = "btnGenericText"; 125 | btn.addEventListener("click", () => { 126 | this.startAnimation(key, "base"); 127 | }); 128 | } 129 | }); 130 | 131 | this.model = model; 132 | this.model.update = this.onUpdate; // HACK: use hacked update fn for drag support 133 | this.model.animator.addLayer("base", LIVE2DCUBISMFRAMEWORK.BuiltinAnimationBlenders.OVERRIDE, 1); 134 | 135 | this.app.stage.addChild(this.model); 136 | this.app.stage.addChild(this.model.masks); 137 | //如果有载入动画,触发载入动画 138 | if(this.l2d.TriggerMotions.get('Start')){ 139 | this.startAnimation(this.l2d.TriggerMotions.get('Start')[0], "base") 140 | } 141 | 142 | window.onresize(); 143 | } 144 | // 145 | onUpdate (_,delta) { 146 | let deltaTime = 0.016 * delta; 147 | if (!this.animator.isPlaying) { 148 | let m = this.motions.get("idle"); 149 | console.log( _.l2d.TriggerMotions.get('Idle')[0]); 150 | this.animator.getLayer("base").play(m); 151 | } 152 | this._animator.updateAndEvaluate(deltaTime); 153 | 154 | if (this.inDrag) { 155 | this.addParameterValueById("ParamAngleX", this.pointerX * 30); 156 | this.addParameterValueById("ParamAngleY", -this.pointerY * 30); 157 | this.addParameterValueById("ParamBodyAngleX", this.pointerX * 10); 158 | this.addParameterValueById("ParamBodyAngleY", -this.pointerY * 10); 159 | this.addParameterValueById("ParamEyeBallX", this.pointerX); 160 | this.addParameterValueById("ParamEyeBallY", -this.pointerY); 161 | } 162 | 163 | if (this._physicsRig) { 164 | this._physicsRig.updateAndEvaluate(deltaTime); 165 | } 166 | 167 | this._coreModel.update(); 168 | 169 | let sort = false; 170 | for (let m = 0; m < this._meshes.length; ++m) { 171 | this._meshes[m].alpha = this._coreModel.drawables.opacities[m]; 172 | this._meshes[m].visible = Live2DCubismCore.Utils.hasIsVisibleBit(this._coreModel.drawables.dynamicFlags[m]); 173 | if (Live2DCubismCore.Utils.hasVertexPositionsDidChangeBit(this._coreModel.drawables.dynamicFlags[m])) { 174 | this._meshes[m].vertices = this._coreModel.drawables.vertexPositions[m]; 175 | this._meshes[m].dirtyVertex = true; 176 | } 177 | if (Live2DCubismCore.Utils.hasRenderOrderDidChangeBit(this._coreModel.drawables.dynamicFlags[m])) { 178 | sort = true; 179 | } 180 | } 181 | 182 | if (sort) { 183 | this.children.sort((a, b) => { 184 | let aIndex = this._meshes.indexOf(a); 185 | let bIndex = this._meshes.indexOf(b); 186 | let aRenderOrder = this._coreModel.drawables.renderOrders[aIndex]; 187 | let bRenderOrder = this._coreModel.drawables.renderOrders[bIndex]; 188 | 189 | return aRenderOrder - bRenderOrder; 190 | }); 191 | } 192 | 193 | this._coreModel.drawables.resetDynamicFlags(); 194 | } 195 | 196 | startAnimation (motionId, layerId) { 197 | if (!this.model) { 198 | return; 199 | } 200 | let m = this.model.motions.get(motionId); 201 | 202 | if (!m) { 203 | return; 204 | } 205 | 206 | let l = this.model.animator.getLayer(layerId); 207 | if (!l) { 208 | return; 209 | } 210 | 211 | l.play(m); 212 | } 213 | 214 | isHit (id, posX, posY) { 215 | if (!this.model) { 216 | return false; 217 | } 218 | let _meshesname = [] 219 | this.model._meshes.forEach((e)=>{ 220 | _meshesname.push(e.name) 221 | }) 222 | let m = this.model.getModelMeshById(id); 223 | if (!m) { 224 | return false; 225 | } 226 | 227 | const vertexOffset = 0; 228 | const vertexStep = 2; 229 | const vertices = m.vertices; 230 | 231 | let left = vertices[0]; 232 | let right = vertices[0]; 233 | let top = vertices[1]; 234 | let bottom = vertices[1]; 235 | 236 | for (let i = 1; i < 4; ++i) { 237 | let x = vertices[vertexOffset + i * vertexStep]; 238 | let y = vertices[vertexOffset + i * vertexStep + 1]; 239 | 240 | if (x < left) { 241 | left = x; 242 | } 243 | if (x > right) { 244 | right = x; 245 | } 246 | if (y < top) { 247 | top = y; 248 | } 249 | if (y > bottom) { 250 | bottom = y; 251 | } 252 | } 253 | 254 | let mouse_x = m.worldTransform.tx - posX; 255 | let mouse_y = m.worldTransform.ty - posY; 256 | let tx = -mouse_x / m.worldTransform.a; 257 | let ty = -mouse_y / m.worldTransform.d; 258 | 259 | return ((left <= tx) && (tx <= right) && (top <= ty) && (ty <= bottom)); 260 | } 261 | 262 | isMobile(){ 263 | var WIN = window; 264 | var LOC = WIN["location"]; 265 | var NA = WIN.navigator; 266 | var UA = NA.userAgent.toLowerCase(); 267 | 268 | function test(needle) { 269 | return needle.test(UA); 270 | } 271 | var IsAndroid = test(/android|htc/) || /linux/i.test(NA.platform + ""); 272 | var IsIPhone = !IsAndroid && test(/ipod|iphone/); 273 | var IsWinPhone = test(/windows phone/); 274 | 275 | var device = { 276 | IsAndroid: IsAndroid, 277 | IsIPhone: IsIPhone, 278 | IsWinPhone: IsWinPhone 279 | } 280 | var documentElement = WIN.document.documentElement; 281 | for (var i in device) { 282 | if (device[i]) { 283 | documentElement.className += " " + i.replace("Is", "").toLowerCase(); 284 | } 285 | } 286 | return device.IsAndroid || device.IsIPhone || device.IsWinPhone 287 | } 288 | 289 | } --------------------------------------------------------------------------------