@galacean/effects-specification 0.0.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +6 -12
- package/dist/fallback/migration.d.ts +4 -0
- package/dist/fallback.js +29 -4
- package/dist/fallback.js.map +1 -1
- package/dist/fallback.mjs +29 -4
- package/dist/fallback.mjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/src/binary.d.ts +6 -6
- package/dist/src/image.d.ts +5 -5
- package/dist/src/item/base-item.d.ts +2 -2
- package/dist/src/item/filter-item.d.ts +1 -1
- package/dist/src/item/interact-item.d.ts +1 -1
- package/dist/src/item/model/binary.d.ts +5 -5
- package/dist/src/item/model/light.d.ts +1 -1
- package/dist/src/item/model/material.d.ts +1 -1
- package/dist/src/item/model/mesh.d.ts +2 -2
- package/dist/src/item/particle-shape.d.ts +1 -1
- package/dist/src/item/plugin-item.d.ts +1 -1
- package/dist/src/item/spine-item.d.ts +1 -1
- package/dist/src/item.d.ts +1 -1
- package/dist/src/numberExpression.d.ts +44 -44
- package/dist/src/scene.d.ts +3 -2
- package/dist/src/type.d.ts +1 -1
- package/package.json +1 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 Galacean
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,28 +1,22 @@
|
|
|
1
1
|
# Galacean Effects JSON definition
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## Environment Setup
|
|
4
4
|
|
|
5
5
|
- Node.js `>= 10.0.0`
|
|
6
6
|
|
|
7
|
-
##
|
|
7
|
+
## Development
|
|
8
8
|
|
|
9
9
|
``` bash
|
|
10
|
-
# 1.
|
|
10
|
+
# 1. Install dependencies (first time)
|
|
11
11
|
npm install
|
|
12
|
-
# 2.
|
|
12
|
+
# 2. Build
|
|
13
13
|
npm run build
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
##
|
|
16
|
+
## Testing
|
|
17
17
|
|
|
18
18
|
``` bash
|
|
19
19
|
npm run test
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
>
|
|
23
|
-
|
|
24
|
-
## 发布
|
|
25
|
-
|
|
26
|
-
``` bash
|
|
27
|
-
tnpm publish
|
|
28
|
-
```
|
|
22
|
+
> Open browser and open: http://localhost:9003/test/
|
|
@@ -3,3 +3,7 @@ import type { JSONScene } from '../src/scene';
|
|
|
3
3
|
* 2.1 以下版本数据适配(mars-player@2.4.0 及以上版本支持 2.1 以下数据的适配)
|
|
4
4
|
*/
|
|
5
5
|
export declare function version21Migration(json: JSONScene): JSONScene;
|
|
6
|
+
/**
|
|
7
|
+
* 2.2 以下版本数据适配(mars-player@2.5.0 及以上版本支持 2.2 以下数据的适配)
|
|
8
|
+
*/
|
|
9
|
+
export declare function version22Migration(json: JSONScene): JSONScene;
|
package/dist/fallback.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Name: @galacean/effects-specification
|
|
3
3
|
* Description: Galacean Effects JSON Specification
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
|
-
* Version:
|
|
5
|
+
* Version: v1.0.0
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
'use strict';
|
|
@@ -477,7 +477,7 @@ var ItemEndBehavior;
|
|
|
477
477
|
(function (ItemEndBehavior) {
|
|
478
478
|
ItemEndBehavior[ItemEndBehavior["destroy"] = END_BEHAVIOR_DESTROY] = "destroy";
|
|
479
479
|
ItemEndBehavior[ItemEndBehavior["loop"] = END_BEHAVIOR_RESTART] = "loop";
|
|
480
|
-
ItemEndBehavior[ItemEndBehavior["
|
|
480
|
+
ItemEndBehavior[ItemEndBehavior["freeze"] = END_BEHAVIOR_FREEZE] = "freeze";
|
|
481
481
|
})(ItemEndBehavior || (ItemEndBehavior = {}));
|
|
482
482
|
var ParentItemEndBehavior;
|
|
483
483
|
(function (ParentItemEndBehavior) {
|
|
@@ -723,7 +723,12 @@ function __read(o, n) {
|
|
|
723
723
|
finally { if (e) throw e.error; }
|
|
724
724
|
}
|
|
725
725
|
return ar;
|
|
726
|
-
}
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
729
|
+
var e = new Error(message);
|
|
730
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
731
|
+
};
|
|
727
732
|
|
|
728
733
|
function arrAdd(arr, item) {
|
|
729
734
|
if (!arr.includes(item)) {
|
|
@@ -1345,7 +1350,7 @@ function version21Migration(json) {
|
|
|
1345
1350
|
composition.items.forEach(function (item) {
|
|
1346
1351
|
if (item.type === ItemType.null) {
|
|
1347
1352
|
if (item.endBehavior === ItemEndBehavior.destroy) {
|
|
1348
|
-
item.endBehavior = ItemEndBehavior.
|
|
1353
|
+
item.endBehavior = ItemEndBehavior.freeze;
|
|
1349
1354
|
}
|
|
1350
1355
|
}
|
|
1351
1356
|
});
|
|
@@ -1353,6 +1358,24 @@ function version21Migration(json) {
|
|
|
1353
1358
|
json.version = '2.1';
|
|
1354
1359
|
return json;
|
|
1355
1360
|
}
|
|
1361
|
+
/**
|
|
1362
|
+
* 2.2 以下版本数据适配(mars-player@2.5.0 及以上版本支持 2.2 以下数据的适配)
|
|
1363
|
+
*/
|
|
1364
|
+
function version22Migration(json) {
|
|
1365
|
+
var _a;
|
|
1366
|
+
var singleVersion = (_a = json.version) === null || _a === void 0 ? void 0 : _a.split('.');
|
|
1367
|
+
if (!singleVersion || Number(singleVersion[0]) > 2 || (Number(singleVersion[0]) === 2 && Number(singleVersion[1]) >= 2)) {
|
|
1368
|
+
return json;
|
|
1369
|
+
}
|
|
1370
|
+
json.compositions.forEach(function (composition) {
|
|
1371
|
+
composition.items.forEach(function (item) {
|
|
1372
|
+
if (item.type === ItemType.mesh || item.type === ItemType.light) {
|
|
1373
|
+
item.endBehavior = item.endBehavior === 1 ? ItemEndBehavior.destroy : item.endBehavior;
|
|
1374
|
+
}
|
|
1375
|
+
});
|
|
1376
|
+
});
|
|
1377
|
+
return json;
|
|
1378
|
+
}
|
|
1356
1379
|
|
|
1357
1380
|
var v0 = /^(\d+)\.(\d+)\.(\d+)(-(\w+)\.\d+)?$/;
|
|
1358
1381
|
var standardVersion = /^(\d+)\.(\d+)$/;
|
|
@@ -1362,6 +1385,8 @@ function getStandardJSON(json) {
|
|
|
1362
1385
|
if (!json || typeof json !== 'object') {
|
|
1363
1386
|
throw Error('expect a json object');
|
|
1364
1387
|
}
|
|
1388
|
+
// 修正老版本数据中,meshItem以及lightItem结束行为错误问题
|
|
1389
|
+
version22Migration(json);
|
|
1365
1390
|
if (v0.test(json.version)) {
|
|
1366
1391
|
reverseParticle = ((_a = (/^(\d+)/).exec(json.version)) === null || _a === void 0 ? void 0 : _a[0]) === '0';
|
|
1367
1392
|
return version21Migration(getStandardJSONFromV0(json));
|