@starcried/starlite-inochi2d 0.0.0-stage → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +25 -0
- package/README.md +41 -2
- package/THIRD_PARTY_LICENSES.txt +243 -0
- package/THIRD_PARTY_NOTICES.md +12 -0
- package/dist/ambient.d.ts +9 -0
- package/dist/ambient.d.ts.map +1 -0
- package/dist/ambient.js +30 -0
- package/dist/ambient.js.map +1 -0
- package/dist/animation.d.ts +23 -0
- package/dist/animation.d.ts.map +1 -0
- package/dist/animation.js +211 -0
- package/dist/animation.js.map +1 -0
- package/dist/config.d.ts +8 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +453 -0
- package/dist/config.js.map +1 -0
- package/dist/controller.d.ts +3 -0
- package/dist/controller.d.ts.map +1 -0
- package/dist/controller.js +652 -0
- package/dist/controller.js.map +1 -0
- package/dist/dependencies.d.ts +3 -0
- package/dist/dependencies.d.ts.map +1 -0
- package/dist/dependencies.js +70 -0
- package/dist/dependencies.js.map +1 -0
- package/dist/dialogue.d.ts +2 -0
- package/dist/dialogue.d.ts.map +1 -0
- package/dist/dialogue.js +246 -0
- package/dist/dialogue.js.map +1 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +8 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/inochi2d.wasm +0 -0
- package/dist/hit-mask.d.ts +2 -0
- package/dist/hit-mask.d.ts.map +1 -0
- package/dist/hit-mask.js +66 -0
- package/dist/hit-mask.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/motion.d.ts +20 -0
- package/dist/motion.d.ts.map +1 -0
- package/dist/motion.js +103 -0
- package/dist/motion.js.map +1 -0
- package/dist/official/renderer.d.ts +18 -0
- package/dist/official/renderer.d.ts.map +1 -0
- package/dist/official/renderer.js +839 -0
- package/dist/official/renderer.js.map +1 -0
- package/dist/official/runtime.d.ts +24 -0
- package/dist/official/runtime.d.ts.map +1 -0
- package/dist/official/runtime.js +175 -0
- package/dist/official/runtime.js.map +1 -0
- package/dist/official/sdk.d.ts +66 -0
- package/dist/official/sdk.d.ts.map +1 -0
- package/dist/official/sdk.js +595 -0
- package/dist/official/sdk.js.map +1 -0
- package/dist/types.d.ts +269 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/wasm.d.ts +3 -0
- package/dist/wasm.d.ts.map +1 -0
- package/dist/wasm.js +3 -0
- package/dist/wasm.js.map +1 -0
- package/dist/widget.css +122 -0
- package/package.json +49 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
BSD 2-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, StarCried
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
17
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
18
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
19
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
20
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
21
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
22
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
23
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
24
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
25
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,42 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @starcried/starlite-inochi2d
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
StarLite 的 Inochi2D WebGL2 后端,使用可复现构建的官方 D SDK,支持模型内动作、参数、物理和公共气泡。与 Inochi2D 官方项目无隶属关系。
|
|
4
|
+
|
|
5
|
+
在 Node.js 22.12+ 项目中安装 alpha 版本:
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install @starcried/starlite-inochi2d@alpha
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## 挂载
|
|
12
|
+
|
|
13
|
+
先用[模型准备流程](https://github.com/StarCried/starlite/blob/main/docs/configuration.md#inochi2d-专用配置与-cli)检查有权使用的 `.inp`/`.inx`。页面提供 `<div id="starlite"></div>`,在使用打包工具的网页项目中:
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import { mountInochi2DWidget } from "@starcried/starlite-inochi2d";
|
|
17
|
+
import "@starcried/starlite-inochi2d/widget.css";
|
|
18
|
+
|
|
19
|
+
const host = document.querySelector("#starlite");
|
|
20
|
+
if (!host) throw new Error("Missing StarLite host");
|
|
21
|
+
const response = await fetch("/models/manifest.json");
|
|
22
|
+
if (!response.ok) throw new Error("Cannot load model manifest");
|
|
23
|
+
const manifest = await response.json();
|
|
24
|
+
if (!manifest.animations) throw new Error("Model manifest has no animations");
|
|
25
|
+
|
|
26
|
+
const controller = await mountInochi2DWidget(host, {
|
|
27
|
+
model: "/models/puppet.inp",
|
|
28
|
+
fallback: "/models/puppet.png",
|
|
29
|
+
animations: manifest.animations,
|
|
30
|
+
render: { fps: 30, maxDevicePixelRatio: 1.25, autoFit: true },
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
动作使用模型中精确且区分大小写的名称;不会为未知模型生成点击动作。公共播放和生命周期接口与 VRM 相同,`setParameter()` 仍为 Inochi2D 专用能力。页面组件卸载时调用 `controller.destroy()` 释放资源。
|
|
35
|
+
|
|
36
|
+
## 进阶
|
|
37
|
+
|
|
38
|
+
[参数、动作与句库配置](https://github.com/StarCried/starlite/blob/main/docs/configuration.md) · [Hexo 插件](https://github.com/StarCried/starlite/blob/main/packages/hexo/README.md) · [模型许可](https://github.com/StarCried/starlite/blob/main/docs/model-policy.md) · [安全说明](https://github.com/StarCried/starlite/blob/main/SECURITY.md)
|
|
39
|
+
|
|
40
|
+
Alpha 面向桌面 Chrome/Edge。独立网页若要在手机上避免加载运行时,须在检查屏宽后动态导入;上例的静态导入会下载 JS。跨域模型服务需允许 CORS。
|
|
41
|
+
|
|
42
|
+
BSD-2-Clause;不包含模型或第三方动作。
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
THIRD-PARTY LICENSES FOR @starcried/starlite-inochi2d
|
|
2
|
+
|
|
3
|
+
This file is generated from the exact locked dependency sources.
|
|
4
|
+
Regenerate it with `npm run licenses:generate`.
|
|
5
|
+
|
|
6
|
+
COMPONENT INVENTORY
|
|
7
|
+
|
|
8
|
+
- inochi2d f4b4917a59419e64f2704ac7b806e2bf09bca752 | BSD-2-Clause | https://codeload.github.com/Inochi2D/inochi2d/tar.gz/f4b4917a59419e64f2704ac7b806e2bf09bca752
|
|
9
|
+
- gamut 3.5.0 | BSL-1.0+MIT | https://code.dlang.org/packages/gamut
|
|
10
|
+
- intel-intrinsics 1.14.8 | BSL-1.0 | https://code.dlang.org/packages/intel-intrinsics
|
|
11
|
+
- miniz 0.0.4 | MIT | https://code.dlang.org/packages/miniz
|
|
12
|
+
- nulib 0.4.7 | BSL-1.0 | https://code.dlang.org/packages/nulib
|
|
13
|
+
- numath 0.5.0 | BSL-1.0 | https://code.dlang.org/packages/numath
|
|
14
|
+
- numem 1.6.11 | BSL-1.0 | https://code.dlang.org/packages/numem
|
|
15
|
+
- nurt 0.2.3 | BSL-1.0 | https://code.dlang.org/packages/nurt
|
|
16
|
+
- nusilly 1.0.0 | ISC | https://code.dlang.org/packages/nusilly
|
|
17
|
+
- silly 1.1.1 | ISC | https://code.dlang.org/packages/silly
|
|
18
|
+
|
|
19
|
+
LICENSE AND NOTICE TEXTS
|
|
20
|
+
|
|
21
|
+
================================================================================
|
|
22
|
+
SHA-256: 4a7040fa478f7e6503ab9905272cd93d88dc5eec7a3e911609b17091a061922b
|
|
23
|
+
Applies to:
|
|
24
|
+
- silly 1.1.1 (LICENSE)
|
|
25
|
+
|
|
26
|
+
Copyright (c) 2019, Anton Fediushin
|
|
27
|
+
|
|
28
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
29
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
30
|
+
copyright notice and this permission notice appear in all copies.
|
|
31
|
+
|
|
32
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
33
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
34
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
35
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
36
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
37
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
38
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
39
|
+
|
|
40
|
+
================================================================================
|
|
41
|
+
SHA-256: 5d9d741cd7511d68ef623a1b6e1b72a8ae0086cfc9494f913a08120dd2f48f6e
|
|
42
|
+
Applies to:
|
|
43
|
+
- nurt 0.2.3 (LICENSE)
|
|
44
|
+
|
|
45
|
+
Copyright (c) 2023-2025, Kitsunebi Games
|
|
46
|
+
Copyright (c) 2023-2025, Inochi2D Project
|
|
47
|
+
|
|
48
|
+
Boost Software License - Version 1.0 - August 17th, 2003
|
|
49
|
+
|
|
50
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
51
|
+
obtaining a copy of the software and accompanying documentation covered by
|
|
52
|
+
this license (the "Software") to use, reproduce, display, distribute,
|
|
53
|
+
execute, and transmit the Software, and to prepare derivative works of the
|
|
54
|
+
Software, and to permit third-parties to whom the Software is furnished to
|
|
55
|
+
do so, all subject to the following:
|
|
56
|
+
|
|
57
|
+
The copyright notices in the Software and this entire statement, including
|
|
58
|
+
the above license grant, this restriction and the following disclaimer,
|
|
59
|
+
must be included in all copies of the Software, in whole or in part, and
|
|
60
|
+
all derivative works of the Software, unless such copies or derivative
|
|
61
|
+
works are solely in the form of machine-executable object code generated by
|
|
62
|
+
a source language processor.
|
|
63
|
+
|
|
64
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
65
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
66
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
67
|
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
68
|
+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
69
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
70
|
+
DEALINGS IN THE SOFTWARE.
|
|
71
|
+
|
|
72
|
+
--------------------------------------------------------------------------
|
|
73
|
+
|
|
74
|
+
Sections of the source is taken from DRuntime.
|
|
75
|
+
|
|
76
|
+
Copyright (c) 2007-2025, Digital Mars
|
|
77
|
+
|
|
78
|
+
Boost Software License - Version 1.0 - August 17th, 2003
|
|
79
|
+
|
|
80
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
81
|
+
obtaining a copy of the software and accompanying documentation covered by
|
|
82
|
+
this license (the "Software") to use, reproduce, display, distribute,
|
|
83
|
+
execute, and transmit the Software, and to prepare derivative works of the
|
|
84
|
+
Software, and to permit third-parties to whom the Software is furnished to
|
|
85
|
+
do so, all subject to the following:
|
|
86
|
+
|
|
87
|
+
The copyright notices in the Software and this entire statement, including
|
|
88
|
+
the above license grant, this restriction and the following disclaimer,
|
|
89
|
+
must be included in all copies of the Software, in whole or in part, and
|
|
90
|
+
all derivative works of the Software, unless such copies or derivative
|
|
91
|
+
works are solely in the form of machine-executable object code generated by
|
|
92
|
+
a source language processor.
|
|
93
|
+
|
|
94
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
95
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
96
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
97
|
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
98
|
+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
99
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
100
|
+
DEALINGS IN THE SOFTWARE.
|
|
101
|
+
|
|
102
|
+
================================================================================
|
|
103
|
+
SHA-256: 75458e98ba16ae0526eb54a9ef8fc1005a0b16a9af3f9c8c66803422f8387d36
|
|
104
|
+
Applies to:
|
|
105
|
+
- miniz 0.0.4 (LICENSE)
|
|
106
|
+
|
|
107
|
+
MIT License
|
|
108
|
+
|
|
109
|
+
Copyright (c) 2024 Auburn Sounds
|
|
110
|
+
|
|
111
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
112
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
113
|
+
in the Software without restriction, including without limitation the rights
|
|
114
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
115
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
116
|
+
furnished to do so, subject to the following conditions:
|
|
117
|
+
|
|
118
|
+
The above copyright notice and this permission notice shall be included in all
|
|
119
|
+
copies or substantial portions of the Software.
|
|
120
|
+
|
|
121
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
122
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
123
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
124
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
125
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
126
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
127
|
+
SOFTWARE.
|
|
128
|
+
|
|
129
|
+
================================================================================
|
|
130
|
+
SHA-256: 867aef7cd59a9b48deff85130391ac5153013ed3c438e80fca62cec229b7897e
|
|
131
|
+
Applies to:
|
|
132
|
+
- nulib 0.4.7 (LICENSE)
|
|
133
|
+
- numath 0.5.0 (LICENSE)
|
|
134
|
+
- numem 1.6.11 (LICENSE)
|
|
135
|
+
|
|
136
|
+
Copyright (c) 2023-2025, Kitsunebi Games
|
|
137
|
+
Copyright (c) 2023-2025, Inochi2D Project
|
|
138
|
+
|
|
139
|
+
Boost Software License - Version 1.0 - August 17th, 2003
|
|
140
|
+
|
|
141
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
142
|
+
obtaining a copy of the software and accompanying documentation covered by
|
|
143
|
+
this license (the "Software") to use, reproduce, display, distribute,
|
|
144
|
+
execute, and transmit the Software, and to prepare derivative works of the
|
|
145
|
+
Software, and to permit third-parties to whom the Software is furnished to
|
|
146
|
+
do so, all subject to the following:
|
|
147
|
+
|
|
148
|
+
The copyright notices in the Software and this entire statement, including
|
|
149
|
+
the above license grant, this restriction and the following disclaimer,
|
|
150
|
+
must be included in all copies of the Software, in whole or in part, and
|
|
151
|
+
all derivative works of the Software, unless such copies or derivative
|
|
152
|
+
works are solely in the form of machine-executable object code generated by
|
|
153
|
+
a source language processor.
|
|
154
|
+
|
|
155
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
156
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
157
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
158
|
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
159
|
+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
160
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
161
|
+
DEALINGS IN THE SOFTWARE.
|
|
162
|
+
|
|
163
|
+
================================================================================
|
|
164
|
+
SHA-256: 89c7637af09bf1d03c6c531974a79c9835d336405498eac2960c6f54bb0b7963
|
|
165
|
+
Applies to:
|
|
166
|
+
- inochi2d f4b4917a59419e64f2704ac7b806e2bf09bca752 (LICENSE)
|
|
167
|
+
|
|
168
|
+
BSD 2-Clause License
|
|
169
|
+
|
|
170
|
+
Copyright (c) 2020-2026, Inochi2D Project
|
|
171
|
+
Copyright (c) 2020-2026, Kitsunebi Games
|
|
172
|
+
All rights reserved.
|
|
173
|
+
|
|
174
|
+
Redistribution and use in source and binary forms, with or without
|
|
175
|
+
modification, are permitted provided that the following conditions are met:
|
|
176
|
+
|
|
177
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
178
|
+
list of conditions and the following disclaimer.
|
|
179
|
+
|
|
180
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
181
|
+
this list of conditions and the following disclaimer in the documentation
|
|
182
|
+
and/or other materials provided with the distribution.
|
|
183
|
+
|
|
184
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
185
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
186
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
187
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
188
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
189
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
190
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
191
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
192
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
193
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
194
|
+
|
|
195
|
+
================================================================================
|
|
196
|
+
SHA-256: 8bc1b1dc47924d40afc644477cdd1859e609dc1c9e37bd787e74aa7b44163b21
|
|
197
|
+
Applies to:
|
|
198
|
+
- nusilly 1.0.0 (LICENSE)
|
|
199
|
+
|
|
200
|
+
Copyright (c) 2019, Anton Fediushin
|
|
201
|
+
Copyright (c) 2025, Kitsunebi Games
|
|
202
|
+
|
|
203
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
204
|
+
purpose with or without fee is hereby granted, provided that the above
|
|
205
|
+
copyright notice and this permission notice appear in all copies.
|
|
206
|
+
|
|
207
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|
208
|
+
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
209
|
+
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
|
210
|
+
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
211
|
+
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
|
212
|
+
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
|
213
|
+
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
214
|
+
|
|
215
|
+
================================================================================
|
|
216
|
+
SHA-256: c9bff75738922193e67fa726fa225535870d2aa1059f91452c411736284ad566
|
|
217
|
+
Applies to:
|
|
218
|
+
- gamut 3.5.0 (LICENSE)
|
|
219
|
+
- intel-intrinsics 1.14.8 (COPYING)
|
|
220
|
+
|
|
221
|
+
Boost Software License - Version 1.0 - August 17th, 2003
|
|
222
|
+
|
|
223
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
224
|
+
obtaining a copy of the software and accompanying documentation covered by
|
|
225
|
+
this license (the "Software") to use, reproduce, display, distribute,
|
|
226
|
+
execute, and transmit the Software, and to prepare derivative works of the
|
|
227
|
+
Software, and to permit third-parties to whom the Software is furnished to
|
|
228
|
+
do so, all subject to the following:
|
|
229
|
+
|
|
230
|
+
The copyright notices in the Software and this entire statement, including
|
|
231
|
+
the above license grant, this restriction and the following disclaimer,
|
|
232
|
+
must be included in all copies of the Software, in whole or in part, and
|
|
233
|
+
all derivative works of the Software, unless such copies or derivative
|
|
234
|
+
works are solely in the form of machine-executable object code generated by
|
|
235
|
+
a source language processor.
|
|
236
|
+
|
|
237
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
238
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
239
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
240
|
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
241
|
+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
242
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
243
|
+
DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
The bundled WASM is built from the official Inochi2D D SDK at commit
|
|
4
|
+
`f4b4917a59419e64f2704ac7b806e2bf09bca752` (BSD-2-Clause).
|
|
5
|
+
|
|
6
|
+
It also includes `numem`, `nurt`, `nulib`, `numath`, and `intel-intrinsics`
|
|
7
|
+
(BSL-1.0), `gamut` (BSL-1.0 and MIT components), and `miniz` (MIT). Exact
|
|
8
|
+
versions and hashes are recorded in the source repository under
|
|
9
|
+
`tools/official-sdk`.
|
|
10
|
+
|
|
11
|
+
The complete upstream license and notice texts for the exact bundled versions
|
|
12
|
+
are included in `THIRD_PARTY_LICENSES.txt`.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ResolvedAmbientParameterOscillator } from "./types.js";
|
|
2
|
+
type ParameterValue = number | readonly [number, number];
|
|
3
|
+
/**
|
|
4
|
+
* Applies validated, absolute sine-wave values beneath authored animations.
|
|
5
|
+
* Reduced-motion mode leaves the model at its own neutral/default values.
|
|
6
|
+
*/
|
|
7
|
+
export declare function applyAmbientParameterOscillators(values: Map<string, ParameterValue>, oscillators: readonly ResolvedAmbientParameterOscillator[], timestampMs: number, reducedMotion: boolean): void;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=ambient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient.d.ts","sourceRoot":"","sources":["../src/ambient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,YAAY,CAAC;AAErE,KAAK,cAAc,GAAG,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,gCAAgC,CAC9C,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,EACnC,WAAW,EAAE,SAAS,kCAAkC,EAAE,EAC1D,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,OAAO,GACrB,IAAI,CAaN"}
|
package/dist/ambient.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Applies validated, absolute sine-wave values beneath authored animations.
|
|
3
|
+
* Reduced-motion mode leaves the model at its own neutral/default values.
|
|
4
|
+
*/
|
|
5
|
+
export function applyAmbientParameterOscillators(values, oscillators, timestampMs, reducedMotion) {
|
|
6
|
+
if (reducedMotion) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const timestamp = Number.isFinite(timestampMs) ? timestampMs : 0;
|
|
10
|
+
for (const oscillator of oscillators) {
|
|
11
|
+
const midpoint = (oscillator.minimum + oscillator.maximum) / 2;
|
|
12
|
+
const amplitude = (oscillator.maximum - oscillator.minimum) / 2;
|
|
13
|
+
const phase = (timestamp / oscillator.periodMs + oscillator.phase) * Math.PI * 2;
|
|
14
|
+
const value = midpoint + Math.sin(phase) * amplitude;
|
|
15
|
+
setOscillatorValue(values, oscillator.id, oscillator.axis, value);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
function setOscillatorValue(values, id, axis, value) {
|
|
19
|
+
if (axis === undefined) {
|
|
20
|
+
values.set(id, value);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const current = values.get(id);
|
|
24
|
+
const vector = Array.isArray(current)
|
|
25
|
+
? [current[0], current[1]]
|
|
26
|
+
: [0, 0];
|
|
27
|
+
vector[axis === "x" ? 0 : 1] = value;
|
|
28
|
+
values.set(id, vector);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=ambient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ambient.js","sourceRoot":"","sources":["../src/ambient.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,UAAU,gCAAgC,CAC9C,MAAmC,EACnC,WAA0D,EAC1D,WAAmB,EACnB,aAAsB;IAEtB,IAAI,aAAa,EAAE,CAAC;QAClB,OAAO;IACT,CAAC;IACD,MAAM,SAAS,GAAG,MAAM,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;IACjE,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,CAAC,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC/D,MAAM,SAAS,GAAG,CAAC,UAAU,CAAC,OAAO,GAAG,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChE,MAAM,KAAK,GACT,CAAC,SAAS,GAAG,UAAU,CAAC,QAAQ,GAAG,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,CAAC,CAAC;QACrE,MAAM,KAAK,GAAG,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC;QACrD,kBAAkB,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,EAAE,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACpE,CAAC;AACH,CAAC;AAED,SAAS,kBAAkB,CACzB,MAAmC,EACnC,EAAU,EACV,IAA2B,EAC3B,KAAa;IAEb,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACtB,OAAO;IACT,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAqB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC;QACrD,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACX,MAAM,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACrC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AnimationClip, AnimationLane, AnimationPlaybackOptions, AnimationPlaybackResult } from "./types.js";
|
|
2
|
+
export type AnimatedParameterValue = number | readonly [number, number];
|
|
3
|
+
export type AnimatedParameterMap = Map<string, AnimatedParameterValue>;
|
|
4
|
+
/**
|
|
5
|
+
* Mixes validated model-authored ambient loops with one foreground animation.
|
|
6
|
+
*
|
|
7
|
+
* Ambient lanes are applied after idle/pointer motion. The foreground clip is
|
|
8
|
+
* applied last, so an enter/idle/click action temporarily owns overlapping
|
|
9
|
+
* lanes and the current loop phase becomes visible again when the action ends.
|
|
10
|
+
*/
|
|
11
|
+
export declare class AnimationPlayer {
|
|
12
|
+
#private;
|
|
13
|
+
constructor(clips: ReadonlyMap<string, AnimationClip>, loopNames?: readonly string[]);
|
|
14
|
+
trigger(name: string, timestampMs: number, options?: AnimationPlaybackOptions): Promise<AnimationPlaybackResult>;
|
|
15
|
+
stop(): void;
|
|
16
|
+
isActive(timestampMs: number): boolean;
|
|
17
|
+
apply(values: AnimatedParameterMap, timestampMs: number, reducedMotion: boolean): void;
|
|
18
|
+
}
|
|
19
|
+
/** Samples Creator's lead-in/lead-out loop region for an elapsed time. */
|
|
20
|
+
export declare function loopFrame(clip: AnimationClip, elapsedMs: number): number;
|
|
21
|
+
export declare function sampleLane(lane: AnimationLane, frame: number): number;
|
|
22
|
+
export declare function animationDurationMs(clip: AnimationClip): number;
|
|
23
|
+
//# sourceMappingURL=animation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.d.ts","sourceRoot":"","sources":["../src/animation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,aAAa,EACb,wBAAwB,EACxB,uBAAuB,EACxB,MAAM,YAAY,CAAC;AAEpB,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AACxE,MAAM,MAAM,oBAAoB,GAAG,GAAG,CAAC,MAAM,EAAE,sBAAsB,CAAC,CAAC;AAUvE;;;;;;GAMG;AACH,qBAAa,eAAe;;IAO1B,YACE,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,aAAa,CAAC,EACzC,SAAS,GAAE,SAAS,MAAM,EAAO,EAUlC;IAED,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,wBAA6B,GACrC,OAAO,CAAC,uBAAuB,CAAC,CA0BlC;IAED,IAAI,IAAI,IAAI,CAEX;IAED,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAOrC;IAED,KAAK,CACH,MAAM,EAAE,oBAAoB,EAC5B,WAAW,EAAE,MAAM,EACnB,aAAa,EAAE,OAAO,GACrB,IAAI,CA6BN;CAuDF;AAED,0EAA0E;AAC1E,wBAAgB,SAAS,CAAC,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAQxE;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CA6BrE;AA0CD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAE/D"}
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mixes validated model-authored ambient loops with one foreground animation.
|
|
3
|
+
*
|
|
4
|
+
* Ambient lanes are applied after idle/pointer motion. The foreground clip is
|
|
5
|
+
* applied last, so an enter/idle/click action temporarily owns overlapping
|
|
6
|
+
* lanes and the current loop phase becomes visible again when the action ends.
|
|
7
|
+
*/
|
|
8
|
+
export class AnimationPlayer {
|
|
9
|
+
#clips;
|
|
10
|
+
#loops;
|
|
11
|
+
#loopsStartedAt;
|
|
12
|
+
#active;
|
|
13
|
+
#restore = new Set();
|
|
14
|
+
constructor(clips, loopNames = []) {
|
|
15
|
+
this.#clips = clips;
|
|
16
|
+
this.#loops = loopNames.map((name) => {
|
|
17
|
+
const clip = clips.get(name);
|
|
18
|
+
if (!clip) {
|
|
19
|
+
throw new Error(`ambient animation ${JSON.stringify(name)} is unavailable`);
|
|
20
|
+
}
|
|
21
|
+
return clip;
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
trigger(name, timestampMs, options = {}) {
|
|
25
|
+
const clip = this.#clips.get(name);
|
|
26
|
+
if (!clip) {
|
|
27
|
+
throw new Error(`animation ${JSON.stringify(name)} is unavailable`);
|
|
28
|
+
}
|
|
29
|
+
const mode = options.mode ?? "once";
|
|
30
|
+
if (this.#active?.clip === clip &&
|
|
31
|
+
this.#active.mode === mode &&
|
|
32
|
+
options.restart === false) {
|
|
33
|
+
return this.#active.result;
|
|
34
|
+
}
|
|
35
|
+
this.#finishActive("interrupted");
|
|
36
|
+
let settle;
|
|
37
|
+
const result = new Promise((resolve) => {
|
|
38
|
+
settle = resolve;
|
|
39
|
+
});
|
|
40
|
+
this.#active = {
|
|
41
|
+
clip,
|
|
42
|
+
startedAt: Number.isFinite(timestampMs) ? timestampMs : 0,
|
|
43
|
+
mode,
|
|
44
|
+
result,
|
|
45
|
+
resolve: settle,
|
|
46
|
+
};
|
|
47
|
+
return result;
|
|
48
|
+
}
|
|
49
|
+
stop() {
|
|
50
|
+
this.#finishActive("stopped");
|
|
51
|
+
}
|
|
52
|
+
isActive(timestampMs) {
|
|
53
|
+
return (this.#active !== undefined &&
|
|
54
|
+
(this.#active.mode === "loop" ||
|
|
55
|
+
Math.max(0, timestampMs - this.#active.startedAt) <
|
|
56
|
+
animationDurationMs(this.#active.clip)));
|
|
57
|
+
}
|
|
58
|
+
apply(values, timestampMs, reducedMotion) {
|
|
59
|
+
if (reducedMotion) {
|
|
60
|
+
this.#restoreLoopDefaults(values);
|
|
61
|
+
this.#finishActive("stopped");
|
|
62
|
+
this.#restoreDefaults(values);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
this.#restoreDefaults(values);
|
|
66
|
+
this.#applyLoops(values, timestampMs);
|
|
67
|
+
if (!this.#active) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const elapsed = Math.max(0, timestampMs - this.#active.startedAt);
|
|
71
|
+
const duration = animationDurationMs(this.#active.clip);
|
|
72
|
+
const frame = this.#active.mode === "loop"
|
|
73
|
+
? loopFrame(this.#active.clip, elapsed)
|
|
74
|
+
: Math.min(this.#active.clip.length, elapsed / this.#active.clip.timestepMs);
|
|
75
|
+
for (const lane of this.#active.clip.lanes) {
|
|
76
|
+
setLaneValue(values, lane, sampleLane(lane, frame));
|
|
77
|
+
}
|
|
78
|
+
if (this.#active.mode === "once" && elapsed >= duration) {
|
|
79
|
+
this.#finishActive("completed");
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
#finishActive(result) {
|
|
83
|
+
const active = this.#active;
|
|
84
|
+
if (!active) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
this.#restore.add(active.clip);
|
|
88
|
+
this.#active = undefined;
|
|
89
|
+
active.resolve(result);
|
|
90
|
+
}
|
|
91
|
+
#applyLoops(values, timestampMs) {
|
|
92
|
+
if (this.#loops.length === 0) {
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
this.#loopsStartedAt ??= timestampMs;
|
|
96
|
+
const elapsed = Math.max(0, timestampMs - this.#loopsStartedAt);
|
|
97
|
+
for (const clip of this.#loops) {
|
|
98
|
+
const frame = loopFrame(clip, elapsed);
|
|
99
|
+
for (const lane of clip.lanes) {
|
|
100
|
+
setLaneValue(values, lane, sampleLane(lane, frame));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
#restoreLoopDefaults(values) {
|
|
105
|
+
if (this.#loopsStartedAt === undefined) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
for (const clip of this.#loops) {
|
|
109
|
+
for (const lane of clip.lanes) {
|
|
110
|
+
if (!values.has(lane.parameter)) {
|
|
111
|
+
setLaneValue(values, lane, laneDefaultValue(lane));
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
this.#loopsStartedAt = undefined;
|
|
116
|
+
}
|
|
117
|
+
#restoreDefaults(values) {
|
|
118
|
+
if (this.#restore.size === 0) {
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
for (const clip of this.#restore) {
|
|
122
|
+
for (const lane of clip.lanes) {
|
|
123
|
+
// Existing automatic/manual motion is the new source of truth. Restore
|
|
124
|
+
// only lanes that would otherwise retain the interrupted animation.
|
|
125
|
+
if (!values.has(lane.parameter)) {
|
|
126
|
+
setLaneValue(values, lane, laneDefaultValue(lane));
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
this.#restore.clear();
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
/** Samples Creator's lead-in/lead-out loop region for an elapsed time. */
|
|
134
|
+
export function loopFrame(clip, elapsedMs) {
|
|
135
|
+
const rawFrame = Math.max(0, elapsedMs) / clip.timestepMs;
|
|
136
|
+
const begin = hasLeadIn(clip) ? clip.leadIn : 0;
|
|
137
|
+
const end = hasLeadOut(clip) ? clip.leadOut : clip.length;
|
|
138
|
+
if (rawFrame < end) {
|
|
139
|
+
return rawFrame;
|
|
140
|
+
}
|
|
141
|
+
return begin + ((rawFrame - begin) % (end - begin));
|
|
142
|
+
}
|
|
143
|
+
export function sampleLane(lane, frame) {
|
|
144
|
+
const keyframes = lane.keyframes;
|
|
145
|
+
const first = keyframes[0];
|
|
146
|
+
if (frame <= first.frame) {
|
|
147
|
+
return first.value;
|
|
148
|
+
}
|
|
149
|
+
const final = keyframes[keyframes.length - 1];
|
|
150
|
+
if (frame >= final.frame) {
|
|
151
|
+
return final.value;
|
|
152
|
+
}
|
|
153
|
+
let rightIndex = 1;
|
|
154
|
+
while (keyframes[rightIndex].frame < frame) {
|
|
155
|
+
rightIndex += 1;
|
|
156
|
+
}
|
|
157
|
+
const leftIndex = rightIndex - 1;
|
|
158
|
+
const left = keyframes[leftIndex];
|
|
159
|
+
const right = keyframes[rightIndex];
|
|
160
|
+
const progress = (frame - left.frame) / (right.frame - left.frame);
|
|
161
|
+
switch (lane.interpolation) {
|
|
162
|
+
case "nearest":
|
|
163
|
+
return progress > 0.5 ? right.value : left.value;
|
|
164
|
+
case "stepped":
|
|
165
|
+
return left.value;
|
|
166
|
+
case "linear":
|
|
167
|
+
return mix(left.value, right.value, progress);
|
|
168
|
+
case "cubic":
|
|
169
|
+
return cubicValue(keyframes, leftIndex, rightIndex, progress);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function cubicValue(keyframes, leftIndex, rightIndex, progress) {
|
|
173
|
+
const previous = keyframes[Math.max(0, leftIndex - 1)].value;
|
|
174
|
+
const current = keyframes[leftIndex].value;
|
|
175
|
+
const next = keyframes[rightIndex].value;
|
|
176
|
+
const following = keyframes[Math.min(keyframes.length - 1, rightIndex + 1)].value;
|
|
177
|
+
const squared = progress * progress;
|
|
178
|
+
const cubed = squared * progress;
|
|
179
|
+
const a = -0.5 * previous + 1.5 * current - 1.5 * next + 0.5 * following;
|
|
180
|
+
const b = previous - 2.5 * current + 2 * next - 0.5 * following;
|
|
181
|
+
const c = -0.5 * previous + 0.5 * next;
|
|
182
|
+
return a * cubed + b * squared + c * progress + current;
|
|
183
|
+
}
|
|
184
|
+
function setLaneValue(values, lane, value) {
|
|
185
|
+
if (!lane.axis) {
|
|
186
|
+
values.set(lane.parameter, value);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
189
|
+
const current = values.get(lane.parameter);
|
|
190
|
+
const vector = Array.isArray(current)
|
|
191
|
+
? [current[0], current[1]]
|
|
192
|
+
: [lane.defaultValues[0], lane.defaultValues[1]];
|
|
193
|
+
vector[lane.axis === "x" ? 0 : 1] = value;
|
|
194
|
+
values.set(lane.parameter, vector);
|
|
195
|
+
}
|
|
196
|
+
function laneDefaultValue(lane) {
|
|
197
|
+
return lane.defaultValues[lane.axis === "y" ? 1 : 0];
|
|
198
|
+
}
|
|
199
|
+
export function animationDurationMs(clip) {
|
|
200
|
+
return clip.length * clip.timestepMs;
|
|
201
|
+
}
|
|
202
|
+
function hasLeadIn(clip) {
|
|
203
|
+
return clip.leadIn > 0 && clip.leadIn + 1 < clip.length;
|
|
204
|
+
}
|
|
205
|
+
function hasLeadOut(clip) {
|
|
206
|
+
return clip.leadOut > 0 && clip.leadOut + 1 < clip.length;
|
|
207
|
+
}
|
|
208
|
+
function mix(left, right, progress) {
|
|
209
|
+
return left + (right - left) * progress;
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=animation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"animation.js","sourceRoot":"","sources":["../src/animation.ts"],"names":[],"mappings":"AAmBA;;;;;;GAMG;AACH,MAAM,OAAO,eAAe;IACjB,MAAM,CAAqC;IAC3C,MAAM,CAA2B;IAC1C,eAAe,CAAqB;IACpC,OAAO,CAA8B;IAC5B,QAAQ,GAAG,IAAI,GAAG,EAAiB,CAAC;IAE7C,YACE,KAAyC,EACzC,SAAS,GAAsB,EAAE;QAEjC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;YACnC,MAAM,IAAI,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YAC7B,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;YAC9E,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC,CAAC;IACL,CAAC;IAED,OAAO,CACL,IAAY,EACZ,WAAmB,EACnB,OAAO,GAA6B,EAAE;QAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,aAAa,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACtE,CAAC;QACD,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC;QACpC,IACE,IAAI,CAAC,OAAO,EAAE,IAAI,KAAK,IAAI;YAC3B,IA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ResolvedWidgetConfig, WidgetConfig } from "./types.js";
|
|
2
|
+
export declare function resolveConfig(config: WidgetConfig): ResolvedWidgetConfig;
|
|
3
|
+
/**
|
|
4
|
+
* Validates a complete widget configuration without retaining its resolved
|
|
5
|
+
* representation. This pure entry point is safe for build-time adapters.
|
|
6
|
+
*/
|
|
7
|
+
export declare function validateInochi2DWidgetConfig(config: WidgetConfig): void;
|
|
8
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAeV,oBAAoB,EACpB,YAAY,EACb,MAAM,YAAY,CAAC;AAsDpB,wBAAgB,aAAa,CAAC,MAAM,EAAE,YAAY,GAAG,oBAAoB,CA4HxE;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAEvE"}
|