@vvfx/ge-ir 0.0.1-beta.4 → 0.0.1-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -8
- package/dist/ge2ir/converter.d.ts +1 -1
- package/dist/ge2ir/parsers/component-parser.d.ts +1 -1
- package/dist/ge2ir/parsers/keyframe-parser.d.ts +1 -1
- package/dist/ge2ir/reverse/blend-mode.d.ts +1 -1
- package/dist/ge2ir/reverse/end-behavior.d.ts +2 -2
- package/dist/ge2ir/types.d.ts +0 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +1769 -934
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1750 -920
- package/dist/index.mjs.map +1 -1
- package/dist/ir2ge/assembly/generator.d.ts +9 -11
- package/dist/ir2ge/builders/component.d.ts +4 -4
- package/dist/ir2ge/builders/timing.d.ts +2 -2
- package/dist/ir2ge/index.d.ts +1 -1
- package/dist/ir2ge/ir/anchor-strategy.d.ts +5 -5
- package/dist/ir2ge/ir/layer-dimensions.d.ts +5 -11
- package/dist/ir2ge/ir/layer-utils.d.ts +3 -3
- package/dist/ir2ge/ir/parent-link.d.ts +3 -12
- package/dist/ir2ge/ir/specific.d.ts +2 -4
- package/dist/ir2ge/post-process/ge-mask-remap.d.ts +3 -3
- package/dist/ir2ge/post-process/index.d.ts +1 -1
- package/dist/ir2ge/post-process/visibility.d.ts +5 -5
- package/dist/ir2ge/types.d.ts +1 -1
- package/dist/passthrough.d.ts +15 -0
- package/dist/shared/json-value.d.ts +2 -0
- package/package.json +4 -3
- package/dist/shared/ge2ir-metadata.d.ts +0 -30
package/dist/index.js
CHANGED
|
@@ -3,14 +3,13 @@
|
|
|
3
3
|
* Description: Galacean Effects and animation IR bidirectional conversion package
|
|
4
4
|
* Author: Ant Group CO., Ltd.
|
|
5
5
|
* Contributors: 澄弈
|
|
6
|
-
* Version: v0.0.1-beta.
|
|
6
|
+
* Version: v0.0.1-beta.6
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
'use strict';
|
|
10
10
|
|
|
11
11
|
var animationIr = require('@vvfx/animation-ir');
|
|
12
12
|
var uuid = require('uuid');
|
|
13
|
-
var effectsSpecification = require('@galacean/effects-specification');
|
|
14
13
|
|
|
15
14
|
function _extends() {
|
|
16
15
|
_extends = Object.assign || function assign(target) {
|
|
@@ -63,6 +62,92 @@ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
|
|
|
63
62
|
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
64
63
|
}
|
|
65
64
|
|
|
65
|
+
/** Read GE layer passthrough data. */ function getEffectsLayerSpecific(ir, layer) {
|
|
66
|
+
var _layer_specific;
|
|
67
|
+
return ir.source === 'effects' ? (_layer_specific = layer.specific) == null ? void 0 : _layer_specific.effects : undefined;
|
|
68
|
+
}
|
|
69
|
+
/** Read GE composition passthrough data. */ function getEffectsCompositionSpecific(ir) {
|
|
70
|
+
var _ir_specific;
|
|
71
|
+
return ir.source === 'effects' ? (_ir_specific = ir.specific) == null ? void 0 : _ir_specific.effects : undefined;
|
|
72
|
+
}
|
|
73
|
+
var EFFECTS_ANIMATION_SPECIFIC_KEYS = [
|
|
74
|
+
'positionOverLifetime',
|
|
75
|
+
'rotationOverLifetime',
|
|
76
|
+
'sizeOverLifetime',
|
|
77
|
+
'colorOverLifetime'
|
|
78
|
+
];
|
|
79
|
+
var KEYS_BY_INVALIDATION_TARGET = {
|
|
80
|
+
position: [
|
|
81
|
+
'positionOverLifetime'
|
|
82
|
+
],
|
|
83
|
+
rotation: [
|
|
84
|
+
'rotationOverLifetime',
|
|
85
|
+
'sourceHierarchy'
|
|
86
|
+
],
|
|
87
|
+
scale: [
|
|
88
|
+
'sizeOverLifetime',
|
|
89
|
+
'sourceHierarchy'
|
|
90
|
+
],
|
|
91
|
+
color: [
|
|
92
|
+
'colorOverLifetime'
|
|
93
|
+
],
|
|
94
|
+
opacity: [
|
|
95
|
+
'colorOverLifetime'
|
|
96
|
+
],
|
|
97
|
+
anchor: [
|
|
98
|
+
'sourceHierarchy'
|
|
99
|
+
],
|
|
100
|
+
mask: [
|
|
101
|
+
'mask'
|
|
102
|
+
],
|
|
103
|
+
precomp: [
|
|
104
|
+
'precompRefId',
|
|
105
|
+
'precompContent'
|
|
106
|
+
]
|
|
107
|
+
};
|
|
108
|
+
/**
|
|
109
|
+
* Remove raw GE values that would otherwise shadow an edited normalized field.
|
|
110
|
+
* Empty `effects` and `specific` containers are pruned so serialization stays clean.
|
|
111
|
+
*/ function invalidateEffectsLayerSpecific(layer, target) {
|
|
112
|
+
var _layer_specific;
|
|
113
|
+
var effects = (_layer_specific = layer.specific) == null ? void 0 : _layer_specific.effects;
|
|
114
|
+
if (effects == null) {
|
|
115
|
+
return [];
|
|
116
|
+
}
|
|
117
|
+
var removed = [];
|
|
118
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(KEYS_BY_INVALIDATION_TARGET[target]), _step; !(_step = _iterator()).done;){
|
|
119
|
+
var key = _step.value;
|
|
120
|
+
if (key in effects) {
|
|
121
|
+
delete effects[key];
|
|
122
|
+
removed.push(key);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (Object.keys(effects).length === 0 && layer.specific != null) {
|
|
126
|
+
delete layer.specific.effects;
|
|
127
|
+
}
|
|
128
|
+
if (layer.specific != null && Object.keys(layer.specific).length === 0) {
|
|
129
|
+
delete layer.specific;
|
|
130
|
+
}
|
|
131
|
+
return removed;
|
|
132
|
+
}
|
|
133
|
+
/** Whether invalidating opacity would also discard a GE color animation. */ function hasEffectsColorAnimationPassthrough(layer) {
|
|
134
|
+
var _layer_specific_effects, _layer_specific;
|
|
135
|
+
var color = (_layer_specific = layer.specific) == null ? void 0 : (_layer_specific_effects = _layer_specific.effects) == null ? void 0 : _layer_specific_effects.colorOverLifetime;
|
|
136
|
+
if (color == null) {
|
|
137
|
+
return false;
|
|
138
|
+
}
|
|
139
|
+
return Object.keys(color).some(function(channelKey) {
|
|
140
|
+
return channelKey !== 'opacity';
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
/** Whether the layer retains any raw GE animation payload. */ function hasEffectsAnimationPassthrough(layer) {
|
|
144
|
+
var _layer_specific;
|
|
145
|
+
var effects = (_layer_specific = layer.specific) == null ? void 0 : _layer_specific.effects;
|
|
146
|
+
return effects != null && EFFECTS_ANIMATION_SPECIFIC_KEYS.some(function(key) {
|
|
147
|
+
return effects[key] != null;
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
|
|
66
151
|
var DEFAULT_CAMERA_Z = 8;
|
|
67
152
|
var DEFAULT_CAMERA_FOV = 60;
|
|
68
153
|
var DEFAULT_CLIP_MODE = 1;
|
|
@@ -260,6 +345,878 @@ function buildSubCompositionTrack(collector, delay, duration, endBehavior) {
|
|
|
260
345
|
return trackId;
|
|
261
346
|
}
|
|
262
347
|
|
|
348
|
+
/**
|
|
349
|
+
* JSON 版本
|
|
350
|
+
*/ var JSONSceneVersion;
|
|
351
|
+
(function(JSONSceneVersion) {
|
|
352
|
+
JSONSceneVersion["1_0"] = "1.0";
|
|
353
|
+
JSONSceneVersion["1_1"] = "1.1";
|
|
354
|
+
JSONSceneVersion["1_2"] = "1.2";
|
|
355
|
+
JSONSceneVersion["1_3"] = "1.3";
|
|
356
|
+
JSONSceneVersion["1_5"] = "1.5";
|
|
357
|
+
JSONSceneVersion["1_8"] = "1.8";
|
|
358
|
+
JSONSceneVersion["2_0"] = "2.0";
|
|
359
|
+
JSONSceneVersion["2_1"] = "2.1";
|
|
360
|
+
JSONSceneVersion["2_2"] = "2.2";
|
|
361
|
+
JSONSceneVersion["2_3"] = "2.3";
|
|
362
|
+
JSONSceneVersion["2_4"] = "2.4";
|
|
363
|
+
JSONSceneVersion["3_0"] = "3.0";
|
|
364
|
+
JSONSceneVersion["3_1"] = "3.1";
|
|
365
|
+
JSONSceneVersion["3_2"] = "3.2";
|
|
366
|
+
JSONSceneVersion["3_3"] = "3.3";
|
|
367
|
+
JSONSceneVersion["3_4"] = "3.4";
|
|
368
|
+
JSONSceneVersion["3_5"] = "3.5";
|
|
369
|
+
JSONSceneVersion["3_6"] = "3.6";
|
|
370
|
+
JSONSceneVersion["3_7"] = "3.7";
|
|
371
|
+
JSONSceneVersion["LATEST"] = "3.7";
|
|
372
|
+
})(JSONSceneVersion || (JSONSceneVersion = {}));
|
|
373
|
+
|
|
374
|
+
/*********************************************/ /* 元素属性参数类型 */ /*********************************************/ /**
|
|
375
|
+
* 渲染等级
|
|
376
|
+
*/ var RenderLevel;
|
|
377
|
+
(function(RenderLevel) {
|
|
378
|
+
RenderLevel["S"] = "S";
|
|
379
|
+
RenderLevel["APlus"] = "A+";
|
|
380
|
+
RenderLevel["A"] = "A";
|
|
381
|
+
RenderLevel["BPlus"] = "B+";
|
|
382
|
+
RenderLevel["B"] = "B";
|
|
383
|
+
})(RenderLevel || (RenderLevel = {}));
|
|
384
|
+
/**
|
|
385
|
+
* 混合模式
|
|
386
|
+
*/ var BlendingMode;
|
|
387
|
+
(function(BlendingMode) {
|
|
388
|
+
/**
|
|
389
|
+
* 普通混合模式
|
|
390
|
+
*/ BlendingMode[BlendingMode["ALPHA"] = 0] = "ALPHA";
|
|
391
|
+
/**
|
|
392
|
+
* 叠加混合模式
|
|
393
|
+
*/ BlendingMode[BlendingMode["ADD"] = 1] = "ADD";
|
|
394
|
+
/**
|
|
395
|
+
* 相乘混合模式
|
|
396
|
+
*/ BlendingMode[BlendingMode["MULTIPLY"] = 2] = "MULTIPLY";
|
|
397
|
+
/**
|
|
398
|
+
* 亮度混合模式
|
|
399
|
+
*/ BlendingMode[BlendingMode["BRIGHTNESS"] = 3] = "BRIGHTNESS";
|
|
400
|
+
/**
|
|
401
|
+
* 减色混合模式
|
|
402
|
+
*/ BlendingMode[BlendingMode["SUBTRACTION"] = 4] = "SUBTRACTION";
|
|
403
|
+
/**
|
|
404
|
+
* 强光混合模式
|
|
405
|
+
*/ BlendingMode[BlendingMode["STRONG_LIGHT"] = 5] = "STRONG_LIGHT";
|
|
406
|
+
/**
|
|
407
|
+
* 弱光混合模式
|
|
408
|
+
*/ BlendingMode[BlendingMode["WEAK_LIGHT"] = 6] = "WEAK_LIGHT";
|
|
409
|
+
/**
|
|
410
|
+
* 亮度叠加混合模式
|
|
411
|
+
*/ BlendingMode[BlendingMode["SUPERPOSITION"] = 7] = "SUPERPOSITION";
|
|
412
|
+
})(BlendingMode || (BlendingMode = {}));
|
|
413
|
+
/**
|
|
414
|
+
* 单双面模式
|
|
415
|
+
*/ var SideMode;
|
|
416
|
+
(function(SideMode) {
|
|
417
|
+
/**
|
|
418
|
+
* 双面模式
|
|
419
|
+
*/ SideMode[SideMode["DOUBLE"] = 1032] = "DOUBLE";
|
|
420
|
+
/**
|
|
421
|
+
* 正面模式
|
|
422
|
+
*/ SideMode[SideMode["FRONT"] = 1028] = "FRONT";
|
|
423
|
+
/**
|
|
424
|
+
* 背面模式
|
|
425
|
+
*/ SideMode[SideMode["BACK"] = 1029] = "BACK";
|
|
426
|
+
})(SideMode || (SideMode = {}));
|
|
427
|
+
/**
|
|
428
|
+
* 元素是否被蒙版遮挡/反向遮挡
|
|
429
|
+
*/ var ObscuredMode;
|
|
430
|
+
(function(ObscuredMode) {
|
|
431
|
+
/**
|
|
432
|
+
* 无
|
|
433
|
+
*/ // NONE = 0,
|
|
434
|
+
// /**
|
|
435
|
+
// * 蒙版
|
|
436
|
+
// */
|
|
437
|
+
// MASK = 1,
|
|
438
|
+
/**
|
|
439
|
+
* 被遮挡
|
|
440
|
+
*/ ObscuredMode[ObscuredMode["OBSCURED"] = 2] = "OBSCURED";
|
|
441
|
+
/**
|
|
442
|
+
* 被反向遮挡
|
|
443
|
+
*/ ObscuredMode[ObscuredMode["REVERSE_OBSCURED"] = 3] = "REVERSE_OBSCURED";
|
|
444
|
+
})(ObscuredMode || (ObscuredMode = {}));
|
|
445
|
+
/**
|
|
446
|
+
* 发射器形状
|
|
447
|
+
*/ var ParticleEmitterShapeType;
|
|
448
|
+
(function(ParticleEmitterShapeType) {
|
|
449
|
+
/**
|
|
450
|
+
* 没有类型
|
|
451
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["NONE"] = 0] = "NONE";
|
|
452
|
+
/**
|
|
453
|
+
* 圆球
|
|
454
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["SPHERE"] = 1] = "SPHERE";
|
|
455
|
+
/**
|
|
456
|
+
* 圆锥
|
|
457
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["CONE"] = 2] = "CONE";
|
|
458
|
+
/**
|
|
459
|
+
* 半球
|
|
460
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["HEMISPHERE"] = 3] = "HEMISPHERE";
|
|
461
|
+
/**
|
|
462
|
+
* 圆
|
|
463
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["CIRCLE"] = 4] = "CIRCLE";
|
|
464
|
+
/**
|
|
465
|
+
* 圆环
|
|
466
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["DONUT"] = 5] = "DONUT";
|
|
467
|
+
/**
|
|
468
|
+
* 矩形
|
|
469
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE"] = 6] = "RECTANGLE";
|
|
470
|
+
/**
|
|
471
|
+
* 矩形框
|
|
472
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["RECTANGLE_EDGE"] = 7] = "RECTANGLE_EDGE";
|
|
473
|
+
/**
|
|
474
|
+
* 直线
|
|
475
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["EDGE"] = 8] = "EDGE";
|
|
476
|
+
/**
|
|
477
|
+
* 贴图
|
|
478
|
+
*/ ParticleEmitterShapeType[ParticleEmitterShapeType["TEXTURE"] = 9] = "TEXTURE";
|
|
479
|
+
})(ParticleEmitterShapeType || (ParticleEmitterShapeType = {}));
|
|
480
|
+
/**
|
|
481
|
+
* 插件类型
|
|
482
|
+
*/ var PluginType;
|
|
483
|
+
(function(PluginType) {
|
|
484
|
+
/**
|
|
485
|
+
* 陀螺仪
|
|
486
|
+
*/ PluginType[PluginType["GYROSCOPE"] = 0] = "GYROSCOPE";
|
|
487
|
+
/**
|
|
488
|
+
* Spine
|
|
489
|
+
*/ PluginType[PluginType["SPINE"] = 1] = "SPINE";
|
|
490
|
+
})(PluginType || (PluginType = {}));
|
|
491
|
+
/**
|
|
492
|
+
* 交互类型
|
|
493
|
+
*/ var InteractType;
|
|
494
|
+
(function(InteractType) {
|
|
495
|
+
/**
|
|
496
|
+
* 点击
|
|
497
|
+
*/ InteractType[InteractType["CLICK"] = 0] = "CLICK";
|
|
498
|
+
/**
|
|
499
|
+
* 消息
|
|
500
|
+
* 前端收到 onMessageItem 回调
|
|
501
|
+
*/ InteractType[InteractType["MESSAGE"] = 1] = "MESSAGE";
|
|
502
|
+
/**
|
|
503
|
+
* 拖拽
|
|
504
|
+
*/ InteractType[InteractType["DRAG"] = 2] = "DRAG";
|
|
505
|
+
})(InteractType || (InteractType = {}));
|
|
506
|
+
/**
|
|
507
|
+
* 交互行为
|
|
508
|
+
*/ var InteractBehavior;
|
|
509
|
+
(function(InteractBehavior) {
|
|
510
|
+
/**
|
|
511
|
+
* 无
|
|
512
|
+
*/ InteractBehavior[InteractBehavior["NONE"] = 0] = "NONE";
|
|
513
|
+
/**
|
|
514
|
+
* 通知
|
|
515
|
+
*/ InteractBehavior[InteractBehavior["NOTIFY"] = 1] = "NOTIFY";
|
|
516
|
+
/**
|
|
517
|
+
* 重置播放器
|
|
518
|
+
*/ InteractBehavior[InteractBehavior["RESUME_PLAYER"] = 2] = "RESUME_PLAYER";
|
|
519
|
+
/**
|
|
520
|
+
* 清除元素
|
|
521
|
+
*/ InteractBehavior[InteractBehavior["REMOVE"] = 3] = "REMOVE";
|
|
522
|
+
/**
|
|
523
|
+
* 暂停播放器
|
|
524
|
+
*/ InteractBehavior[InteractBehavior["PAUSE"] = 4] = "PAUSE";
|
|
525
|
+
})(InteractBehavior || (InteractBehavior = {}));
|
|
526
|
+
/**
|
|
527
|
+
* 元素类型
|
|
528
|
+
*/ var ItemType;
|
|
529
|
+
(function(ItemType) {
|
|
530
|
+
/**
|
|
531
|
+
* 错误元素
|
|
532
|
+
*/ ItemType["base"] = "0";
|
|
533
|
+
/**
|
|
534
|
+
* 图层元素
|
|
535
|
+
*/ ItemType["sprite"] = "1";
|
|
536
|
+
/**
|
|
537
|
+
* 粒子元素
|
|
538
|
+
*/ ItemType["particle"] = "2";
|
|
539
|
+
/**
|
|
540
|
+
* 空节点元素
|
|
541
|
+
*/ ItemType["null"] = "3";
|
|
542
|
+
/**
|
|
543
|
+
* 交互元素
|
|
544
|
+
*/ ItemType["interact"] = "4";
|
|
545
|
+
/**
|
|
546
|
+
* 插件元素
|
|
547
|
+
*/ ItemType["plugin"] = "5";
|
|
548
|
+
/**
|
|
549
|
+
* 相机元素
|
|
550
|
+
*/ ItemType["camera"] = "6";
|
|
551
|
+
/**
|
|
552
|
+
* 预合成元素
|
|
553
|
+
*/ ItemType["composition"] = "7";
|
|
554
|
+
/**
|
|
555
|
+
* Spine 元素
|
|
556
|
+
*/ ItemType["spine"] = "spine";
|
|
557
|
+
/**
|
|
558
|
+
* Mesh 元素
|
|
559
|
+
*/ ItemType["mesh"] = "mesh";
|
|
560
|
+
/**
|
|
561
|
+
* 节点树元素
|
|
562
|
+
*/ ItemType["tree"] = "tree";
|
|
563
|
+
/**
|
|
564
|
+
* 文本元素
|
|
565
|
+
*/ ItemType["text"] = "text";
|
|
566
|
+
/**
|
|
567
|
+
* 灯光元素
|
|
568
|
+
*/ ItemType["light"] = "light";
|
|
569
|
+
/**
|
|
570
|
+
* 天空盒元素
|
|
571
|
+
*/ ItemType["skybox"] = "skybox";
|
|
572
|
+
/**
|
|
573
|
+
* 特效元素
|
|
574
|
+
*/ ItemType["effect"] = "effect";
|
|
575
|
+
/**
|
|
576
|
+
* 形状元素
|
|
577
|
+
*/ ItemType["shape"] = "shape";
|
|
578
|
+
/**
|
|
579
|
+
* 后处理元素
|
|
580
|
+
*/ ItemType["postProcessVolume"] = "postProcessVolume";
|
|
581
|
+
/**
|
|
582
|
+
* 节点元素
|
|
583
|
+
*/ ItemType["node"] = "node";
|
|
584
|
+
/**
|
|
585
|
+
* 视频元素
|
|
586
|
+
*/ ItemType["video"] = "video";
|
|
587
|
+
/**
|
|
588
|
+
* 音频元素
|
|
589
|
+
*/ ItemType["audio"] = "audio";
|
|
590
|
+
/**
|
|
591
|
+
* 富文本元素
|
|
592
|
+
*/ ItemType["richtext"] = "richtext";
|
|
593
|
+
})(ItemType || (ItemType = {}));
|
|
594
|
+
/**
|
|
595
|
+
* 渲染模式
|
|
596
|
+
*/ var RenderMode;
|
|
597
|
+
(function(RenderMode) {
|
|
598
|
+
/**
|
|
599
|
+
* 广告牌模式
|
|
600
|
+
*/ RenderMode[RenderMode["BILLBOARD"] = 0] = "BILLBOARD";
|
|
601
|
+
/**
|
|
602
|
+
* 网格模式
|
|
603
|
+
*/ RenderMode[RenderMode["MESH"] = 1] = "MESH";
|
|
604
|
+
/**
|
|
605
|
+
* 垂直广告牌模式
|
|
606
|
+
*/ RenderMode[RenderMode["VERTICAL_BILLBOARD"] = 2] = "VERTICAL_BILLBOARD";
|
|
607
|
+
/**
|
|
608
|
+
* 水平广告牌模式
|
|
609
|
+
*/ RenderMode[RenderMode["HORIZONTAL_BILLBOARD"] = 3] = "HORIZONTAL_BILLBOARD";
|
|
610
|
+
})(RenderMode || (RenderMode = {}));
|
|
611
|
+
/**
|
|
612
|
+
* 变换中心
|
|
613
|
+
*/ var ParticleOrigin;
|
|
614
|
+
(function(ParticleOrigin) {
|
|
615
|
+
/**
|
|
616
|
+
* 水平和垂直中点
|
|
617
|
+
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_CENTER"] = 0] = "PARTICLE_ORIGIN_CENTER";
|
|
618
|
+
/**
|
|
619
|
+
* 水平左侧 垂直顶部
|
|
620
|
+
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_LEFT_TOP"] = 1] = "PARTICLE_ORIGIN_LEFT_TOP";
|
|
621
|
+
/**
|
|
622
|
+
* 水平左侧 垂直中间
|
|
623
|
+
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_LEFT_CENTER"] = 2] = "PARTICLE_ORIGIN_LEFT_CENTER";
|
|
624
|
+
/**
|
|
625
|
+
* 水平左侧 垂直底部
|
|
626
|
+
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_LEFT_BOTTOM"] = 3] = "PARTICLE_ORIGIN_LEFT_BOTTOM";
|
|
627
|
+
/**
|
|
628
|
+
* 水平中间 垂直顶部
|
|
629
|
+
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_CENTER_TOP"] = 4] = "PARTICLE_ORIGIN_CENTER_TOP";
|
|
630
|
+
/**
|
|
631
|
+
* 水平中间 垂直底部
|
|
632
|
+
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_CENTER_BOTTOM"] = 5] = "PARTICLE_ORIGIN_CENTER_BOTTOM";
|
|
633
|
+
/**
|
|
634
|
+
* 水平右侧 垂直顶部
|
|
635
|
+
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_TOP"] = 6] = "PARTICLE_ORIGIN_RIGHT_TOP";
|
|
636
|
+
/**
|
|
637
|
+
* 水平右侧 垂直中间
|
|
638
|
+
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_CENTER"] = 7] = "PARTICLE_ORIGIN_RIGHT_CENTER";
|
|
639
|
+
/**
|
|
640
|
+
* 水平右侧 垂直底部
|
|
641
|
+
*/ ParticleOrigin[ParticleOrigin["PARTICLE_ORIGIN_RIGHT_BOTTOM"] = 8] = "PARTICLE_ORIGIN_RIGHT_BOTTOM";
|
|
642
|
+
})(ParticleOrigin || (ParticleOrigin = {}));
|
|
643
|
+
var RenderType;
|
|
644
|
+
(function(RenderType) {
|
|
645
|
+
RenderType["Opaque"] = "Opaque";
|
|
646
|
+
RenderType["Transparent"] = "Transparent";
|
|
647
|
+
})(RenderType || (RenderType = {}));
|
|
648
|
+
var RenderFace;
|
|
649
|
+
(function(RenderFace) {
|
|
650
|
+
RenderFace["Both"] = "Both";
|
|
651
|
+
RenderFace["Back"] = "Back";
|
|
652
|
+
RenderFace["Front"] = "Front";
|
|
653
|
+
})(RenderFace || (RenderFace = {}));
|
|
654
|
+
|
|
655
|
+
var CameraClipMode;
|
|
656
|
+
(function(CameraClipMode) {
|
|
657
|
+
/**
|
|
658
|
+
* 剪裁上下
|
|
659
|
+
*/ CameraClipMode[CameraClipMode["portrait"] = 1] = "portrait";
|
|
660
|
+
/**
|
|
661
|
+
* 剪裁左右
|
|
662
|
+
*/ CameraClipMode[CameraClipMode["landscape"] = 0] = "landscape";
|
|
663
|
+
})(CameraClipMode || (CameraClipMode = {}));
|
|
664
|
+
|
|
665
|
+
/*********************************************/ /* 基本数值属性参数 */ /*********************************************/ var ValueType;
|
|
666
|
+
(function(ValueType) {
|
|
667
|
+
/**
|
|
668
|
+
* 常数
|
|
669
|
+
*/ ValueType[ValueType["CONSTANT"] = 0] = "CONSTANT";
|
|
670
|
+
/**
|
|
671
|
+
* 二维常数向量
|
|
672
|
+
*/ ValueType[ValueType["CONSTANT_VEC2"] = 1] = "CONSTANT_VEC2";
|
|
673
|
+
/**
|
|
674
|
+
* 三维常数向量
|
|
675
|
+
*/ ValueType[ValueType["CONSTANT_VEC3"] = 2] = "CONSTANT_VEC3";
|
|
676
|
+
/**
|
|
677
|
+
* 四维常数向量
|
|
678
|
+
*/ ValueType[ValueType["CONSTANT_VEC4"] = 3] = "CONSTANT_VEC4";
|
|
679
|
+
/**
|
|
680
|
+
* 随机数
|
|
681
|
+
*/ ValueType[ValueType["RANDOM"] = 4] = "RANDOM";
|
|
682
|
+
/**
|
|
683
|
+
* 直线
|
|
684
|
+
*/ ValueType[ValueType["LINE"] = 5] = "LINE";
|
|
685
|
+
/**
|
|
686
|
+
* 曲线(Hermite 曲线)
|
|
687
|
+
* @deprecated 使用 BEZIER_CURVE 替代,此类型仅用于旧数据迁移兼容
|
|
688
|
+
*/ ValueType[ValueType["CURVE"] = 6] = "CURVE";
|
|
689
|
+
/**
|
|
690
|
+
* 贝塞尔路径
|
|
691
|
+
* @deprecated 使用 BEZIER_CURVE_PATH 替代,此类型仅用于旧数据迁移兼容
|
|
692
|
+
*/ ValueType[ValueType["BEZIER_PATH"] = 7] = "BEZIER_PATH";
|
|
693
|
+
/**
|
|
694
|
+
* 颜色
|
|
695
|
+
*/ ValueType[ValueType["RGBA_COLOR"] = 8] = "RGBA_COLOR";
|
|
696
|
+
/**
|
|
697
|
+
* 渐变色
|
|
698
|
+
*/ ValueType[ValueType["GRADIENT_COLOR"] = 9] = "GRADIENT_COLOR";
|
|
699
|
+
/**
|
|
700
|
+
* 蒙版形状点集
|
|
701
|
+
*/ ValueType[ValueType["SHAPE_POINTS"] = 10] = "SHAPE_POINTS";
|
|
702
|
+
/**
|
|
703
|
+
* 蒙版形状切分
|
|
704
|
+
*/ ValueType[ValueType["SHAPE_SPLITS"] = 11] = "SHAPE_SPLITS";
|
|
705
|
+
/**
|
|
706
|
+
* 直线路径
|
|
707
|
+
*/ ValueType[ValueType["LINEAR_PATH"] = 12] = "LINEAR_PATH";
|
|
708
|
+
/**
|
|
709
|
+
* 多色
|
|
710
|
+
*/ ValueType[ValueType["COLORS"] = 13] = "COLORS";
|
|
711
|
+
/**
|
|
712
|
+
* 二进制指针
|
|
713
|
+
*/ ValueType[ValueType["BINARY"] = 20] = "BINARY";
|
|
714
|
+
/**
|
|
715
|
+
* 贝塞尔曲线
|
|
716
|
+
*/ ValueType[ValueType["BEZIER_CURVE"] = 21] = "BEZIER_CURVE";
|
|
717
|
+
/**
|
|
718
|
+
* 贝塞尔曲线路径
|
|
719
|
+
*/ ValueType[ValueType["BEZIER_CURVE_PATH"] = 22] = "BEZIER_CURVE_PATH";
|
|
720
|
+
/**
|
|
721
|
+
* 贝塞尔曲线四元数
|
|
722
|
+
*/ ValueType[ValueType["BEZIER_CURVE_QUAT"] = 23] = "BEZIER_CURVE_QUAT";
|
|
723
|
+
/**
|
|
724
|
+
* 颜色曲线
|
|
725
|
+
*/ ValueType[ValueType["COLOR_CURVE"] = 24] = "COLOR_CURVE";
|
|
726
|
+
/**
|
|
727
|
+
* Vector4 曲线
|
|
728
|
+
*/ ValueType[ValueType["VECTOR4_CURVE"] = 25] = "VECTOR4_CURVE";
|
|
729
|
+
/**
|
|
730
|
+
* Vector2 曲线
|
|
731
|
+
*/ ValueType[ValueType["VECTOR2_CURVE"] = 26] = "VECTOR2_CURVE";
|
|
732
|
+
/**
|
|
733
|
+
* Vector3 曲线
|
|
734
|
+
*/ ValueType[ValueType["VECTOR3_CURVE"] = 27] = "VECTOR3_CURVE";
|
|
735
|
+
})(ValueType || (ValueType = {}));
|
|
736
|
+
/**
|
|
737
|
+
* 关键帧类型
|
|
738
|
+
*/ var BezierKeyframeType;
|
|
739
|
+
(function(BezierKeyframeType) {
|
|
740
|
+
BezierKeyframeType[BezierKeyframeType["AUTO"] = 0] = "AUTO";
|
|
741
|
+
BezierKeyframeType[BezierKeyframeType["EASE"] = 1] = "EASE";
|
|
742
|
+
BezierKeyframeType[BezierKeyframeType["EASE_IN"] = 2] = "EASE_IN";
|
|
743
|
+
BezierKeyframeType[BezierKeyframeType["EASE_OUT"] = 3] = "EASE_OUT";
|
|
744
|
+
BezierKeyframeType[BezierKeyframeType["LINE"] = 4] = "LINE";
|
|
745
|
+
BezierKeyframeType[BezierKeyframeType["HOLD"] = 5] = "HOLD";
|
|
746
|
+
BezierKeyframeType[BezierKeyframeType["LINE_OUT"] = 6] = "LINE_OUT";
|
|
747
|
+
})(BezierKeyframeType || (BezierKeyframeType = {}));
|
|
748
|
+
|
|
749
|
+
/**
|
|
750
|
+
* 结束行为
|
|
751
|
+
*/ var EndBehavior;
|
|
752
|
+
(function(EndBehavior) {
|
|
753
|
+
/**
|
|
754
|
+
* 销毁
|
|
755
|
+
*/ EndBehavior[EndBehavior["destroy"] = 0] = "destroy";
|
|
756
|
+
/**
|
|
757
|
+
* 重播
|
|
758
|
+
*/ EndBehavior[EndBehavior["restart"] = 5] = "restart";
|
|
759
|
+
/**
|
|
760
|
+
* 无限播放
|
|
761
|
+
*/ EndBehavior[EndBehavior["forward"] = 2] = "forward";
|
|
762
|
+
/**
|
|
763
|
+
* 冻结
|
|
764
|
+
*/ EndBehavior[EndBehavior["freeze"] = 4] = "freeze";
|
|
765
|
+
})(EndBehavior || (EndBehavior = {}));
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* 粒子交互行为
|
|
769
|
+
*/ var ParticleInteractionBehavior;
|
|
770
|
+
(function(ParticleInteractionBehavior) {
|
|
771
|
+
/**
|
|
772
|
+
* 无
|
|
773
|
+
*/ ParticleInteractionBehavior[ParticleInteractionBehavior["none"] = 0] = "none";
|
|
774
|
+
/**
|
|
775
|
+
* 移出粒子
|
|
776
|
+
*/ ParticleInteractionBehavior[ParticleInteractionBehavior["removeParticle"] = 1] = "removeParticle";
|
|
777
|
+
})(ParticleInteractionBehavior || (ParticleInteractionBehavior = {}));
|
|
778
|
+
|
|
779
|
+
var ShapeArcMode;
|
|
780
|
+
(function(ShapeArcMode) {
|
|
781
|
+
/**
|
|
782
|
+
* 随机
|
|
783
|
+
*/ ShapeArcMode[ShapeArcMode["RANDOM"] = 0] = "RANDOM";
|
|
784
|
+
/**
|
|
785
|
+
* 单向循环
|
|
786
|
+
*/ ShapeArcMode[ShapeArcMode["UNIDIRECTIONAL_CYCLE"] = 1] = "UNIDIRECTIONAL_CYCLE";
|
|
787
|
+
/**
|
|
788
|
+
* 双向循环
|
|
789
|
+
*/ ShapeArcMode[ShapeArcMode["BIDIRECTIONAL_CYCLE"] = 2] = "BIDIRECTIONAL_CYCLE";
|
|
790
|
+
/**
|
|
791
|
+
* 均匀爆发
|
|
792
|
+
*/ ShapeArcMode[ShapeArcMode["UNIFORM_BURST"] = 3] = "UNIFORM_BURST";
|
|
793
|
+
})(ShapeArcMode || (ShapeArcMode = {}));
|
|
794
|
+
|
|
795
|
+
var LightType;
|
|
796
|
+
(function(LightType) {
|
|
797
|
+
/**
|
|
798
|
+
* 点光源
|
|
799
|
+
*/ LightType["point"] = "point";
|
|
800
|
+
/**
|
|
801
|
+
* 聚光灯
|
|
802
|
+
*/ LightType["spot"] = "spot";
|
|
803
|
+
/**
|
|
804
|
+
* 方向光
|
|
805
|
+
*/ LightType["directional"] = "directional";
|
|
806
|
+
/**
|
|
807
|
+
* 环境光
|
|
808
|
+
*/ LightType["ambient"] = "ambient";
|
|
809
|
+
})(LightType || (LightType = {}));
|
|
810
|
+
|
|
811
|
+
var ModelBoundingType;
|
|
812
|
+
(function(ModelBoundingType) {
|
|
813
|
+
ModelBoundingType[ModelBoundingType["box"] = 2] = "box";
|
|
814
|
+
ModelBoundingType[ModelBoundingType["sphere"] = 3] = "sphere";
|
|
815
|
+
})(ModelBoundingType || (ModelBoundingType = {}));
|
|
816
|
+
|
|
817
|
+
var CameraType;
|
|
818
|
+
(function(CameraType) {
|
|
819
|
+
CameraType["orthographic"] = "orthographic";
|
|
820
|
+
CameraType["perspective"] = "perspective";
|
|
821
|
+
})(CameraType || (CameraType = {}));
|
|
822
|
+
|
|
823
|
+
// 材质类型
|
|
824
|
+
var MaterialType;
|
|
825
|
+
(function(MaterialType) {
|
|
826
|
+
MaterialType["unlit"] = "unlit";
|
|
827
|
+
MaterialType["pbr"] = "pbr";
|
|
828
|
+
// 头发材质,在 pbr 材质基础上扩展
|
|
829
|
+
MaterialType["hair"] = "hair";
|
|
830
|
+
})(MaterialType || (MaterialType = {}));
|
|
831
|
+
// 混合模式
|
|
832
|
+
var MaterialBlending;
|
|
833
|
+
(function(MaterialBlending) {
|
|
834
|
+
MaterialBlending[MaterialBlending["opaque"] = 100] = "opaque";
|
|
835
|
+
MaterialBlending[MaterialBlending["masked"] = 101] = "masked";
|
|
836
|
+
MaterialBlending[MaterialBlending["translucent"] = 102] = "translucent";
|
|
837
|
+
MaterialBlending[MaterialBlending["additive"] = 103] = "additive";
|
|
838
|
+
})(MaterialBlending || (MaterialBlending = {}));
|
|
839
|
+
|
|
840
|
+
/**
|
|
841
|
+
* 3D渲染模式:将渲染过程中的中间结果输出,主要用于排查渲染效果问题,支持 pbr 和 unlit 材质
|
|
842
|
+
*/ var RenderMode3D;
|
|
843
|
+
(function(RenderMode3D) {
|
|
844
|
+
/**
|
|
845
|
+
* 正常渲染
|
|
846
|
+
*/ RenderMode3D["none"] = "none";
|
|
847
|
+
/**
|
|
848
|
+
* 纹理坐标
|
|
849
|
+
*/ RenderMode3D["uv"] = "uv";
|
|
850
|
+
/**
|
|
851
|
+
* 世界坐标法线
|
|
852
|
+
*/ RenderMode3D["normal"] = "normal";
|
|
853
|
+
/**
|
|
854
|
+
* 基础颜色
|
|
855
|
+
*/ RenderMode3D["basecolor"] = "basecolor";
|
|
856
|
+
/**
|
|
857
|
+
* 基础颜色 Alpha
|
|
858
|
+
*/ RenderMode3D["alpha"] = "alpha";
|
|
859
|
+
/**
|
|
860
|
+
* 金属度
|
|
861
|
+
*/ RenderMode3D["metallic"] = "metallic";
|
|
862
|
+
/**
|
|
863
|
+
* 粗超度
|
|
864
|
+
*/ RenderMode3D["roughness"] = "roughness";
|
|
865
|
+
/**
|
|
866
|
+
* 环境遮蔽
|
|
867
|
+
*/ RenderMode3D["ao"] = "ao";
|
|
868
|
+
/**
|
|
869
|
+
* 自发光
|
|
870
|
+
*/ RenderMode3D["emissive"] = "emissive";
|
|
871
|
+
/**
|
|
872
|
+
* 漫反射
|
|
873
|
+
*/ RenderMode3D["diffuse"] = "diffuse";
|
|
874
|
+
})(RenderMode3D || (RenderMode3D = {}));
|
|
875
|
+
|
|
876
|
+
var TextOverflow;
|
|
877
|
+
(function(TextOverflow) {
|
|
878
|
+
/**
|
|
879
|
+
* visible 模式下,文本内容超出边界框时,会继续显示内容,不进行裁剪或缩放。
|
|
880
|
+
*/ TextOverflow[TextOverflow["visible"] = 0] = "visible";
|
|
881
|
+
/**
|
|
882
|
+
* display 模式下,会显示所有文本,文本字号大小会根据边界框调整。
|
|
883
|
+
*/ TextOverflow[TextOverflow["display"] = 1] = "display";
|
|
884
|
+
/**
|
|
885
|
+
* clip 模式下,当文本内容超出边界框时,多余的会被截断。
|
|
886
|
+
*/ TextOverflow[TextOverflow["clip"] = 2] = "clip";
|
|
887
|
+
/**
|
|
888
|
+
* ellipsis 模式下,会使用(...)来代替超出边界框的内容。
|
|
889
|
+
*/ TextOverflow[TextOverflow["ellipsis"] = 3] = "ellipsis";
|
|
890
|
+
})(TextOverflow || (TextOverflow = {}));
|
|
891
|
+
var TextSizeMode;
|
|
892
|
+
(function(TextSizeMode) {
|
|
893
|
+
/**
|
|
894
|
+
* 自适应宽度
|
|
895
|
+
*/ TextSizeMode[TextSizeMode["autoWidth"] = 0] = "autoWidth";
|
|
896
|
+
/**
|
|
897
|
+
* 自适应高度
|
|
898
|
+
*/ TextSizeMode[TextSizeMode["autoHeight"] = 1] = "autoHeight";
|
|
899
|
+
/**
|
|
900
|
+
* 固定宽高
|
|
901
|
+
*/ TextSizeMode[TextSizeMode["fixed"] = 2] = "fixed";
|
|
902
|
+
})(TextSizeMode || (TextSizeMode = {}));
|
|
903
|
+
var TextBaseline;
|
|
904
|
+
(function(TextBaseline) {
|
|
905
|
+
/**
|
|
906
|
+
* 文本顶对齐。
|
|
907
|
+
*/ TextBaseline[TextBaseline["top"] = 0] = "top";
|
|
908
|
+
/**
|
|
909
|
+
* 文本垂直居中对齐。
|
|
910
|
+
*/ TextBaseline[TextBaseline["middle"] = 1] = "middle";
|
|
911
|
+
/**
|
|
912
|
+
* 文本底对齐。
|
|
913
|
+
*/ TextBaseline[TextBaseline["bottom"] = 2] = "bottom";
|
|
914
|
+
})(TextBaseline || (TextBaseline = {}));
|
|
915
|
+
var TextAlignment;
|
|
916
|
+
(function(TextAlignment) {
|
|
917
|
+
/**
|
|
918
|
+
* text alignment starts from(x,y) to right direction
|
|
919
|
+
* 从 (x,y) 开始第一个字符,向右边延伸
|
|
920
|
+
*/ TextAlignment[TextAlignment["left"] = 0] = "left";
|
|
921
|
+
/**
|
|
922
|
+
* (x,y) is middle position of text, where (left + right)/2 =(x,y)
|
|
923
|
+
* (x,y) 为文字中间位置,(最左位置 + 最右位置)/2 = (x,y)
|
|
924
|
+
*/ TextAlignment[TextAlignment["middle"] = 1] = "middle";
|
|
925
|
+
/**
|
|
926
|
+
* text alignment ends with(x,y) from left direction
|
|
927
|
+
* 从 (x,y) 结束最后一个字符,向左边延伸
|
|
928
|
+
*/ TextAlignment[TextAlignment["right"] = 2] = "right";
|
|
929
|
+
})(TextAlignment || (TextAlignment = {}));
|
|
930
|
+
var TextVerticalAlign;
|
|
931
|
+
(function(TextVerticalAlign) {
|
|
932
|
+
/**
|
|
933
|
+
* 文本顶对齐。
|
|
934
|
+
*/ TextVerticalAlign[TextVerticalAlign["top"] = 0] = "top";
|
|
935
|
+
/**
|
|
936
|
+
* 文本垂直居中对齐。
|
|
937
|
+
*/ TextVerticalAlign[TextVerticalAlign["middle"] = 1] = "middle";
|
|
938
|
+
/**
|
|
939
|
+
* 文本底对齐。
|
|
940
|
+
*/ TextVerticalAlign[TextVerticalAlign["bottom"] = 2] = "bottom";
|
|
941
|
+
})(TextVerticalAlign || (TextVerticalAlign = {}));
|
|
942
|
+
/**
|
|
943
|
+
* 文本字重
|
|
944
|
+
*/ var TextWeight;
|
|
945
|
+
(function(TextWeight) {
|
|
946
|
+
/**
|
|
947
|
+
* 正常
|
|
948
|
+
*/ TextWeight["normal"] = "normal";
|
|
949
|
+
/**
|
|
950
|
+
* 粗体
|
|
951
|
+
*/ TextWeight["bold"] = "bold";
|
|
952
|
+
/**
|
|
953
|
+
* 瘦体
|
|
954
|
+
*/ TextWeight["lighter"] = "lighter";
|
|
955
|
+
})(TextWeight || (TextWeight = {}));
|
|
956
|
+
/**
|
|
957
|
+
* 文本样式
|
|
958
|
+
*/ var FontStyle;
|
|
959
|
+
(function(FontStyle) {
|
|
960
|
+
/**
|
|
961
|
+
* 正常
|
|
962
|
+
*/ FontStyle["normal"] = "normal";
|
|
963
|
+
/**
|
|
964
|
+
* 斜体
|
|
965
|
+
*/ FontStyle["italic"] = "italic";
|
|
966
|
+
/**
|
|
967
|
+
* 倾斜体
|
|
968
|
+
*/ FontStyle["oblique"] = "oblique";
|
|
969
|
+
})(FontStyle || (FontStyle = {}));
|
|
970
|
+
|
|
971
|
+
var FillType;
|
|
972
|
+
(function(FillType) {
|
|
973
|
+
FillType[FillType["Solid"] = 0] = "Solid";
|
|
974
|
+
FillType[FillType["GradientLinear"] = 1] = "GradientLinear";
|
|
975
|
+
FillType[FillType["GradientRadial"] = 2] = "GradientRadial";
|
|
976
|
+
FillType[FillType["GradientAngular"] = 3] = "GradientAngular";
|
|
977
|
+
FillType[FillType["Texture"] = 4] = "Texture";
|
|
978
|
+
})(FillType || (FillType = {}));
|
|
979
|
+
var TexturePaintScaleMode;
|
|
980
|
+
(function(TexturePaintScaleMode) {
|
|
981
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Fill"] = 0] = "Fill";
|
|
982
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Fit"] = 1] = "Fit";
|
|
983
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Crop"] = 2] = "Crop";
|
|
984
|
+
TexturePaintScaleMode[TexturePaintScaleMode["Tile"] = 3] = "Tile";
|
|
985
|
+
})(TexturePaintScaleMode || (TexturePaintScaleMode = {}));
|
|
986
|
+
|
|
987
|
+
/**
|
|
988
|
+
* 矢量图形类型
|
|
989
|
+
*/ var ShapePrimitiveType;
|
|
990
|
+
(function(ShapePrimitiveType) {
|
|
991
|
+
/**
|
|
992
|
+
* 自定义图形
|
|
993
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Custom"] = 0] = "Custom";
|
|
994
|
+
/**
|
|
995
|
+
* 矩形
|
|
996
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Rectangle"] = 1] = "Rectangle";
|
|
997
|
+
/**
|
|
998
|
+
* 椭圆
|
|
999
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Ellipse"] = 2] = "Ellipse";
|
|
1000
|
+
/**
|
|
1001
|
+
* 多边形
|
|
1002
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Polygon"] = 3] = "Polygon";
|
|
1003
|
+
/**
|
|
1004
|
+
* 星形
|
|
1005
|
+
*/ ShapePrimitiveType[ShapePrimitiveType["Star"] = 4] = "Star";
|
|
1006
|
+
})(ShapePrimitiveType || (ShapePrimitiveType = {}));
|
|
1007
|
+
|
|
1008
|
+
var LineCap;
|
|
1009
|
+
(function(LineCap) {
|
|
1010
|
+
/** 默认值。向线条的每个末端添加平直的边缘 */ LineCap[LineCap["Butt"] = 0] = "Butt";
|
|
1011
|
+
/** 向线条的每个末端添加圆形线帽 */ LineCap[LineCap["Round"] = 1] = "Round";
|
|
1012
|
+
/** 向线条的每个末端添加正方形线帽 */ LineCap[LineCap["Square"] = 2] = "Square";
|
|
1013
|
+
})(LineCap || (LineCap = {}));
|
|
1014
|
+
var LineJoin;
|
|
1015
|
+
(function(LineJoin) {
|
|
1016
|
+
/** 创建圆角 */ LineJoin[LineJoin["Round"] = 0] = "Round";
|
|
1017
|
+
/** 创建斜角 */ LineJoin[LineJoin["Bevel"] = 1] = "Bevel";
|
|
1018
|
+
/** 创建尖角 */ LineJoin[LineJoin["Miter"] = 2] = "Miter";
|
|
1019
|
+
})(LineJoin || (LineJoin = {}));
|
|
1020
|
+
|
|
1021
|
+
var NodeDataType;
|
|
1022
|
+
(function(NodeDataType) {
|
|
1023
|
+
NodeDataType["AnimationClipNodeData"] = "AnimationClipNodeData";
|
|
1024
|
+
NodeDataType["BlendNodeData"] = "BlendNodeData";
|
|
1025
|
+
NodeDataType["ApplyAdditiveNodeData"] = "ApplyAdditiveNodeData";
|
|
1026
|
+
NodeDataType["LayerBlendNodeData"] = "LayerBlendNodeData";
|
|
1027
|
+
NodeDataType["StateMachineNodeData"] = "StateMachineNodeData";
|
|
1028
|
+
NodeDataType["TransitionNodeData"] = "TransitionNodeData";
|
|
1029
|
+
NodeDataType["StateNodeData"] = "StateNodeData";
|
|
1030
|
+
NodeDataType["ConstFloatNodeData"] = "ConstFloatNodeData";
|
|
1031
|
+
NodeDataType["ConstBoolNodeData"] = "ConstBoolNodeData";
|
|
1032
|
+
NodeDataType["ControlParameterBoolNodeData"] = "ControlParameterBoolNodeData";
|
|
1033
|
+
NodeDataType["ControlParameterFloatNodeData"] = "ControlParameterFloatNodeData";
|
|
1034
|
+
NodeDataType["ControlParameterTriggerNodeData"] = "ControlParameterTriggerNodeData";
|
|
1035
|
+
NodeDataType["NotNodeData"] = "NotNodeData";
|
|
1036
|
+
NodeDataType["AndNodeData"] = "AndNodeData";
|
|
1037
|
+
NodeDataType["OrNodeData"] = "OrNodeData";
|
|
1038
|
+
NodeDataType["EqualNodeData"] = "EqualNodeData";
|
|
1039
|
+
NodeDataType["GreaterNodeData"] = "GreaterNodeData";
|
|
1040
|
+
NodeDataType["LessNodeData"] = "LessNodeData";
|
|
1041
|
+
})(NodeDataType || (NodeDataType = {}));
|
|
1042
|
+
|
|
1043
|
+
/**
|
|
1044
|
+
* 动态换图类型
|
|
1045
|
+
* @since 1.1.0
|
|
1046
|
+
*/ var BackgroundType;
|
|
1047
|
+
(function(BackgroundType) {
|
|
1048
|
+
BackgroundType["video"] = "video";
|
|
1049
|
+
BackgroundType["image"] = "image";
|
|
1050
|
+
})(BackgroundType || (BackgroundType = {}));
|
|
1051
|
+
/**
|
|
1052
|
+
* 多媒体资源类型
|
|
1053
|
+
* @since 2.1.0
|
|
1054
|
+
*/ var MultimediaType;
|
|
1055
|
+
(function(MultimediaType) {
|
|
1056
|
+
MultimediaType["video"] = "video";
|
|
1057
|
+
MultimediaType["audio"] = "audio";
|
|
1058
|
+
})(MultimediaType || (MultimediaType = {}));
|
|
1059
|
+
var HevcVideoCodec;
|
|
1060
|
+
(function(HevcVideoCodec) {
|
|
1061
|
+
HevcVideoCodec["L30"] = "hev1.1.0.L30.B0";
|
|
1062
|
+
HevcVideoCodec["L60"] = "hev1.1.0.L60.B0";
|
|
1063
|
+
HevcVideoCodec["L63"] = "hev1.1.0.L63.B0";
|
|
1064
|
+
HevcVideoCodec["L90"] = "hev1.1.0.L90.B0";
|
|
1065
|
+
HevcVideoCodec["L93"] = "hev1.1.0.L93.B0";
|
|
1066
|
+
HevcVideoCodec["L120"] = "hev1.1.0.L120.B0";
|
|
1067
|
+
HevcVideoCodec["L150"] = "hev1.1.0.L150.B0";
|
|
1068
|
+
HevcVideoCodec["L180"] = "hev1.1.0.L180.B0";
|
|
1069
|
+
})(HevcVideoCodec || (HevcVideoCodec = {}));
|
|
1070
|
+
|
|
1071
|
+
var DataType;
|
|
1072
|
+
(function(DataType) {
|
|
1073
|
+
DataType["VFXItemData"] = "VFXItemData";
|
|
1074
|
+
// Assets
|
|
1075
|
+
DataType["Material"] = "Material";
|
|
1076
|
+
DataType["Shader"] = "Shader";
|
|
1077
|
+
DataType["Geometry"] = "Geometry";
|
|
1078
|
+
DataType["Texture"] = "Texture";
|
|
1079
|
+
DataType["Image"] = "Image";
|
|
1080
|
+
DataType["AnimationClip"] = "AnimationClip";
|
|
1081
|
+
DataType["BinaryAsset"] = "BinaryAsset";
|
|
1082
|
+
// Timeline
|
|
1083
|
+
DataType["TrackAsset"] = "TrackAsset";
|
|
1084
|
+
DataType["TimelineAsset"] = "TimelineAsset";
|
|
1085
|
+
DataType["ObjectBindingTrack"] = "ObjectBindingTrack";
|
|
1086
|
+
DataType["TransformTrack"] = "TransformTrack";
|
|
1087
|
+
DataType["SpriteColorTrack"] = "SpriteColorTrack";
|
|
1088
|
+
DataType["ActivationTrack"] = "ActivationTrack";
|
|
1089
|
+
DataType["SubCompositionTrack"] = "SubCompositionTrack";
|
|
1090
|
+
DataType["FloatPropertyTrack"] = "FloatPropertyTrack";
|
|
1091
|
+
DataType["ColorPropertyTrack"] = "ColorPropertyTrack";
|
|
1092
|
+
DataType["Vector2PropertyTrack"] = "Vector2PropertyTrack";
|
|
1093
|
+
DataType["Vector3PropertyTrack"] = "Vector3PropertyTrack";
|
|
1094
|
+
DataType["Vector4PropertyTrack"] = "Vector4PropertyTrack";
|
|
1095
|
+
DataType["TransformPlayableAsset"] = "TransformPlayableAsset";
|
|
1096
|
+
DataType["SpriteColorPlayableAsset"] = "SpriteColorPlayableAsset";
|
|
1097
|
+
DataType["ActivationPlayableAsset"] = "ActivationPlayableAsset";
|
|
1098
|
+
DataType["SubCompositionPlayableAsset"] = "SubCompositionPlayableAsset";
|
|
1099
|
+
DataType["FloatPropertyPlayableAsset"] = "FloatPropertyPlayableAsset";
|
|
1100
|
+
DataType["ColorPropertyPlayableAsset"] = "ColorPropertyPlayableAsset";
|
|
1101
|
+
DataType["Vector2PropertyPlayableAsset"] = "Vector2PropertyPlayableAsset";
|
|
1102
|
+
DataType["Vector3PropertyPlayableAsset"] = "Vector3PropertyPlayableAsset";
|
|
1103
|
+
DataType["Vector4PropertyPlayableAsset"] = "Vector4PropertyPlayableAsset";
|
|
1104
|
+
// Components
|
|
1105
|
+
DataType["MeshComponent"] = "MeshComponent";
|
|
1106
|
+
DataType["SkyboxComponent"] = "SkyboxComponent";
|
|
1107
|
+
DataType["LightComponent"] = "LightComponent";
|
|
1108
|
+
DataType["CameraComponent"] = "CameraComponent";
|
|
1109
|
+
DataType["ModelPluginComponent"] = "ModelPluginComponent";
|
|
1110
|
+
DataType["TreeComponent"] = "TreeComponent";
|
|
1111
|
+
DataType["AnimationComponent"] = "AnimationComponent";
|
|
1112
|
+
DataType["SpineComponent"] = "SpineComponent";
|
|
1113
|
+
DataType["VideoComponent"] = "VideoComponent";
|
|
1114
|
+
DataType["AudioComponent"] = "AudioComponent";
|
|
1115
|
+
DataType["RichTextComponent"] = "RichTextComponent";
|
|
1116
|
+
DataType["OrientationComponent"] = "OrientationComponent";
|
|
1117
|
+
DataType["ShapeComponent"] = "ShapeComponent";
|
|
1118
|
+
DataType["SpriteComponent"] = "SpriteComponent";
|
|
1119
|
+
DataType["ParticleSystem"] = "ParticleSystem";
|
|
1120
|
+
DataType["InteractComponent"] = "InteractComponent";
|
|
1121
|
+
DataType["CameraController"] = "CameraController";
|
|
1122
|
+
DataType["PostProcessVolume"] = "PostProcessVolume";
|
|
1123
|
+
DataType["EffectComponent"] = "EffectComponent";
|
|
1124
|
+
DataType["TextComponent"] = "TextComponent";
|
|
1125
|
+
DataType["AnimationGraphAsset"] = "AnimationGraphAsset";
|
|
1126
|
+
DataType["CompositionComponent"] = "CompositionComponent";
|
|
1127
|
+
DataType["FFDComponent"] = "FFDComponent";
|
|
1128
|
+
DataType["FrameComponent"] = "FrameComponent";
|
|
1129
|
+
DataType["Animator"] = "Animator";
|
|
1130
|
+
// Non-EffectObject
|
|
1131
|
+
DataType["TimelineClip"] = "TimelineClip";
|
|
1132
|
+
})(DataType || (DataType = {}));
|
|
1133
|
+
|
|
1134
|
+
var GeometryType;
|
|
1135
|
+
(function(GeometryType) {
|
|
1136
|
+
/**
|
|
1137
|
+
* Draw single points.
|
|
1138
|
+
*/ GeometryType[GeometryType["POINTS"] = 0] = "POINTS";
|
|
1139
|
+
/**
|
|
1140
|
+
* Draw lines. Each vertex connects to the one after it.
|
|
1141
|
+
*/ GeometryType[GeometryType["LINES"] = 1] = "LINES";
|
|
1142
|
+
/**
|
|
1143
|
+
* Draw lines. Each set of two vertices is treated as a separate line segment.
|
|
1144
|
+
*/ GeometryType[GeometryType["LINE_LOOP"] = 2] = "LINE_LOOP";
|
|
1145
|
+
/**
|
|
1146
|
+
* Draw a connected group of line segments from the first vertex to the last.
|
|
1147
|
+
*/ GeometryType[GeometryType["LINE_STRIP"] = 3] = "LINE_STRIP";
|
|
1148
|
+
/**
|
|
1149
|
+
* Draw triangles. Each set of three vertices creates a separate triangle.
|
|
1150
|
+
*/ GeometryType[GeometryType["TRIANGLES"] = 4] = "TRIANGLES";
|
|
1151
|
+
/**
|
|
1152
|
+
* Draw a connected strip of triangles.
|
|
1153
|
+
*/ GeometryType[GeometryType["TRIANGLE_STRIP"] = 5] = "TRIANGLE_STRIP";
|
|
1154
|
+
/**
|
|
1155
|
+
* Draw a connected group of triangles. Each vertex connects to the previous and the first vertex in the fan.
|
|
1156
|
+
*/ GeometryType[GeometryType["TRIANGLE_FAN"] = 6] = "TRIANGLE_FAN";
|
|
1157
|
+
})(GeometryType || (GeometryType = {}));
|
|
1158
|
+
var VertexFormatType;
|
|
1159
|
+
(function(VertexFormatType) {
|
|
1160
|
+
VertexFormatType[VertexFormatType["Float16"] = 0] = "Float16";
|
|
1161
|
+
VertexFormatType[VertexFormatType["Float32"] = 1] = "Float32";
|
|
1162
|
+
VertexFormatType[VertexFormatType["Int8"] = 2] = "Int8";
|
|
1163
|
+
VertexFormatType[VertexFormatType["Int16"] = 3] = "Int16";
|
|
1164
|
+
VertexFormatType[VertexFormatType["Int32"] = 4] = "Int32";
|
|
1165
|
+
VertexFormatType[VertexFormatType["UInt8"] = 5] = "UInt8";
|
|
1166
|
+
VertexFormatType[VertexFormatType["UInt16"] = 6] = "UInt16";
|
|
1167
|
+
VertexFormatType[VertexFormatType["UInt32"] = 7] = "UInt32";
|
|
1168
|
+
})(VertexFormatType || (VertexFormatType = {}));
|
|
1169
|
+
var IndexFormatType;
|
|
1170
|
+
(function(IndexFormatType) {
|
|
1171
|
+
IndexFormatType[IndexFormatType["None"] = -1] = "None";
|
|
1172
|
+
IndexFormatType[IndexFormatType["UInt8"] = 0] = "UInt8";
|
|
1173
|
+
IndexFormatType[IndexFormatType["UInt16"] = 1] = "UInt16";
|
|
1174
|
+
IndexFormatType[IndexFormatType["UInt32"] = 2] = "UInt32";
|
|
1175
|
+
})(IndexFormatType || (IndexFormatType = {}));
|
|
1176
|
+
// BINORMAL[n] Binormal float4
|
|
1177
|
+
// BLENDINDICES[n] 混合索引 uint
|
|
1178
|
+
// BLENDWEIGHT[n] 混合权重 FLOAT
|
|
1179
|
+
// COLOR[n] 漫射和反射颜色 float4
|
|
1180
|
+
// NORMAL[n] 法向矢量 float4
|
|
1181
|
+
// POSITION[n] 对象空间中的顶点位置。 float4
|
|
1182
|
+
// POSITIONT 变换的顶点位置。 float4
|
|
1183
|
+
// PSIZE[n] 点大小 FLOAT
|
|
1184
|
+
// TANGENT[n] 正切 float4
|
|
1185
|
+
// TEXCOORD[n] 纹理坐标 float4
|
|
1186
|
+
// POSITION_BS[n] Blend Shape 空间中的顶点位置 float4
|
|
1187
|
+
// NORMAL_BS[n] Blend Shape 空间中的法向矢量 float4
|
|
1188
|
+
// TANGENT_BS[n] Blend Shape 空间中的正切矢量 float4
|
|
1189
|
+
var VertexBufferSemantic;
|
|
1190
|
+
(function(VertexBufferSemantic) {
|
|
1191
|
+
VertexBufferSemantic["Position"] = "POSITION";
|
|
1192
|
+
VertexBufferSemantic["Uv"] = "TEXCOORD0";
|
|
1193
|
+
VertexBufferSemantic["Uv2"] = "TEXCOORD1";
|
|
1194
|
+
VertexBufferSemantic["Normal"] = "NORMAL";
|
|
1195
|
+
VertexBufferSemantic["Tangent"] = "TANGENT";
|
|
1196
|
+
VertexBufferSemantic["Color"] = "COLOR";
|
|
1197
|
+
VertexBufferSemantic["Joints"] = "JOINTS";
|
|
1198
|
+
VertexBufferSemantic["Weights"] = "WEIGHTS";
|
|
1199
|
+
//
|
|
1200
|
+
VertexBufferSemantic["PositionBS0"] = "POSITION_BS0";
|
|
1201
|
+
VertexBufferSemantic["PositionBS1"] = "POSITION_BS1";
|
|
1202
|
+
VertexBufferSemantic["PositionBS2"] = "POSITION_BS2";
|
|
1203
|
+
VertexBufferSemantic["PositionBS3"] = "POSITION_BS3";
|
|
1204
|
+
VertexBufferSemantic["PositionBS4"] = "POSITION_BS4";
|
|
1205
|
+
VertexBufferSemantic["PositionBS5"] = "POSITION_BS5";
|
|
1206
|
+
VertexBufferSemantic["PositionBS6"] = "POSITION_BS6";
|
|
1207
|
+
VertexBufferSemantic["PositionBS7"] = "POSITION_BS7";
|
|
1208
|
+
VertexBufferSemantic["NormalBS0"] = "NORMAL_BS0";
|
|
1209
|
+
VertexBufferSemantic["NormalBS1"] = "NORMAL_BS1";
|
|
1210
|
+
VertexBufferSemantic["NormalBS2"] = "NORMAL_BS2";
|
|
1211
|
+
VertexBufferSemantic["NormalBS3"] = "NORMAL_BS3";
|
|
1212
|
+
VertexBufferSemantic["TangentBS0"] = "TANGENT_BS0";
|
|
1213
|
+
VertexBufferSemantic["TangentBS1"] = "TANGENT_BS1";
|
|
1214
|
+
VertexBufferSemantic["TangentBS2"] = "TANGENT_BS2";
|
|
1215
|
+
VertexBufferSemantic["TangentBS3"] = "TANGENT_BS3";
|
|
1216
|
+
})(VertexBufferSemantic || (VertexBufferSemantic = {}));
|
|
1217
|
+
|
|
1218
|
+
JSONSceneVersion.LATEST;
|
|
1219
|
+
|
|
263
1220
|
var DEFAULT_OUT_TANGENT = {
|
|
264
1221
|
x: 0.33,
|
|
265
1222
|
y: 0.33
|
|
@@ -324,36 +1281,29 @@ function getScalarValue(keyframe, dimensionIndex) {
|
|
|
324
1281
|
for(var i = 0; i < keyframes.length; i++){
|
|
325
1282
|
var _kf_outTangent, _kf_inTangent;
|
|
326
1283
|
var kf = keyframes[i];
|
|
327
|
-
var normalizedT = normalizeTime(kf.
|
|
1284
|
+
var normalizedT = normalizeTime(kf.frame, timeContext.startFrame, timeContext.endFrame);
|
|
328
1285
|
timingCurvePoints.push({
|
|
329
1286
|
t: normalizedT,
|
|
330
1287
|
outTangent: (_kf_outTangent = kf.outTangent) != null ? _kf_outTangent : DEFAULT_OUT_TANGENT,
|
|
331
1288
|
inTangent: (_kf_inTangent = kf.inTangent) != null ? _kf_inTangent : DEFAULT_IN_TANGENT
|
|
332
1289
|
});
|
|
333
1290
|
if (i < keyframes.length - 1) {
|
|
334
|
-
var _kf_value,
|
|
1291
|
+
var _kf_value, _ref, _kf_endValue, _startPos_, _startPos_1, _segmentEnd_, _segmentEnd_1;
|
|
335
1292
|
var nextKf = keyframes[i + 1];
|
|
336
1293
|
var startPos = (_kf_value = kf.value) != null ? _kf_value : [
|
|
337
1294
|
0,
|
|
338
1295
|
0,
|
|
339
1296
|
0
|
|
340
1297
|
];
|
|
341
|
-
|
|
342
|
-
// nextKf.value is only used later in the path-fixup pass to stitch adjacent segments.
|
|
343
|
-
var segmentEnd = kf.hold === true ? startPos : (_kf_endValue = kf.endValue) != null ? _kf_endValue : startPos;
|
|
344
|
-
var stitchEnd = kf.hold === true ? startPos : (_nextKf_value = nextKf.value) != null ? _nextKf_value : [
|
|
345
|
-
0,
|
|
346
|
-
0,
|
|
347
|
-
0
|
|
348
|
-
];
|
|
1298
|
+
var segmentEnd = kf.hold === true ? startPos : (_ref = (_kf_endValue = kf.endValue) != null ? _kf_endValue : nextKf.value) != null ? _ref : startPos;
|
|
349
1299
|
pathPoints.push([
|
|
350
1300
|
[
|
|
351
1301
|
(_startPos_ = startPos[0]) != null ? _startPos_ : 0,
|
|
352
1302
|
(_startPos_1 = startPos[1]) != null ? _startPos_1 : 0
|
|
353
1303
|
],
|
|
354
1304
|
[
|
|
355
|
-
(
|
|
356
|
-
(
|
|
1305
|
+
(_segmentEnd_ = segmentEnd[0]) != null ? _segmentEnd_ : 0,
|
|
1306
|
+
(_segmentEnd_1 = segmentEnd[1]) != null ? _segmentEnd_1 : 0
|
|
357
1307
|
]
|
|
358
1308
|
]);
|
|
359
1309
|
// Spatial control points (per IRKeyframe convention): outgoing CP from
|
|
@@ -372,11 +1322,11 @@ function getScalarValue(keyframe, dimensionIndex) {
|
|
|
372
1322
|
(_nextKf_spatialIn_1 = nextKf.spatialIn[1]) != null ? _nextKf_spatialIn_1 : 0
|
|
373
1323
|
];
|
|
374
1324
|
} else {
|
|
375
|
-
var _startPos_2, _startPos_3,
|
|
1325
|
+
var _startPos_2, _startPos_3, _segmentEnd_2, _segmentEnd_3;
|
|
376
1326
|
var sx = (_startPos_2 = startPos[0]) != null ? _startPos_2 : 0;
|
|
377
1327
|
var sy = (_startPos_3 = startPos[1]) != null ? _startPos_3 : 0;
|
|
378
|
-
var ex = (
|
|
379
|
-
var ey = (
|
|
1328
|
+
var ex = (_segmentEnd_2 = segmentEnd[0]) != null ? _segmentEnd_2 : 0;
|
|
1329
|
+
var ey = (_segmentEnd_3 = segmentEnd[1]) != null ? _segmentEnd_3 : 0;
|
|
380
1330
|
toPoint = [
|
|
381
1331
|
-sx / 3 + ex / 3,
|
|
382
1332
|
-sy / 3 + ey / 3
|
|
@@ -392,10 +1342,6 @@ function getScalarValue(keyframe, dimensionIndex) {
|
|
|
392
1342
|
]);
|
|
393
1343
|
}
|
|
394
1344
|
}
|
|
395
|
-
// Fix up path points: adjacent segments should share endpoints
|
|
396
|
-
for(var i1 = 0; i1 < pathPoints.length - 1; i1++){
|
|
397
|
-
pathPoints[i1][1] = pathPoints[i1 + 1][0];
|
|
398
|
-
}
|
|
399
1345
|
// Prepend a static segment if the first keyframe doesn't start at t=0.
|
|
400
1346
|
// The bridge segment runs synthetic-at-t=0 → original-kf[0]; for it to be a
|
|
401
1347
|
// flat hold the END-side tangent (which `buildPositionTimingCurves` reads as
|
|
@@ -404,7 +1350,7 @@ function getScalarValue(keyframe, dimensionIndex) {
|
|
|
404
1350
|
// the IR convention leaves a first-kf inTangent undefined, or whatever the
|
|
405
1351
|
// producer set as a no-op).
|
|
406
1352
|
if (timingCurvePoints.length > 0 && timingCurvePoints[0].t > 0) {
|
|
407
|
-
var
|
|
1353
|
+
var _ref1, _ref2;
|
|
408
1354
|
var _pathPoints_, _pathPoints_1;
|
|
409
1355
|
timingCurvePoints[0].inTangent = {
|
|
410
1356
|
x: 1,
|
|
@@ -422,11 +1368,11 @@ function getScalarValue(keyframe, dimensionIndex) {
|
|
|
422
1368
|
}
|
|
423
1369
|
});
|
|
424
1370
|
pathPoints.unshift([
|
|
425
|
-
(
|
|
1371
|
+
(_ref1 = (_pathPoints_ = pathPoints[0]) == null ? void 0 : _pathPoints_[0]) != null ? _ref1 : [
|
|
426
1372
|
0,
|
|
427
1373
|
0
|
|
428
1374
|
],
|
|
429
|
-
(
|
|
1375
|
+
(_ref2 = (_pathPoints_1 = pathPoints[0]) == null ? void 0 : _pathPoints_1[0]) != null ? _ref2 : [
|
|
430
1376
|
0,
|
|
431
1377
|
0
|
|
432
1378
|
]
|
|
@@ -457,31 +1403,31 @@ function getScalarValue(keyframe, dimensionIndex) {
|
|
|
457
1403
|
// ─── Internal helpers ───────────────────────────────────────
|
|
458
1404
|
function makeEaseOut(seg) {
|
|
459
1405
|
return [
|
|
460
|
-
|
|
1406
|
+
BezierKeyframeType.EASE_OUT,
|
|
461
1407
|
[
|
|
462
1408
|
roundNumber(seg[0], 4),
|
|
463
1409
|
roundNumber(seg[1], 4),
|
|
464
1410
|
roundNumber(seg[2], 4),
|
|
465
1411
|
roundNumber(seg[3], 4)
|
|
466
1412
|
],
|
|
467
|
-
|
|
1413
|
+
BezierKeyframeType.EASE_OUT
|
|
468
1414
|
];
|
|
469
1415
|
}
|
|
470
1416
|
function makeEaseIn(prevSeg) {
|
|
471
1417
|
return [
|
|
472
|
-
|
|
1418
|
+
BezierKeyframeType.EASE_IN,
|
|
473
1419
|
[
|
|
474
1420
|
roundNumber(prevSeg[4], 4),
|
|
475
1421
|
roundNumber(prevSeg[5], 4),
|
|
476
1422
|
roundNumber(prevSeg[6], 4),
|
|
477
1423
|
roundNumber(prevSeg[7], 4)
|
|
478
1424
|
],
|
|
479
|
-
|
|
1425
|
+
BezierKeyframeType.EASE_IN
|
|
480
1426
|
];
|
|
481
1427
|
}
|
|
482
1428
|
function makeEase(prevSeg, currSeg) {
|
|
483
1429
|
return [
|
|
484
|
-
|
|
1430
|
+
BezierKeyframeType.EASE,
|
|
485
1431
|
[
|
|
486
1432
|
roundNumber(prevSeg[4], 4),
|
|
487
1433
|
roundNumber(prevSeg[5], 4),
|
|
@@ -490,7 +1436,7 @@ function makeEase(prevSeg, currSeg) {
|
|
|
490
1436
|
roundNumber(currSeg[2], 4),
|
|
491
1437
|
roundNumber(currSeg[3], 4)
|
|
492
1438
|
],
|
|
493
|
-
|
|
1439
|
+
BezierKeyframeType.EASE
|
|
494
1440
|
];
|
|
495
1441
|
}
|
|
496
1442
|
function buildCurveForDimension(keyframes, timeContext, dimensionIndex) {
|
|
@@ -503,10 +1449,13 @@ function buildCurveForDimension(keyframes, timeContext, dimensionIndex) {
|
|
|
503
1449
|
var _kf_outTangent, _nextKf_inTangent;
|
|
504
1450
|
var kf = keyframes[i];
|
|
505
1451
|
var nextKf = keyframes[i + 1];
|
|
506
|
-
var t0 = normalizeTime(kf.
|
|
507
|
-
var t1 = normalizeTime(nextKf.
|
|
1452
|
+
var t0 = normalizeTime(kf.frame, timeContext.startFrame, timeContext.endFrame);
|
|
1453
|
+
var t1 = normalizeTime(nextKf.frame, timeContext.startFrame, timeContext.endFrame);
|
|
508
1454
|
var v0 = getScalarValue(kf, dimensionIndex);
|
|
509
|
-
var
|
|
1455
|
+
var endKeyframe = kf.endValue != null ? _extends({}, kf, {
|
|
1456
|
+
value: kf.endValue
|
|
1457
|
+
}) : nextKf;
|
|
1458
|
+
var v1 = kf.hold === true ? v0 : getScalarValue(endKeyframe, dimensionIndex);
|
|
510
1459
|
var outHandle = kf.hold === true ? {
|
|
511
1460
|
x: 0,
|
|
512
1461
|
y: 0
|
|
@@ -613,20 +1562,11 @@ function buildPositionTimingCurves(points) {
|
|
|
613
1562
|
}
|
|
614
1563
|
|
|
615
1564
|
/**
|
|
616
|
-
* True when the
|
|
617
|
-
*
|
|
618
|
-
|
|
619
|
-
* Reads `IRLayerReference.linkKind` directly. Producers that don't set the
|
|
620
|
-
* field (e.g. dsl2ge) effectively get `false` here, which is the correct
|
|
621
|
-
* default for "full" parent containment.
|
|
622
|
-
*
|
|
623
|
-
* Lottie's parser sets `linkKind: 'transform-only'` when a child's parent
|
|
624
|
-
* relationship comes from `layer.parent` rather than precomp expansion;
|
|
625
|
-
* `applyPostProcess` consumes this to decide whether to advance the parent's
|
|
626
|
-
* activation track when the child starts earlier.
|
|
627
|
-
*/ function isTransformOnlyParentLink(layer) {
|
|
1565
|
+
* True when the child lifetime is independent of its transform parent's
|
|
1566
|
+
* clipping window. An omitted lifetimeMode keeps the legacy clipped default.
|
|
1567
|
+
*/ function hasIndependentParentLifetime(layer) {
|
|
628
1568
|
var _layer_parent;
|
|
629
|
-
return ((_layer_parent = layer.parent) == null ? void 0 : _layer_parent.
|
|
1569
|
+
return ((_layer_parent = layer.parent) == null ? void 0 : _layer_parent.lifetimeMode) === 'independent';
|
|
630
1570
|
}
|
|
631
1571
|
|
|
632
1572
|
/**
|
|
@@ -634,18 +1574,19 @@ function buildPositionTimingCurves(points) {
|
|
|
634
1574
|
* the time-stretch and offset semantics from `IRTimeContext`.
|
|
635
1575
|
*
|
|
636
1576
|
* dsl-source IRs leave `stretch` and `offsetFrame` undefined, in which case
|
|
637
|
-
* this collapses to `delay = startFrame / fr` and
|
|
1577
|
+
* this collapses to `delay = (startFrame - compositionInPoint) / fr` and
|
|
638
1578
|
* `duration = (endFrame - startFrame) / fr` — exactly what dsl2ge used to
|
|
639
1579
|
* compute inline.
|
|
640
1580
|
*
|
|
641
1581
|
* Zero/negative durations are clamped to a 0.0001 epsilon so GE keeps the
|
|
642
1582
|
* activation track alive for the (degenerate) layer.
|
|
643
|
-
*/ function computeLayerTiming(layer, frameRate) {
|
|
1583
|
+
*/ function computeLayerTiming(layer, frameRate, compositionInPoint) {
|
|
1584
|
+
if (compositionInPoint === void 0) compositionInPoint = 0;
|
|
644
1585
|
var _time_stretch, _time_offsetFrame;
|
|
645
1586
|
var time = layer.time;
|
|
646
1587
|
var stretch = (_time_stretch = time.stretch) != null ? _time_stretch : 1;
|
|
647
1588
|
var offsetFrame = (_time_offsetFrame = time.offsetFrame) != null ? _time_offsetFrame : 0;
|
|
648
|
-
var delay = roundNumber((offsetFrame + time.startFrame * stretch) / frameRate, 4);
|
|
1589
|
+
var delay = roundNumber((offsetFrame + time.startFrame * stretch - compositionInPoint) / frameRate, 4);
|
|
649
1590
|
var rawDuration = (time.endFrame - time.startFrame) * stretch / frameRate;
|
|
650
1591
|
var layerDuration = rawDuration > 0 ? roundNumber(rawDuration, 4) : 0.0001;
|
|
651
1592
|
return {
|
|
@@ -657,37 +1598,29 @@ function buildPositionTimingCurves(points) {
|
|
|
657
1598
|
function computeStaticPosition(layer, ctx, anchorOffsetX, anchorOffsetY) {
|
|
658
1599
|
if (anchorOffsetX === void 0) anchorOffsetX = 0;
|
|
659
1600
|
if (anchorOffsetY === void 0) anchorOffsetY = 0;
|
|
660
|
-
var _transform_position;
|
|
1601
|
+
var _transform_position, _transform_position1, _transform_position_keyframes_, _transform_position2;
|
|
661
1602
|
var transform = layer.transform;
|
|
662
|
-
if (transform == null ? void 0 : (_transform_position = transform.position) == null ? void 0 : _transform_position.keyframed) {
|
|
1603
|
+
if ((transform == null ? void 0 : (_transform_position = transform.position) == null ? void 0 : _transform_position.keyframed) === true && transform.position.keyframes.length !== 1) {
|
|
663
1604
|
return convert2dTo3dPoint(ctx.width / 2 + anchorOffsetX, ctx.height / 2 + anchorOffsetY, 0, ctx.width, ctx.height);
|
|
664
1605
|
}
|
|
665
1606
|
var isNullType = layer.type === 'null' || layer.type === 'precomp';
|
|
666
|
-
|
|
1607
|
+
var positionValue = (transform == null ? void 0 : (_transform_position1 = transform.position) == null ? void 0 : _transform_position1.keyframed) === true ? (_transform_position_keyframes_ = transform.position.keyframes[0]) == null ? void 0 : _transform_position_keyframes_.value : transform == null ? void 0 : (_transform_position2 = transform.position) == null ? void 0 : _transform_position2.value;
|
|
1608
|
+
if (Array.isArray(positionValue)) {
|
|
667
1609
|
var _pos_, _pos_1, _pos_2;
|
|
668
|
-
var pos =
|
|
1610
|
+
var pos = positionValue;
|
|
669
1611
|
return convert2dTo3dPoint(((_pos_ = pos[0]) != null ? _pos_ : 0) + anchorOffsetX, ((_pos_1 = pos[1]) != null ? _pos_1 : 0) + anchorOffsetY, isNullType ? 0 : (_pos_2 = pos[2]) != null ? _pos_2 : 0, ctx.width, ctx.height);
|
|
670
1612
|
}
|
|
671
1613
|
return convert2dTo3dPoint(ctx.width / 2 + anchorOffsetX, ctx.height / 2 + anchorOffsetY, 0, ctx.width, ctx.height);
|
|
672
1614
|
}
|
|
673
1615
|
function getStaticAnchor(layer) {
|
|
674
|
-
var _layer_transform;
|
|
675
|
-
var
|
|
676
|
-
if (
|
|
1616
|
+
var _layer_transform_anchor, _layer_transform;
|
|
1617
|
+
var value = (_layer_transform = layer.transform) == null ? void 0 : (_layer_transform_anchor = _layer_transform.anchor) == null ? void 0 : _layer_transform_anchor.value;
|
|
1618
|
+
if (Array.isArray(value) && value.length >= 2) {
|
|
677
1619
|
return [
|
|
678
|
-
|
|
679
|
-
|
|
1620
|
+
value[0],
|
|
1621
|
+
value[1]
|
|
680
1622
|
];
|
|
681
1623
|
}
|
|
682
|
-
if ((anchor == null ? void 0 : anchor.keyframed) && anchor.keyframes != null && anchor.keyframes.length > 0) {
|
|
683
|
-
var firstVal = anchor.keyframes[0].value;
|
|
684
|
-
if (Array.isArray(firstVal) && firstVal.length >= 2) {
|
|
685
|
-
return [
|
|
686
|
-
firstVal[0],
|
|
687
|
-
firstVal[1]
|
|
688
|
-
];
|
|
689
|
-
}
|
|
690
|
-
}
|
|
691
1624
|
return [
|
|
692
1625
|
0,
|
|
693
1626
|
0
|
|
@@ -695,15 +1628,21 @@ function getStaticAnchor(layer) {
|
|
|
695
1628
|
}
|
|
696
1629
|
function getStaticScaleFromIR(layer) {
|
|
697
1630
|
var _value_, _value_1;
|
|
698
|
-
var _layer_transform;
|
|
1631
|
+
var _layer_transform, _scale_keyframes_;
|
|
699
1632
|
var scale = (_layer_transform = layer.transform) == null ? void 0 : _layer_transform.scale;
|
|
700
|
-
if (scale == null
|
|
1633
|
+
if (scale == null) {
|
|
701
1634
|
return [
|
|
702
1635
|
1,
|
|
703
1636
|
1
|
|
704
1637
|
];
|
|
705
1638
|
}
|
|
706
|
-
|
|
1639
|
+
if (scale.keyframed && scale.keyframes.length !== 1) {
|
|
1640
|
+
return [
|
|
1641
|
+
1,
|
|
1642
|
+
1
|
|
1643
|
+
];
|
|
1644
|
+
}
|
|
1645
|
+
var value = scale.keyframed ? (_scale_keyframes_ = scale.keyframes[0]) == null ? void 0 : _scale_keyframes_.value : scale.value;
|
|
707
1646
|
if (!Array.isArray(value)) {
|
|
708
1647
|
return [
|
|
709
1648
|
1,
|
|
@@ -715,14 +1654,15 @@ function getStaticScaleFromIR(layer) {
|
|
|
715
1654
|
(_value_1 = value[1]) != null ? _value_1 : 1
|
|
716
1655
|
];
|
|
717
1656
|
}
|
|
718
|
-
function applyScalePositionAdjust(position, layer,
|
|
1657
|
+
function applyScalePositionAdjust(position, layer, bounds, ratio) {
|
|
719
1658
|
var staticScale = getStaticScaleFromIR(layer);
|
|
720
|
-
|
|
1659
|
+
var x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height;
|
|
1660
|
+
if (staticScale[0] === 1 && staticScale[1] === 1 || width <= 0 || height <= 0) {
|
|
721
1661
|
return position;
|
|
722
1662
|
}
|
|
723
1663
|
var anchor = getStaticAnchor(layer);
|
|
724
|
-
var anchorDiffX = anchor[0] -
|
|
725
|
-
var anchorDiffY = anchor[1] -
|
|
1664
|
+
var anchorDiffX = anchor[0] - (x + width / 2);
|
|
1665
|
+
var anchorDiffY = anchor[1] - (y + height / 2);
|
|
726
1666
|
if (Math.abs(anchorDiffX) <= 0.5 && Math.abs(anchorDiffY) <= 0.5) {
|
|
727
1667
|
return position;
|
|
728
1668
|
}
|
|
@@ -732,43 +1672,46 @@ function applyScalePositionAdjust(position, layer, layerWidth, layerHeight, rati
|
|
|
732
1672
|
position[2]
|
|
733
1673
|
];
|
|
734
1674
|
}
|
|
735
|
-
function computeAnchorInfo(layer,
|
|
1675
|
+
function computeAnchorInfo(layer, bounds) {
|
|
736
1676
|
var anchor = getStaticAnchor(layer);
|
|
1677
|
+
var x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height;
|
|
1678
|
+
var localAnchorX = anchor[0] - x;
|
|
1679
|
+
var localAnchorY = anchor[1] - y;
|
|
737
1680
|
var anchorScaleX = 0.5;
|
|
738
1681
|
var anchorScaleY = 0.5;
|
|
739
1682
|
var anchorOffsetX = 0;
|
|
740
1683
|
var anchorOffsetY = 0;
|
|
741
|
-
if (
|
|
742
|
-
anchorScaleX =
|
|
743
|
-
anchorScaleY =
|
|
744
|
-
anchorOffsetX = -(
|
|
745
|
-
anchorOffsetY = -(
|
|
1684
|
+
if (width > 0 && height > 0) {
|
|
1685
|
+
anchorScaleX = localAnchorX / width;
|
|
1686
|
+
anchorScaleY = localAnchorY / height;
|
|
1687
|
+
anchorOffsetX = -(localAnchorX - width / 2);
|
|
1688
|
+
anchorOffsetY = -(localAnchorY - height / 2);
|
|
746
1689
|
}
|
|
747
|
-
if (layer.type === 'text' && layer.text != null &&
|
|
1690
|
+
if (layer.type === 'text' && layer.text != null && width > 0 && height > 0) {
|
|
748
1691
|
if (layer.text.anchorAdjust === true) {
|
|
749
1692
|
if (layer.text.textAlign === 'left') {
|
|
750
|
-
anchorOffsetX = -(
|
|
751
|
-
anchorScaleX =
|
|
1693
|
+
anchorOffsetX = -(localAnchorX - width / 2);
|
|
1694
|
+
anchorScaleX = localAnchorX / width - 0.5;
|
|
752
1695
|
}
|
|
753
1696
|
if (layer.text.textAlign === 'center') {
|
|
754
|
-
anchorOffsetX = -
|
|
755
|
-
anchorScaleX =
|
|
1697
|
+
anchorOffsetX = -localAnchorX;
|
|
1698
|
+
anchorScaleX = localAnchorX / width + 0.5;
|
|
756
1699
|
}
|
|
757
1700
|
if (layer.text.textAlign === 'right') {
|
|
758
|
-
anchorOffsetX = -(
|
|
759
|
-
anchorScaleX =
|
|
1701
|
+
anchorOffsetX = -(localAnchorX + width / 2);
|
|
1702
|
+
anchorScaleX = localAnchorX / width + 1.5;
|
|
760
1703
|
}
|
|
761
1704
|
// GE renders glyphs in the lower half of the quad, so offset by half the
|
|
762
1705
|
// layer height to align the visible text center with Lottie's anchor.
|
|
763
|
-
var textHeight =
|
|
764
|
-
anchorOffsetY = -(
|
|
765
|
-
anchorScaleY = -
|
|
1706
|
+
var textHeight = height / 2;
|
|
1707
|
+
anchorOffsetY = -(localAnchorY + textHeight);
|
|
1708
|
+
anchorScaleY = -localAnchorY / textHeight;
|
|
766
1709
|
}
|
|
767
1710
|
}
|
|
768
1711
|
var isSpriteForAnchor = layer.type === 'image' || layer.type === 'solid';
|
|
769
1712
|
var staticRotationZ = getStaticRotationZ(layer);
|
|
770
1713
|
var hasStaticRotation = staticRotationZ != null;
|
|
771
|
-
if (isSpriteForAnchor && hasStaticRotation &&
|
|
1714
|
+
if (isSpriteForAnchor && hasStaticRotation && hasIndependentParentLifetime(layer) && (anchorOffsetX !== 0 || anchorOffsetY !== 0)) {
|
|
772
1715
|
var rotValue = staticRotationZ != null ? staticRotationZ : 0;
|
|
773
1716
|
if (rotValue !== 0) {
|
|
774
1717
|
var rad = rotValue * Math.PI / 180;
|
|
@@ -788,15 +1731,10 @@ function computeAnchorInfo(layer, layerWidth, layerHeight) {
|
|
|
788
1731
|
};
|
|
789
1732
|
}
|
|
790
1733
|
function getStaticRotationZ(layer) {
|
|
791
|
-
var
|
|
792
|
-
var
|
|
793
|
-
if (
|
|
794
|
-
|
|
795
|
-
return (_rotation_value_ = rotation.value[2]) != null ? _rotation_value_ : 0;
|
|
796
|
-
}
|
|
797
|
-
var separatedRotationZ = (_layer_transform1 = layer.transform) == null ? void 0 : (_layer_transform_separatedRotation = _layer_transform1.separatedRotation) == null ? void 0 : _layer_transform_separatedRotation.z;
|
|
798
|
-
if (separatedRotationZ != null && !separatedRotationZ.keyframed && typeof separatedRotationZ.value === 'number') {
|
|
799
|
-
return separatedRotationZ.value;
|
|
1734
|
+
var _layer_transform_rotation, _layer_transform;
|
|
1735
|
+
var rotationZ = (_layer_transform = layer.transform) == null ? void 0 : (_layer_transform_rotation = _layer_transform.rotation) == null ? void 0 : _layer_transform_rotation.z;
|
|
1736
|
+
if (rotationZ != null && !rotationZ.keyframed && typeof rotationZ.value === 'number') {
|
|
1737
|
+
return rotationZ.value;
|
|
800
1738
|
}
|
|
801
1739
|
return undefined;
|
|
802
1740
|
}
|
|
@@ -807,86 +1745,20 @@ function getTimeContext(layer) {
|
|
|
807
1745
|
};
|
|
808
1746
|
}
|
|
809
1747
|
|
|
810
|
-
function readGE2IRMetadata(ir, layer) {
|
|
811
|
-
if (ir.source !== 'ge') {
|
|
812
|
-
return undefined;
|
|
813
|
-
}
|
|
814
|
-
var metadata = layer.metadata;
|
|
815
|
-
if (metadata == null) {
|
|
816
|
-
return undefined;
|
|
817
|
-
}
|
|
818
|
-
var namespaced = metadata['ge2ir'];
|
|
819
|
-
if (isRecord$4(namespaced)) {
|
|
820
|
-
return namespaced;
|
|
821
|
-
}
|
|
822
|
-
var legacy = readLegacyGE2IRMetadata(metadata);
|
|
823
|
-
return Object.keys(legacy).length > 0 ? legacy : undefined;
|
|
824
|
-
}
|
|
825
|
-
function readLegacyGE2IRMetadata(metadata) {
|
|
826
|
-
var legacy = {};
|
|
827
|
-
var positionOverLifetime = metadata['positionOverLifetime'];
|
|
828
|
-
var rotationOverLifetime = metadata['rotationOverLifetime'];
|
|
829
|
-
var sizeOverLifetime = metadata['sizeOverLifetime'];
|
|
830
|
-
var colorOverLifetime = metadata['colorOverLifetime'];
|
|
831
|
-
var geComponentId = metadata['geComponentId'];
|
|
832
|
-
var geMask = metadata['geMask'];
|
|
833
|
-
var precompRefId = metadata['precompRefId'];
|
|
834
|
-
var precompContent = metadata['precompContent'];
|
|
835
|
-
if (isRecord$4(positionOverLifetime)) {
|
|
836
|
-
legacy.positionOverLifetime = positionOverLifetime;
|
|
837
|
-
}
|
|
838
|
-
if (isRecord$4(rotationOverLifetime)) {
|
|
839
|
-
legacy.rotationOverLifetime = rotationOverLifetime;
|
|
840
|
-
}
|
|
841
|
-
if (isRecord$4(sizeOverLifetime)) {
|
|
842
|
-
legacy.sizeOverLifetime = sizeOverLifetime;
|
|
843
|
-
}
|
|
844
|
-
if (isRecord$4(colorOverLifetime)) {
|
|
845
|
-
legacy.colorOverLifetime = colorOverLifetime;
|
|
846
|
-
}
|
|
847
|
-
if (typeof geComponentId === 'string') {
|
|
848
|
-
legacy.geComponentId = geComponentId;
|
|
849
|
-
}
|
|
850
|
-
if (isRecord$4(geMask)) {
|
|
851
|
-
legacy.geMask = geMask;
|
|
852
|
-
}
|
|
853
|
-
if (typeof precompRefId === 'string') {
|
|
854
|
-
legacy.precompRefId = precompRefId;
|
|
855
|
-
}
|
|
856
|
-
if (isRecord$4(precompContent)) {
|
|
857
|
-
legacy.precompContent = precompContent;
|
|
858
|
-
}
|
|
859
|
-
return legacy;
|
|
860
|
-
}
|
|
861
|
-
function readGE2IRCompositionMetadata(ir) {
|
|
862
|
-
if (ir.source !== 'ge') {
|
|
863
|
-
return undefined;
|
|
864
|
-
}
|
|
865
|
-
var metadata = ir.metadata;
|
|
866
|
-
if (metadata == null) {
|
|
867
|
-
return undefined;
|
|
868
|
-
}
|
|
869
|
-
var namespaced = metadata['ge2ir'];
|
|
870
|
-
return isRecord$4(namespaced) ? namespaced : undefined;
|
|
871
|
-
}
|
|
872
|
-
function isRecord$4(value) {
|
|
873
|
-
return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && !Array.isArray(value);
|
|
874
|
-
}
|
|
875
|
-
|
|
876
1748
|
function buildTransformAnimation(layer, ctx) {
|
|
877
1749
|
var transform = layer.transform;
|
|
878
1750
|
if (transform == null) {
|
|
879
1751
|
return {};
|
|
880
1752
|
}
|
|
881
1753
|
var timeContext = getTimeContext(layer);
|
|
882
|
-
// Passthrough: ge2ir stores raw animation data in
|
|
1754
|
+
// Passthrough: ge2ir stores raw animation data in specific.effects to bypass the
|
|
883
1755
|
// IR keyframe conversion pipeline. Raw GE data is used verbatim when
|
|
884
1756
|
// available; otherwise the standard IR → GE conversion runs.
|
|
885
|
-
var
|
|
886
|
-
var passthroughPosition =
|
|
887
|
-
var passthroughRotation =
|
|
888
|
-
var passthroughSize =
|
|
889
|
-
var positionOverLifetime = passthroughPosition != null ? passthroughPosition : buildPositionAnim(transform, timeContext, ctx);
|
|
1757
|
+
var effectsSpecific = getEffectsLayerSpecific(ctx.ir, layer);
|
|
1758
|
+
var passthroughPosition = effectsSpecific == null ? void 0 : effectsSpecific.positionOverLifetime;
|
|
1759
|
+
var passthroughRotation = effectsSpecific == null ? void 0 : effectsSpecific.rotationOverLifetime;
|
|
1760
|
+
var passthroughSize = effectsSpecific == null ? void 0 : effectsSpecific.sizeOverLifetime;
|
|
1761
|
+
var positionOverLifetime = passthroughPosition != null ? passthroughPosition : buildPositionAnim(layer, transform, timeContext, ctx);
|
|
890
1762
|
var rotationOverLifetime = passthroughRotation != null ? passthroughRotation : buildRotationAnim(transform, timeContext);
|
|
891
1763
|
var sizeOverLifetime = passthroughSize != null ? passthroughSize : buildSizeAnim(transform, timeContext);
|
|
892
1764
|
return {
|
|
@@ -895,11 +1767,13 @@ function buildTransformAnimation(layer, ctx) {
|
|
|
895
1767
|
sizeOverLifetime: sizeOverLifetime
|
|
896
1768
|
};
|
|
897
1769
|
}
|
|
898
|
-
function buildPositionAnim(transform, timeContext, ctx) {
|
|
1770
|
+
function buildPositionAnim(layer, transform, timeContext, ctx) {
|
|
899
1771
|
var _posResult_curves_;
|
|
1772
|
+
var _posResult_pathPoints_;
|
|
900
1773
|
if (transform.position == null || !transform.position.keyframed) {
|
|
901
1774
|
return undefined;
|
|
902
1775
|
}
|
|
1776
|
+
assertContiguousPositionSegments(transform.position, layer);
|
|
903
1777
|
var posResult = irPositionKeyframesToGE(transform.position, timeContext);
|
|
904
1778
|
if (posResult == null) {
|
|
905
1779
|
return undefined;
|
|
@@ -907,28 +1781,28 @@ function buildPositionAnim(transform, timeContext, ctx) {
|
|
|
907
1781
|
var pathPoints = [];
|
|
908
1782
|
var controlPoints = [];
|
|
909
1783
|
var useKeyframeMode = shouldUseKeyframeMode(transform.position);
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
var point3d = convert2dTo3dPoint(
|
|
1784
|
+
var firstPathPoint = (_posResult_pathPoints_ = posResult.pathPoints[0]) == null ? void 0 : _posResult_pathPoints_[0];
|
|
1785
|
+
if (firstPathPoint != null) {
|
|
1786
|
+
var point3d = convert2dTo3dPoint(firstPathPoint[0], firstPathPoint[1], 0, ctx.width, ctx.height);
|
|
913
1787
|
pathPoints.push(point3d);
|
|
914
1788
|
}
|
|
915
|
-
|
|
916
|
-
var
|
|
917
|
-
var
|
|
918
|
-
pathPoints.push(
|
|
1789
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(posResult.pathPoints), _step; !(_step = _iterator()).done;){
|
|
1790
|
+
var pathPoint = _step.value;
|
|
1791
|
+
var endPoint3d = convert2dTo3dPoint(pathPoint[1][0], pathPoint[1][1], 0, ctx.width, ctx.height);
|
|
1792
|
+
pathPoints.push(endPoint3d);
|
|
919
1793
|
}
|
|
920
1794
|
for(var i = 0; i < posResult.controlPoints.length; i++){
|
|
921
1795
|
var cp = posResult.controlPoints[i];
|
|
922
|
-
var
|
|
1796
|
+
var pp = posResult.pathPoints[i];
|
|
923
1797
|
if (useKeyframeMode) {
|
|
924
|
-
var dx =
|
|
925
|
-
var dy =
|
|
926
|
-
var cp1 = convert2dTo3dPoint(dx / 3 +
|
|
927
|
-
var cp2 = convert2dTo3dPoint(-dx / 3 +
|
|
1798
|
+
var dx = pp[1][0] - pp[0][0];
|
|
1799
|
+
var dy = pp[1][1] - pp[0][1];
|
|
1800
|
+
var cp1 = convert2dTo3dPoint(dx / 3 + pp[0][0], dy / 3 + pp[0][1], 0, ctx.width, ctx.height);
|
|
1801
|
+
var cp2 = convert2dTo3dPoint(-dx / 3 + pp[1][0], -dy / 3 + pp[1][1], 0, ctx.width, ctx.height);
|
|
928
1802
|
controlPoints.push(cp1, cp2);
|
|
929
1803
|
} else {
|
|
930
|
-
var cp11 = convert2dTo3dPoint(cp[0][0] +
|
|
931
|
-
var cp21 = convert2dTo3dPoint(cp[1][0] +
|
|
1804
|
+
var cp11 = convert2dTo3dPoint(cp[0][0] + pp[0][0], cp[0][1] + pp[0][1], 0, ctx.width, ctx.height);
|
|
1805
|
+
var cp21 = convert2dTo3dPoint(cp[1][0] + pp[1][0], cp[1][1] + pp[1][1], 0, ctx.width, ctx.height);
|
|
932
1806
|
controlPoints.push(cp11, cp21);
|
|
933
1807
|
}
|
|
934
1808
|
}
|
|
@@ -962,117 +1836,44 @@ function buildPositionAnim(transform, timeContext, ctx) {
|
|
|
962
1836
|
}
|
|
963
1837
|
return {
|
|
964
1838
|
path: [
|
|
965
|
-
|
|
1839
|
+
ValueType.BEZIER_CURVE_PATH,
|
|
966
1840
|
pathPayload
|
|
967
1841
|
]
|
|
968
1842
|
};
|
|
969
1843
|
}
|
|
1844
|
+
function assertContiguousPositionSegments(position, layer) {
|
|
1845
|
+
var _loop = function(index) {
|
|
1846
|
+
var segmentEnd = position.keyframes[index].endValue;
|
|
1847
|
+
var nextStart = position.keyframes[index + 1].value;
|
|
1848
|
+
if (segmentEnd == null) {
|
|
1849
|
+
return "continue";
|
|
1850
|
+
}
|
|
1851
|
+
var isContiguous = segmentEnd.every(function(value, dimension) {
|
|
1852
|
+
return Math.abs(value - nextStart[dimension]) <= 1e-6;
|
|
1853
|
+
});
|
|
1854
|
+
if (!isContiguous) {
|
|
1855
|
+
throw new Error("[ge-ir] Layer '" + layer.name + "' has a discontiguous position segment at keyframe " + index + "; " + 'GE path animation cannot preserve a segment endValue that differs from the next keyframe value.');
|
|
1856
|
+
}
|
|
1857
|
+
};
|
|
1858
|
+
for(var index = 0; index < position.keyframes.length - 1; index++)_loop(index);
|
|
1859
|
+
}
|
|
970
1860
|
function buildRotationAnim(transform, timeContext) {
|
|
971
1861
|
var result = {};
|
|
972
|
-
var hasZ = false;
|
|
973
|
-
var hasX = false;
|
|
974
|
-
var hasY = false;
|
|
975
1862
|
var rotation = transform.rotation;
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
curves[1]
|
|
991
|
-
];
|
|
992
|
-
hasY = true;
|
|
993
|
-
}
|
|
994
|
-
if (curves != null && axisHasRotationValue(rotation, 2) && ((_curves_2 = curves[2]) == null ? void 0 : _curves_2.length)) {
|
|
995
|
-
result['z'] = [
|
|
996
|
-
effectsSpecification.ValueType.BEZIER_CURVE,
|
|
997
|
-
curves[2]
|
|
998
|
-
];
|
|
999
|
-
hasZ = true;
|
|
1000
|
-
}
|
|
1001
|
-
} else if (rotation.value != null) {
|
|
1002
|
-
var _rotation_value = rotation.value, tmp = _rotation_value[0], x = tmp === void 0 ? 0 : tmp, tmp1 = _rotation_value[1], y = tmp1 === void 0 ? 0 : tmp1, tmp2 = _rotation_value[2], z = tmp2 === void 0 ? 0 : tmp2;
|
|
1003
|
-
if (Math.abs(x) > 0.0001) {
|
|
1004
|
-
result['x'] = [
|
|
1005
|
-
effectsSpecification.ValueType.CONSTANT,
|
|
1006
|
-
x
|
|
1007
|
-
];
|
|
1008
|
-
hasX = true;
|
|
1009
|
-
}
|
|
1010
|
-
if (Math.abs(y) > 0.0001) {
|
|
1011
|
-
result['y'] = [
|
|
1012
|
-
effectsSpecification.ValueType.CONSTANT,
|
|
1013
|
-
y
|
|
1014
|
-
];
|
|
1015
|
-
hasY = true;
|
|
1016
|
-
}
|
|
1017
|
-
if (Math.abs(z) > 0.0001) {
|
|
1018
|
-
result['z'] = [
|
|
1019
|
-
effectsSpecification.ValueType.CONSTANT,
|
|
1020
|
-
z
|
|
1021
|
-
];
|
|
1022
|
-
hasZ = true;
|
|
1023
|
-
}
|
|
1024
|
-
}
|
|
1025
|
-
} else {
|
|
1026
|
-
var _separated_x, _separated_x1, _separated_y, _separated_y1, _separated_z, _separated_z1;
|
|
1027
|
-
var separated = transform.separatedRotation;
|
|
1028
|
-
if (separated == null ? void 0 : (_separated_x = separated.x) == null ? void 0 : _separated_x.keyframed) {
|
|
1029
|
-
var curves1 = irScalarKeyframesToGE(separated.x, timeContext);
|
|
1030
|
-
if (curves1 != null) {
|
|
1031
|
-
result['x'] = [
|
|
1032
|
-
effectsSpecification.ValueType.BEZIER_CURVE,
|
|
1033
|
-
curves1[0]
|
|
1034
|
-
];
|
|
1035
|
-
hasX = true;
|
|
1036
|
-
}
|
|
1037
|
-
} else if ((separated == null ? void 0 : (_separated_x1 = separated.x) == null ? void 0 : _separated_x1.value) != null && separated.x.value !== 0) {
|
|
1038
|
-
result['x'] = [
|
|
1039
|
-
effectsSpecification.ValueType.CONSTANT,
|
|
1040
|
-
separated.x.value
|
|
1041
|
-
];
|
|
1042
|
-
hasX = true;
|
|
1043
|
-
}
|
|
1044
|
-
if (separated == null ? void 0 : (_separated_y = separated.y) == null ? void 0 : _separated_y.keyframed) {
|
|
1045
|
-
var curves2 = irScalarKeyframesToGE(separated.y, timeContext);
|
|
1046
|
-
if (curves2 != null) {
|
|
1047
|
-
result['y'] = [
|
|
1048
|
-
effectsSpecification.ValueType.BEZIER_CURVE,
|
|
1049
|
-
curves2[0]
|
|
1050
|
-
];
|
|
1051
|
-
hasY = true;
|
|
1052
|
-
}
|
|
1053
|
-
} else if ((separated == null ? void 0 : (_separated_y1 = separated.y) == null ? void 0 : _separated_y1.value) != null && separated.y.value !== 0) {
|
|
1054
|
-
result['y'] = [
|
|
1055
|
-
effectsSpecification.ValueType.CONSTANT,
|
|
1056
|
-
separated.y.value
|
|
1057
|
-
];
|
|
1058
|
-
hasY = true;
|
|
1059
|
-
}
|
|
1060
|
-
if (separated == null ? void 0 : (_separated_z = separated.z) == null ? void 0 : _separated_z.keyframed) {
|
|
1061
|
-
var curves3 = irScalarKeyframesToGE(separated.z, timeContext);
|
|
1062
|
-
if (curves3 != null) {
|
|
1063
|
-
result['z'] = [
|
|
1064
|
-
effectsSpecification.ValueType.BEZIER_CURVE,
|
|
1065
|
-
curves3[0]
|
|
1066
|
-
];
|
|
1067
|
-
hasZ = true;
|
|
1068
|
-
}
|
|
1069
|
-
} else if ((separated == null ? void 0 : (_separated_z1 = separated.z) == null ? void 0 : _separated_z1.value) != null && separated.z.value !== 0) {
|
|
1070
|
-
result['z'] = [
|
|
1071
|
-
effectsSpecification.ValueType.CONSTANT,
|
|
1072
|
-
separated.z.value
|
|
1073
|
-
];
|
|
1074
|
-
hasZ = true;
|
|
1075
|
-
}
|
|
1863
|
+
var x = buildRotationAxis(rotation == null ? void 0 : rotation.x, timeContext);
|
|
1864
|
+
var y = buildRotationAxis(rotation == null ? void 0 : rotation.y, timeContext);
|
|
1865
|
+
var z = buildRotationAxis(rotation == null ? void 0 : rotation.z, timeContext);
|
|
1866
|
+
var hasX = x != null;
|
|
1867
|
+
var hasY = y != null;
|
|
1868
|
+
var hasZ = z != null;
|
|
1869
|
+
if (x != null) {
|
|
1870
|
+
result['x'] = x;
|
|
1871
|
+
}
|
|
1872
|
+
if (y != null) {
|
|
1873
|
+
result['y'] = y;
|
|
1874
|
+
}
|
|
1875
|
+
if (z != null) {
|
|
1876
|
+
result['z'] = z;
|
|
1076
1877
|
}
|
|
1077
1878
|
if (!hasZ && !hasX && !hasY) {
|
|
1078
1879
|
return undefined;
|
|
@@ -1084,70 +1885,92 @@ function buildRotationAnim(transform, timeContext) {
|
|
|
1084
1885
|
}
|
|
1085
1886
|
return result;
|
|
1086
1887
|
}
|
|
1087
|
-
function
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1888
|
+
function buildRotationAxis(property, timeContext) {
|
|
1889
|
+
if (property == null) {
|
|
1890
|
+
return undefined;
|
|
1891
|
+
}
|
|
1892
|
+
if (!property.keyframed) {
|
|
1893
|
+
return property.value !== 0 ? [
|
|
1894
|
+
ValueType.CONSTANT,
|
|
1895
|
+
property.value
|
|
1896
|
+
] : undefined;
|
|
1094
1897
|
}
|
|
1095
|
-
|
|
1096
|
-
var
|
|
1898
|
+
if (property.keyframes.length === 1) {
|
|
1899
|
+
var value = property.keyframes[0].value;
|
|
1900
|
+
return value !== 0 ? [
|
|
1901
|
+
ValueType.CONSTANT,
|
|
1902
|
+
value
|
|
1903
|
+
] : undefined;
|
|
1904
|
+
}
|
|
1905
|
+
if (!axisHasRotationValue(property)) {
|
|
1906
|
+
return undefined;
|
|
1907
|
+
}
|
|
1908
|
+
var curves = irScalarKeyframesToGE(property, timeContext);
|
|
1909
|
+
return curves != null ? [
|
|
1910
|
+
ValueType.BEZIER_CURVE,
|
|
1911
|
+
curves[0]
|
|
1912
|
+
] : undefined;
|
|
1913
|
+
}
|
|
1914
|
+
function axisHasRotationValue(rotation) {
|
|
1915
|
+
return rotation.keyframes.some(function(keyframe) {
|
|
1097
1916
|
var _keyframe_endValue;
|
|
1098
|
-
return Math.abs(
|
|
1099
|
-
})
|
|
1917
|
+
return Math.abs(keyframe.value) > 0.0001 || Math.abs((_keyframe_endValue = keyframe.endValue) != null ? _keyframe_endValue : 0) > 0.0001;
|
|
1918
|
+
});
|
|
1100
1919
|
}
|
|
1101
1920
|
function buildSizeAnim(transform, timeContext) {
|
|
1102
1921
|
if (transform.scale == null) {
|
|
1103
1922
|
return undefined;
|
|
1104
1923
|
}
|
|
1105
1924
|
if (transform.scale.keyframed) {
|
|
1925
|
+
if (transform.scale.keyframes.length === 1) {
|
|
1926
|
+
return buildConstantSizeAnimation(transform.scale.keyframes[0].value);
|
|
1927
|
+
}
|
|
1106
1928
|
var curves = irVectorKeyframesToGE(transform.scale, timeContext);
|
|
1107
1929
|
if (curves != null && curves.length >= 2) {
|
|
1108
1930
|
return _extends({
|
|
1109
1931
|
separateAxes: true,
|
|
1110
1932
|
x: [
|
|
1111
|
-
|
|
1933
|
+
ValueType.BEZIER_CURVE,
|
|
1112
1934
|
curves[0]
|
|
1113
1935
|
],
|
|
1114
1936
|
y: [
|
|
1115
|
-
|
|
1937
|
+
ValueType.BEZIER_CURVE,
|
|
1116
1938
|
curves[1]
|
|
1117
1939
|
]
|
|
1118
1940
|
}, curves.length >= 3 && {
|
|
1119
1941
|
z: [
|
|
1120
|
-
|
|
1942
|
+
ValueType.BEZIER_CURVE,
|
|
1121
1943
|
curves[2]
|
|
1122
1944
|
]
|
|
1123
1945
|
});
|
|
1124
1946
|
}
|
|
1125
1947
|
return undefined;
|
|
1126
1948
|
}
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
x: [
|
|
1133
|
-
effectsSpecification.ValueType.CONSTANT,
|
|
1134
|
-
scale[0]
|
|
1135
|
-
],
|
|
1136
|
-
y: [
|
|
1137
|
-
effectsSpecification.ValueType.CONSTANT,
|
|
1138
|
-
scale[1]
|
|
1139
|
-
],
|
|
1140
|
-
z: [
|
|
1141
|
-
effectsSpecification.ValueType.CONSTANT,
|
|
1142
|
-
(_scale_ = scale[2]) != null ? _scale_ : 1
|
|
1143
|
-
]
|
|
1144
|
-
};
|
|
1949
|
+
return buildConstantSizeAnimation(transform.scale.value);
|
|
1950
|
+
}
|
|
1951
|
+
function buildConstantSizeAnimation(scale) {
|
|
1952
|
+
if (Math.abs(scale[0] - 1) <= 0.0001 && Math.abs(scale[1] - 1) <= 0.0001) {
|
|
1953
|
+
return undefined;
|
|
1145
1954
|
}
|
|
1146
|
-
return
|
|
1955
|
+
return {
|
|
1956
|
+
separateAxes: true,
|
|
1957
|
+
x: [
|
|
1958
|
+
ValueType.CONSTANT,
|
|
1959
|
+
scale[0]
|
|
1960
|
+
],
|
|
1961
|
+
y: [
|
|
1962
|
+
ValueType.CONSTANT,
|
|
1963
|
+
scale[1]
|
|
1964
|
+
],
|
|
1965
|
+
z: [
|
|
1966
|
+
ValueType.CONSTANT,
|
|
1967
|
+
scale[2]
|
|
1968
|
+
]
|
|
1969
|
+
};
|
|
1147
1970
|
}
|
|
1148
1971
|
function buildColorAnimation(layer, ir) {
|
|
1149
|
-
var
|
|
1150
|
-
var passthroughColor = (
|
|
1972
|
+
var _getEffectsLayerSpecific;
|
|
1973
|
+
var passthroughColor = (_getEffectsLayerSpecific = getEffectsLayerSpecific(ir, layer)) == null ? void 0 : _getEffectsLayerSpecific.colorOverLifetime;
|
|
1151
1974
|
if (passthroughColor != null) {
|
|
1152
1975
|
return passthroughColor;
|
|
1153
1976
|
}
|
|
@@ -1159,29 +1982,38 @@ function buildColorAnimation(layer, ir) {
|
|
|
1159
1982
|
if (timeContext.endFrame - timeContext.startFrame <= 0) {
|
|
1160
1983
|
return {
|
|
1161
1984
|
opacity: [
|
|
1162
|
-
|
|
1985
|
+
ValueType.CONSTANT,
|
|
1163
1986
|
0
|
|
1164
1987
|
]
|
|
1165
1988
|
};
|
|
1166
1989
|
}
|
|
1167
1990
|
if (transform.opacity.keyframed) {
|
|
1991
|
+
if (transform.opacity.keyframes.length === 1) {
|
|
1992
|
+
var opacityValue = transform.opacity.keyframes[0].value;
|
|
1993
|
+
return opacityValue !== 1 ? {
|
|
1994
|
+
opacity: [
|
|
1995
|
+
ValueType.CONSTANT,
|
|
1996
|
+
opacityValue
|
|
1997
|
+
]
|
|
1998
|
+
} : undefined;
|
|
1999
|
+
}
|
|
1168
2000
|
var curves = irScalarKeyframesToGE(transform.opacity, timeContext);
|
|
1169
2001
|
if (curves != null) {
|
|
1170
2002
|
return {
|
|
1171
2003
|
opacity: [
|
|
1172
|
-
|
|
2004
|
+
ValueType.BEZIER_CURVE,
|
|
1173
2005
|
curves[0]
|
|
1174
2006
|
]
|
|
1175
2007
|
};
|
|
1176
2008
|
}
|
|
1177
2009
|
return undefined;
|
|
1178
2010
|
}
|
|
1179
|
-
var
|
|
1180
|
-
if (typeof
|
|
2011
|
+
var opacityValue1 = transform.opacity.value;
|
|
2012
|
+
if (typeof opacityValue1 === 'number' && opacityValue1 !== 1) {
|
|
1181
2013
|
return {
|
|
1182
2014
|
opacity: [
|
|
1183
|
-
|
|
1184
|
-
|
|
2015
|
+
ValueType.CONSTANT,
|
|
2016
|
+
opacityValue1
|
|
1185
2017
|
]
|
|
1186
2018
|
};
|
|
1187
2019
|
}
|
|
@@ -1263,18 +2095,20 @@ function mapBlendingMode(blendMode) {
|
|
|
1263
2095
|
return GE_BLENDING_BY_IR_MODE[blendMode];
|
|
1264
2096
|
}
|
|
1265
2097
|
|
|
1266
|
-
var
|
|
2098
|
+
var DEFAULT_LOCAL_BOUNDS = {
|
|
2099
|
+
x: 0,
|
|
2100
|
+
y: 0,
|
|
1267
2101
|
width: 1,
|
|
1268
2102
|
height: 1
|
|
1269
2103
|
};
|
|
1270
2104
|
/**
|
|
1271
|
-
* Read
|
|
1272
|
-
* did not resolve one, returns `fallback` (defaults to
|
|
1273
|
-
*
|
|
1274
|
-
*/ function
|
|
1275
|
-
if (fallback === void 0) fallback =
|
|
1276
|
-
var
|
|
1277
|
-
return (
|
|
2105
|
+
* Read source-neutral local bounds from an IR layer. When the producer
|
|
2106
|
+
* did not resolve one, returns `fallback` (defaults to bounds at the origin
|
|
2107
|
+
* with a one-pixel width and height).
|
|
2108
|
+
*/ function getLayerLocalBounds(layer, fallback) {
|
|
2109
|
+
if (fallback === void 0) fallback = DEFAULT_LOCAL_BOUNDS;
|
|
2110
|
+
var _layer_localBounds;
|
|
2111
|
+
return (_layer_localBounds = layer.localBounds) != null ? _layer_localBounds : fallback;
|
|
1278
2112
|
}
|
|
1279
2113
|
|
|
1280
2114
|
function buildComponent(layer, itemId, anchorScaleX, anchorScaleY, ctx) {
|
|
@@ -1291,21 +2125,20 @@ function buildComponent(layer, itemId, anchorScaleX, anchorScaleY, ctx) {
|
|
|
1291
2125
|
}
|
|
1292
2126
|
}
|
|
1293
2127
|
/**
|
|
1294
|
-
* Copy the raw GE mask object (from
|
|
2128
|
+
* Copy the raw GE mask object (from specific.effects passthrough) onto a freshly
|
|
1295
2129
|
* built component, as a top-level `mask` field matching GE's structure. For a
|
|
1296
2130
|
* mask SOURCE this carries `{isMask:true, alphaMaskEnabled}`; for a TARGET it
|
|
1297
2131
|
* carries `{isMask:false, reference, inverted}` where `reference.id` is still
|
|
1298
|
-
* the stale GE1 component id — `
|
|
1299
|
-
* No-op for non-
|
|
1300
|
-
*/ function
|
|
1301
|
-
var
|
|
1302
|
-
var
|
|
1303
|
-
if (
|
|
1304
|
-
component['mask'] = _extends({},
|
|
2132
|
+
* the stale GE1 component id — `applyGEMaskRemap` rewrites it in post-process.
|
|
2133
|
+
* No-op for non-GE sources (Lottie masks go through the IRLayerNode.mask path).
|
|
2134
|
+
*/ function applyGEMask(ir, layer, component) {
|
|
2135
|
+
var _getEffectsLayerSpecific;
|
|
2136
|
+
var effectsMask = (_getEffectsLayerSpecific = getEffectsLayerSpecific(ir, layer)) == null ? void 0 : _getEffectsLayerSpecific.mask;
|
|
2137
|
+
if (effectsMask != null && component['mask'] == null) {
|
|
2138
|
+
component['mask'] = _extends({}, effectsMask);
|
|
1305
2139
|
}
|
|
1306
2140
|
}
|
|
1307
2141
|
function buildSpriteComponent(layer, itemId, anchorScaleX, anchorScaleY, ctx) {
|
|
1308
|
-
var _ref;
|
|
1309
2142
|
var _layer_asset, _layer_asset1;
|
|
1310
2143
|
var componentId = createId();
|
|
1311
2144
|
var blending = mapBlendingMode(layer.blendMode);
|
|
@@ -1321,7 +2154,8 @@ function buildSpriteComponent(layer, itemId, anchorScaleX, anchorScaleY, ctx) {
|
|
|
1321
2154
|
1
|
|
1322
2155
|
];
|
|
1323
2156
|
var textureDataPath;
|
|
1324
|
-
var
|
|
2157
|
+
var assetUrl = (_layer_asset = layer.asset) == null ? void 0 : _layer_asset.url;
|
|
2158
|
+
var textureUrl = assetUrl != null && assetUrl !== '' ? assetUrl : (_layer_asset1 = layer.asset) == null ? void 0 : _layer_asset1.refId;
|
|
1325
2159
|
if (textureUrl != null && textureUrl !== '' && textureUrl !== 'mask://placeholder') {
|
|
1326
2160
|
textureDataPath = registerTexture(ctx.collector, textureUrl, ctx.textureCache);
|
|
1327
2161
|
}
|
|
@@ -1347,7 +2181,7 @@ function buildSpriteComponent(layer, itemId, anchorScaleX, anchorScaleY, ctx) {
|
|
|
1347
2181
|
roundNumber(anchorScaleY, 4)
|
|
1348
2182
|
];
|
|
1349
2183
|
}
|
|
1350
|
-
|
|
2184
|
+
applyGEMask(ctx.ir, layer, component);
|
|
1351
2185
|
ctx.collector.components.push(component);
|
|
1352
2186
|
return componentId;
|
|
1353
2187
|
}
|
|
@@ -1368,7 +2202,7 @@ function buildTextComponent(layer, itemId, anchorScaleX, anchorScaleY, ctx) {
|
|
|
1368
2202
|
var textWidth = (_textInfo_width = textInfo.width) != null ? _textInfo_width : estimateTextWidth(textInfo.content, textInfo.fontSize, textInfo.letterSpacing);
|
|
1369
2203
|
var lineHeight = typeof textInfo.lineHeight === 'number' && textInfo.lineHeight > 0 ? textInfo.lineHeight : textInfo.fontSize;
|
|
1370
2204
|
var textHeight = Math.max((_textInfo_height = textInfo.height) != null ? _textInfo_height : textInfo.fontSize * 1.2, lineHeight);
|
|
1371
|
-
var
|
|
2205
|
+
var _getLayerLocalBounds = getLayerLocalBounds(layer), layerWidth = _getLayerLocalBounds.width, layerHeight = _getLayerLocalBounds.height;
|
|
1372
2206
|
var textSizeW = roundNumber(ctx.ratio * layerWidth, 4);
|
|
1373
2207
|
var textSizeH = roundNumber(ctx.ratio * layerHeight, 4);
|
|
1374
2208
|
var component = {
|
|
@@ -1403,7 +2237,7 @@ function buildTextComponent(layer, itemId, anchorScaleX, anchorScaleY, ctx) {
|
|
|
1403
2237
|
blending: blending
|
|
1404
2238
|
})
|
|
1405
2239
|
};
|
|
1406
|
-
|
|
2240
|
+
applyGEMask(ctx.ir, layer, component);
|
|
1407
2241
|
ctx.collector.components.push(component);
|
|
1408
2242
|
return componentId;
|
|
1409
2243
|
}
|
|
@@ -1425,7 +2259,7 @@ function buildShapeComponent(layer, itemId, ctx) {
|
|
|
1425
2259
|
blending: blending
|
|
1426
2260
|
})
|
|
1427
2261
|
});
|
|
1428
|
-
|
|
2262
|
+
applyGEMask(ctx.ir, layer, component);
|
|
1429
2263
|
ctx.collector.components.push(component);
|
|
1430
2264
|
return componentId;
|
|
1431
2265
|
}
|
|
@@ -1433,21 +2267,35 @@ function buildShapeOptions(shapeData, ratio, ctx) {
|
|
|
1433
2267
|
var options = {
|
|
1434
2268
|
type: mapShapePrimitiveType(shapeData.primitiveType)
|
|
1435
2269
|
};
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
2270
|
+
switch(shapeData.primitiveType){
|
|
2271
|
+
case animationIr.IRShapePrimitiveType.Custom:
|
|
2272
|
+
Object.assign(options, mapCustomPaths(shapeData.customPaths, ratio));
|
|
2273
|
+
break;
|
|
2274
|
+
case animationIr.IRShapePrimitiveType.Rectangle:
|
|
2275
|
+
var _shapeData_roundness;
|
|
2276
|
+
options['width'] = roundNumber(shapeData.width * ratio, 4);
|
|
2277
|
+
options['height'] = roundNumber(shapeData.height * ratio, 4);
|
|
2278
|
+
options['roundness'] = (_shapeData_roundness = shapeData.roundness) != null ? _shapeData_roundness : 0;
|
|
2279
|
+
break;
|
|
2280
|
+
case animationIr.IRShapePrimitiveType.Ellipse:
|
|
2281
|
+
options['xRadius'] = roundNumber(shapeData.xRadius * ratio, 4);
|
|
2282
|
+
options['yRadius'] = roundNumber(shapeData.yRadius * ratio, 4);
|
|
2283
|
+
break;
|
|
2284
|
+
case animationIr.IRShapePrimitiveType.Polygon:
|
|
2285
|
+
var _shapeData_roundness1;
|
|
2286
|
+
options['pointCount'] = shapeData.pointCount;
|
|
2287
|
+
options['radius'] = roundNumber(shapeData.radius * ratio, 4);
|
|
2288
|
+
options['roundness'] = (_shapeData_roundness1 = shapeData.roundness) != null ? _shapeData_roundness1 : 0;
|
|
2289
|
+
break;
|
|
2290
|
+
case animationIr.IRShapePrimitiveType.Star:
|
|
2291
|
+
var _shapeData_innerRoundness, _shapeData_outerRoundness;
|
|
2292
|
+
options['pointCount'] = shapeData.pointCount;
|
|
2293
|
+
options['innerRadius'] = roundNumber(shapeData.innerRadius * ratio, 4);
|
|
2294
|
+
options['outerRadius'] = roundNumber(shapeData.outerRadius * ratio, 4);
|
|
2295
|
+
options['innerRoundness'] = (_shapeData_innerRoundness = shapeData.innerRoundness) != null ? _shapeData_innerRoundness : 0;
|
|
2296
|
+
options['outerRoundness'] = (_shapeData_outerRoundness = shapeData.outerRoundness) != null ? _shapeData_outerRoundness : 0;
|
|
2297
|
+
break;
|
|
2298
|
+
}
|
|
1451
2299
|
if (shapeData.fills != null && shapeData.fills.length > 0) {
|
|
1452
2300
|
options['fills'] = shapeData.fills.map(function(fill) {
|
|
1453
2301
|
return mapShapePaint(fill, ratio, ctx);
|
|
@@ -1475,18 +2323,6 @@ function buildShapeOptions(shapeData, ratio, ctx) {
|
|
|
1475
2323
|
if (shapeData.strokeJoin != null) {
|
|
1476
2324
|
options['strokeJoin'] = mapLineJoin(shapeData.strokeJoin);
|
|
1477
2325
|
}
|
|
1478
|
-
if (shapeData.fillRule != null) {
|
|
1479
|
-
options['fillRule'] = mapShapeFillRule(shapeData.fillRule);
|
|
1480
|
-
}
|
|
1481
|
-
if (shapeData.customPaths != null && shapeData.customPaths.length > 0) {
|
|
1482
|
-
Object.assign(options, mapCustomPaths(shapeData.customPaths, ratio));
|
|
1483
|
-
}
|
|
1484
|
-
if (shapeData.trimPath != null) {
|
|
1485
|
-
options['trimPath'] = shapeData.trimPath;
|
|
1486
|
-
}
|
|
1487
|
-
if (shapeData.repeater != null) {
|
|
1488
|
-
options['repeater'] = shapeData.repeater;
|
|
1489
|
-
}
|
|
1490
2326
|
return options;
|
|
1491
2327
|
}
|
|
1492
2328
|
var _obj;
|
|
@@ -1497,8 +2333,6 @@ var _obj2;
|
|
|
1497
2333
|
var LINE_CAP_TO_GE = (_obj2 = {}, _obj2[animationIr.IRLineCap.Butt] = 0, _obj2[animationIr.IRLineCap.Round] = 1, _obj2[animationIr.IRLineCap.Square] = 2, _obj2);
|
|
1498
2334
|
var _obj3;
|
|
1499
2335
|
var LINE_JOIN_TO_GE = (_obj3 = {}, _obj3[animationIr.IRLineJoin.Round] = 0, _obj3[animationIr.IRLineJoin.Bevel] = 1, _obj3[animationIr.IRLineJoin.Miter] = 2, _obj3);
|
|
1500
|
-
var _obj4;
|
|
1501
|
-
var SHAPE_FILL_RULE_TO_GE = (_obj4 = {}, _obj4[animationIr.IRShapeFillRule.NonZero] = 0, _obj4[animationIr.IRShapeFillRule.EvenOdd] = 1, _obj4);
|
|
1502
2336
|
function mapShapePrimitiveType(primitiveType) {
|
|
1503
2337
|
return SHAPE_PRIMITIVE_TYPE_TO_GE[primitiveType];
|
|
1504
2338
|
}
|
|
@@ -1510,10 +2344,6 @@ function mapLineJoin(lineJoin) {
|
|
|
1510
2344
|
var _LINE_JOIN_TO_GE_lineJoin;
|
|
1511
2345
|
return (_LINE_JOIN_TO_GE_lineJoin = LINE_JOIN_TO_GE[lineJoin]) != null ? _LINE_JOIN_TO_GE_lineJoin : 2;
|
|
1512
2346
|
}
|
|
1513
|
-
function mapShapeFillRule(fillRule) {
|
|
1514
|
-
var _SHAPE_FILL_RULE_TO_GE_fillRule;
|
|
1515
|
-
return (_SHAPE_FILL_RULE_TO_GE_fillRule = SHAPE_FILL_RULE_TO_GE[fillRule]) != null ? _SHAPE_FILL_RULE_TO_GE_fillRule : 0;
|
|
1516
|
-
}
|
|
1517
2347
|
function mapShapePaint(paint, ratio, ctx) {
|
|
1518
2348
|
if (paint.type === animationIr.IRFillType.Solid) {
|
|
1519
2349
|
return {
|
|
@@ -1522,21 +2352,20 @@ function mapShapePaint(paint, ratio, ctx) {
|
|
|
1522
2352
|
};
|
|
1523
2353
|
}
|
|
1524
2354
|
if (paint.type === animationIr.IRFillType.LinearGradient || paint.type === animationIr.IRFillType.RadialGradient || paint.type === animationIr.IRFillType.AngularGradient) {
|
|
1525
|
-
return
|
|
2355
|
+
return {
|
|
1526
2356
|
type: FILL_TYPE_TO_GE[paint.type],
|
|
1527
2357
|
gradientStops: [
|
|
1528
|
-
|
|
2358
|
+
ValueType.GRADIENT_COLOR,
|
|
1529
2359
|
paint.gradientStops
|
|
1530
2360
|
],
|
|
1531
2361
|
startPoint: vec2ToGE(paint.gradientStart, ratio),
|
|
1532
2362
|
endPoint: vec2ToGE(paint.gradientEnd, ratio)
|
|
1533
|
-
}
|
|
1534
|
-
color: colorToGE(paint.color)
|
|
1535
|
-
});
|
|
2363
|
+
};
|
|
1536
2364
|
}
|
|
1537
2365
|
if (paint.type === animationIr.IRFillType.Texture) {
|
|
1538
|
-
var
|
|
1539
|
-
var
|
|
2366
|
+
var _paint_scaleMode;
|
|
2367
|
+
var textureAssetUrl = paint.texture.url;
|
|
2368
|
+
var textureUrl = textureAssetUrl != null && textureAssetUrl !== '' ? textureAssetUrl : paint.texture.refId;
|
|
1540
2369
|
var texture = textureUrl != null && ctx != null ? registerTexture(ctx.collector, textureUrl, ctx.textureCache) : undefined;
|
|
1541
2370
|
return _extends({
|
|
1542
2371
|
type: FILL_TYPE_TO_GE[paint.type]
|
|
@@ -1574,8 +2403,8 @@ function mapCustomPaths(paths, ratio) {
|
|
|
1574
2403
|
for(var index = 0; index < path.points.length; index++){
|
|
1575
2404
|
var _ref, _ref1, _ref2, _ref3;
|
|
1576
2405
|
var point = path.points[index];
|
|
1577
|
-
var easingIn = path.
|
|
1578
|
-
var easingOut = path.
|
|
2406
|
+
var easingIn = path.inTangents[index];
|
|
2407
|
+
var easingOut = path.outTangents[index];
|
|
1579
2408
|
var pointIndex = points.length;
|
|
1580
2409
|
points.push({
|
|
1581
2410
|
x: roundNumber(point.x * ratio, 4),
|
|
@@ -1596,7 +2425,7 @@ function mapCustomPaths(paths, ratio) {
|
|
|
1596
2425
|
});
|
|
1597
2426
|
}
|
|
1598
2427
|
shapes.push({
|
|
1599
|
-
close: path.
|
|
2428
|
+
close: path.closed,
|
|
1600
2429
|
indexes: indexes
|
|
1601
2430
|
});
|
|
1602
2431
|
}
|
|
@@ -1607,100 +2436,54 @@ function mapCustomPaths(paths, ratio) {
|
|
|
1607
2436
|
shapes: shapes
|
|
1608
2437
|
};
|
|
1609
2438
|
}
|
|
1610
|
-
function setScaledNumber(options, shapeData, key, ratio) {
|
|
1611
|
-
var value = shapeData[key];
|
|
1612
|
-
if (typeof value === 'number') {
|
|
1613
|
-
options[key] = roundNumber(value * ratio, 4);
|
|
1614
|
-
}
|
|
1615
|
-
}
|
|
1616
|
-
function setRawNumber(options, shapeData, key) {
|
|
1617
|
-
var value = shapeData[key];
|
|
1618
|
-
if (typeof value === 'number') {
|
|
1619
|
-
options[key] = value;
|
|
1620
|
-
}
|
|
1621
|
-
}
|
|
1622
2439
|
|
|
1623
|
-
function
|
|
1624
|
-
|
|
2440
|
+
function planGELayerLowering(ir, layer) {
|
|
2441
|
+
var _getEffectsLayerSpecific;
|
|
2442
|
+
var sourceHierarchy = (_getEffectsLayerSpecific = getEffectsLayerSpecific(ir, layer)) == null ? void 0 : _getEffectsLayerSpecific.sourceHierarchy;
|
|
2443
|
+
if (sourceHierarchy === 'null-sprite-pair') {
|
|
1625
2444
|
return {
|
|
1626
2445
|
kind: 'split-null-sprite'
|
|
1627
2446
|
};
|
|
1628
2447
|
}
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
// full input set (text anchorAdjust, static-rotation anchor rotation, display
|
|
1632
|
-
// size fallback) into the producer, at high cost with no readability benefit.
|
|
1633
|
-
// The split gate itself is already pre-baked via `transformSplit` above.
|
|
1634
|
-
//
|
|
1635
|
-
// ge source shares the lottie inline-anchor math: ge2ir reverses GE's
|
|
1636
|
-
// `renderer.anchor` into IRLayerNode.transform.anchor (px) + displaySize, so
|
|
1637
|
-
// computeAnchorInfo reproduces the exact anchorScale/anchorOffset that GE had.
|
|
1638
|
-
// Without this, ge layers fall through to the centered [0.5,0.5] default and
|
|
1639
|
-
// their authored anchor (e.g. a top-anchored sweep) is lost on round-trip.
|
|
1640
|
-
// ge never reaches the lottieNeedsTransformSplit geometry check — its split
|
|
1641
|
-
// decision is pre-baked via `transformSplit` by the ge2ir null+sprite merger.
|
|
1642
|
-
if (ir.source === 'lottie' || ir.source === 'ge') {
|
|
1643
|
-
if (ir.source === 'lottie' && lottieNeedsTransformSplit(layer)) {
|
|
1644
|
-
return {
|
|
1645
|
-
kind: 'split-null-sprite'
|
|
1646
|
-
};
|
|
1647
|
-
}
|
|
1648
|
-
// The inline-anchor math needs non-zero dimensions to avoid divide-by-zero
|
|
1649
|
-
// in `computeAnchorInfo`; substitute the legacy {1, 1} fallback at the call site
|
|
1650
|
-
// so the field-level default stays neutral.
|
|
1651
|
-
var _getLayerDisplaySize = getLayerDisplaySize(layer), width = _getLayerDisplaySize.width, height = _getLayerDisplaySize.height;
|
|
1652
|
-
var info = computeAnchorInfo(layer, width, height);
|
|
2448
|
+
var bounds = getLayerLocalBounds(layer);
|
|
2449
|
+
if (sourceHierarchy !== 'single-item' && needsPivotContainer(layer, bounds)) {
|
|
1653
2450
|
return {
|
|
1654
|
-
kind: '
|
|
1655
|
-
anchorScale: [
|
|
1656
|
-
info.anchorScaleX,
|
|
1657
|
-
info.anchorScaleY
|
|
1658
|
-
],
|
|
1659
|
-
anchorOffset: [
|
|
1660
|
-
info.anchorOffsetX,
|
|
1661
|
-
info.anchorOffsetY
|
|
1662
|
-
]
|
|
2451
|
+
kind: 'split-null-sprite'
|
|
1663
2452
|
};
|
|
1664
2453
|
}
|
|
1665
|
-
|
|
1666
|
-
// producer, caught by the guard at the top. Any layer reaching here is
|
|
1667
|
-
// centered — return the default inline-anchor.
|
|
2454
|
+
var info = computeAnchorInfo(layer, bounds);
|
|
1668
2455
|
return {
|
|
1669
2456
|
kind: 'inline-anchor',
|
|
1670
2457
|
anchorScale: [
|
|
1671
|
-
|
|
1672
|
-
|
|
2458
|
+
info.anchorScaleX,
|
|
2459
|
+
info.anchorScaleY
|
|
1673
2460
|
],
|
|
1674
2461
|
anchorOffset: [
|
|
1675
|
-
|
|
1676
|
-
|
|
2462
|
+
info.anchorOffsetX,
|
|
2463
|
+
info.anchorOffsetY
|
|
1677
2464
|
]
|
|
1678
2465
|
};
|
|
1679
2466
|
}
|
|
1680
|
-
function
|
|
1681
|
-
var
|
|
2467
|
+
function needsPivotContainer(layer, bounds) {
|
|
2468
|
+
var _rotation_x, _rotation_y, _rotation_z, _transform_scale;
|
|
1682
2469
|
if (layer.type !== 'image' && layer.type !== 'solid') {
|
|
1683
2470
|
return false;
|
|
1684
2471
|
}
|
|
1685
|
-
|
|
1686
|
-
// fall through to inline-anchor (matches the pre-displaySize behavior
|
|
1687
|
-
// where missing dimensions returned the {1, 1} default and never split).
|
|
1688
|
-
var size = layer.displaySize;
|
|
1689
|
-
if (size == null) {
|
|
2472
|
+
if (layer.localBounds == null) {
|
|
1690
2473
|
return false;
|
|
1691
2474
|
}
|
|
1692
|
-
var width =
|
|
2475
|
+
var x = bounds.x, y = bounds.y, width = bounds.width, height = bounds.height;
|
|
1693
2476
|
if (width <= 0 || height <= 0) {
|
|
1694
2477
|
return false;
|
|
1695
2478
|
}
|
|
1696
2479
|
var anchor = getStaticAnchor(layer);
|
|
1697
|
-
var anchorOffCenter = Math.abs(anchor[0] - width / 2) > 0.5 || Math.abs(anchor[1] - height / 2) > 0.5;
|
|
2480
|
+
var anchorOffCenter = Math.abs(anchor[0] - (x + width / 2)) > 0.5 || Math.abs(anchor[1] - (y + height / 2)) > 0.5;
|
|
1698
2481
|
if (!anchorOffCenter) {
|
|
1699
2482
|
return false;
|
|
1700
2483
|
}
|
|
1701
2484
|
var transform = layer.transform;
|
|
1702
|
-
var
|
|
1703
|
-
var hasRotationAnim = (
|
|
2485
|
+
var rotation = transform == null ? void 0 : transform.rotation;
|
|
2486
|
+
var hasRotationAnim = (rotation == null ? void 0 : (_rotation_x = rotation.x) == null ? void 0 : _rotation_x.keyframed) === true || (rotation == null ? void 0 : (_rotation_y = rotation.y) == null ? void 0 : _rotation_y.keyframed) === true || (rotation == null ? void 0 : (_rotation_z = rotation.z) == null ? void 0 : _rotation_z.keyframed) === true;
|
|
1704
2487
|
var hasScaleAnim = (transform == null ? void 0 : (_transform_scale = transform.scale) == null ? void 0 : _transform_scale.keyframed) === true;
|
|
1705
2488
|
return hasRotationAnim || hasScaleAnim;
|
|
1706
2489
|
}
|
|
@@ -1709,7 +2492,7 @@ function processNullLayer(layer, ctx) {
|
|
|
1709
2492
|
var itemId = createId();
|
|
1710
2493
|
var layerIndex = layer.index;
|
|
1711
2494
|
ctx.layerToItemId[layerIndex] = itemId;
|
|
1712
|
-
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
2495
|
+
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate, ctx.ir.inPoint), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
1713
2496
|
var animation = buildTransformAnimation(layer, ctx);
|
|
1714
2497
|
var position = computeStaticPosition(layer, ctx);
|
|
1715
2498
|
var objectBindingTrackId = buildTimelineTracks(ctx.collector, delay, layerDuration, 4, animation, 'null');
|
|
@@ -1719,7 +2502,7 @@ function processNullLayer(layer, ctx) {
|
|
|
1719
2502
|
name: layer.name,
|
|
1720
2503
|
duration: layerDuration,
|
|
1721
2504
|
type: '3',
|
|
1722
|
-
visible: layer.
|
|
2505
|
+
visible: layer.visible,
|
|
1723
2506
|
endBehavior: 4,
|
|
1724
2507
|
delay: delay,
|
|
1725
2508
|
renderLevel: 'B+',
|
|
@@ -1755,19 +2538,19 @@ function processPrecompLayer(layer, ctx) {
|
|
|
1755
2538
|
var itemId = createId();
|
|
1756
2539
|
var layerIndex = layer.index;
|
|
1757
2540
|
ctx.layerToItemId[layerIndex] = itemId;
|
|
1758
|
-
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
2541
|
+
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate, ctx.ir.inPoint), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
1759
2542
|
var animation = buildTransformAnimation(layer, ctx);
|
|
1760
2543
|
var position = computeStaticPosition(layer, ctx);
|
|
1761
2544
|
var objectBindingTrackId = buildTimelineTracks(ctx.collector, delay, layerDuration, 4, animation, 'precomp');
|
|
1762
|
-
var
|
|
1763
|
-
var content = buildPrecompContent(
|
|
2545
|
+
var effectsSpecific = getEffectsLayerSpecific(ctx.ir, layer);
|
|
2546
|
+
var content = buildPrecompContent(effectsSpecific == null ? void 0 : effectsSpecific.precompContent, effectsSpecific == null ? void 0 : effectsSpecific.precompRefId);
|
|
1764
2547
|
var item = {
|
|
1765
2548
|
id: itemId,
|
|
1766
2549
|
dataType: 'VFXItemData',
|
|
1767
2550
|
name: layer.name,
|
|
1768
2551
|
duration: layerDuration,
|
|
1769
2552
|
type: '7',
|
|
1770
|
-
visible: layer.
|
|
2553
|
+
visible: layer.visible,
|
|
1771
2554
|
endBehavior: 4,
|
|
1772
2555
|
delay: delay,
|
|
1773
2556
|
renderLevel: 'B+',
|
|
@@ -1811,14 +2594,13 @@ function isRecord$3(value) {
|
|
|
1811
2594
|
* the layer's logical position; the sprite/text child carries the visual
|
|
1812
2595
|
* content offset by the anchor so the pivot is at the right point.
|
|
1813
2596
|
*
|
|
1814
|
-
* Used by both `processParentLayer`
|
|
1815
|
-
*
|
|
1816
|
-
|
|
1817
|
-
* while transformSplit always uses `[1, 1, 1]`.
|
|
1818
|
-
*/ function emitNullSpritePair(layer, ctx, childScale) {
|
|
2597
|
+
* Used by both `processParentLayer` and GE lowering for layers that require a
|
|
2598
|
+
* pivot container.
|
|
2599
|
+
*/ function emitNullSpritePair(layer, ctx) {
|
|
1819
2600
|
var layerIndex = layer.index;
|
|
1820
|
-
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
1821
|
-
var
|
|
2601
|
+
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate, ctx.ir.inPoint), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
2602
|
+
var bounds = getLayerLocalBounds(layer);
|
|
2603
|
+
var x = bounds.x, y = bounds.y, layerWidth = bounds.width, layerHeight = bounds.height;
|
|
1822
2604
|
var nullItemId = createId();
|
|
1823
2605
|
ctx.layerToItemId[layerIndex] = nullItemId;
|
|
1824
2606
|
var nullAnimation = buildTransformAnimation(layer, ctx);
|
|
@@ -1863,9 +2645,11 @@ function isRecord$3(value) {
|
|
|
1863
2645
|
});
|
|
1864
2646
|
var childItemId = createId();
|
|
1865
2647
|
var anchor = getStaticAnchor(layer);
|
|
2648
|
+
var centerX = x + layerWidth / 2;
|
|
2649
|
+
var centerY = y + layerHeight / 2;
|
|
1866
2650
|
var childPosition = [
|
|
1867
|
-
-ctx.ratio * (anchor[0] -
|
|
1868
|
-
ctx.ratio * (anchor[1] -
|
|
2651
|
+
-ctx.ratio * (anchor[0] - centerX),
|
|
2652
|
+
ctx.ratio * (anchor[1] - centerY),
|
|
1869
2653
|
0
|
|
1870
2654
|
];
|
|
1871
2655
|
var childColorAnim = buildColorAnimation(layer, ctx.ir);
|
|
@@ -1878,13 +2662,22 @@ function isRecord$3(value) {
|
|
|
1878
2662
|
}
|
|
1879
2663
|
var scaledW = roundNumber(ctx.ratio * layerWidth, 4);
|
|
1880
2664
|
var scaledH = roundNumber(ctx.ratio * layerHeight, 4);
|
|
2665
|
+
var childScale = layer.type === 'text' ? [
|
|
2666
|
+
scaledW,
|
|
2667
|
+
scaledH,
|
|
2668
|
+
1
|
|
2669
|
+
] : [
|
|
2670
|
+
1,
|
|
2671
|
+
1,
|
|
2672
|
+
1
|
|
2673
|
+
];
|
|
1881
2674
|
var childItem = {
|
|
1882
2675
|
id: childItemId,
|
|
1883
2676
|
dataType: 'VFXItemData',
|
|
1884
2677
|
name: layer.name,
|
|
1885
2678
|
duration: layerDuration,
|
|
1886
2679
|
type: getGEItemTypeCode(layer.type),
|
|
1887
|
-
visible: layer.
|
|
2680
|
+
visible: layer.visible,
|
|
1888
2681
|
endBehavior: 0,
|
|
1889
2682
|
delay: delay,
|
|
1890
2683
|
renderLevel: 'B+',
|
|
@@ -1915,35 +2708,24 @@ function isRecord$3(value) {
|
|
|
1915
2708
|
});
|
|
1916
2709
|
}
|
|
1917
2710
|
function processParentLayer(layer, ctx) {
|
|
1918
|
-
|
|
1919
|
-
var scaledW = roundNumber(ctx.ratio * layerWidth, 4);
|
|
1920
|
-
var scaledH = roundNumber(ctx.ratio * layerHeight, 4);
|
|
1921
|
-
var childScale = layer.type === 'text' ? [
|
|
1922
|
-
scaledW,
|
|
1923
|
-
scaledH,
|
|
1924
|
-
1
|
|
1925
|
-
] : [
|
|
1926
|
-
1,
|
|
1927
|
-
1,
|
|
1928
|
-
1
|
|
1929
|
-
];
|
|
1930
|
-
emitNullSpritePair(layer, ctx, childScale);
|
|
2711
|
+
emitNullSpritePair(layer, ctx);
|
|
1931
2712
|
}
|
|
1932
2713
|
function processVisualLayer(layer, ctx) {
|
|
1933
|
-
|
|
1934
|
-
|
|
2714
|
+
var strategy = planGELayerLowering(ctx.ir, layer);
|
|
2715
|
+
if (strategy.kind === 'split-null-sprite') {
|
|
2716
|
+
processPivotContainerLayer(layer, ctx);
|
|
1935
2717
|
return;
|
|
1936
2718
|
}
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
processTransformSplitLayer(layer, ctx);
|
|
2719
|
+
if (layer.type === 'shape' && layer.shapes != null && layer.shapes.length > 0) {
|
|
2720
|
+
processShapeLayerMultiItem(layer, ctx);
|
|
1940
2721
|
return;
|
|
1941
2722
|
}
|
|
1942
2723
|
var itemId = createId();
|
|
1943
2724
|
var layerIndex = layer.index;
|
|
1944
2725
|
ctx.layerToItemId[layerIndex] = itemId;
|
|
1945
|
-
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
1946
|
-
var
|
|
2726
|
+
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate, ctx.ir.inPoint), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
2727
|
+
var bounds = getLayerLocalBounds(layer);
|
|
2728
|
+
var layerWidth = bounds.width, layerHeight = bounds.height;
|
|
1947
2729
|
var scaledW = ctx.ratio * layerWidth;
|
|
1948
2730
|
var scaledH = ctx.ratio * layerHeight;
|
|
1949
2731
|
var _strategy_anchorScale = strategy.anchorScale, anchorScaleX = _strategy_anchorScale[0], anchorScaleY = _strategy_anchorScale[1];
|
|
@@ -1954,7 +2736,7 @@ function processVisualLayer(layer, ctx) {
|
|
|
1954
2736
|
colorOverLifetime: colorAnimation
|
|
1955
2737
|
});
|
|
1956
2738
|
var rawPosition = computeStaticPosition(layer, ctx, anchorOffsetX, anchorOffsetY);
|
|
1957
|
-
var position = applyScalePositionAdjust(rawPosition, layer,
|
|
2739
|
+
var position = applyScalePositionAdjust(rawPosition, layer, bounds, ctx.ratio);
|
|
1958
2740
|
var itemType = getGEItemType(layer.type);
|
|
1959
2741
|
var objectBindingTrackId = buildTimelineTracks(ctx.collector, delay, layerDuration, 0, fullAnimation, itemType);
|
|
1960
2742
|
var componentId = buildComponent(layer, itemId, anchorScaleX, anchorScaleY, ctx);
|
|
@@ -1981,7 +2763,7 @@ function processVisualLayer(layer, ctx) {
|
|
|
1981
2763
|
name: layer.name,
|
|
1982
2764
|
duration: layerDuration,
|
|
1983
2765
|
type: getGEItemTypeCode(layer.type),
|
|
1984
|
-
visible: layer.
|
|
2766
|
+
visible: layer.visible,
|
|
1985
2767
|
endBehavior: 0,
|
|
1986
2768
|
delay: delay,
|
|
1987
2769
|
renderLevel: 'B+',
|
|
@@ -2010,19 +2792,24 @@ function processVisualLayer(layer, ctx) {
|
|
|
2010
2792
|
layerIndex: layerIndex
|
|
2011
2793
|
});
|
|
2012
2794
|
}
|
|
2013
|
-
function
|
|
2014
|
-
emitNullSpritePair(layer, ctx
|
|
2015
|
-
1,
|
|
2016
|
-
1,
|
|
2017
|
-
1
|
|
2018
|
-
]);
|
|
2795
|
+
function processPivotContainerLayer(layer, ctx) {
|
|
2796
|
+
emitNullSpritePair(layer, ctx);
|
|
2019
2797
|
}
|
|
2020
2798
|
function processShapeLayerMultiItem(layer, ctx) {
|
|
2021
2799
|
var layerIndex = layer.index;
|
|
2022
|
-
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
2023
|
-
|
|
2800
|
+
var _computeLayerTiming = computeLayerTiming(layer, ctx.frameRate, ctx.ir.inPoint), delay = _computeLayerTiming.delay, layerDuration = _computeLayerTiming.layerDuration;
|
|
2801
|
+
// A GE Shape item commonly has no transform.size, so ge2ir cannot recover
|
|
2802
|
+
// layer-local bounds. Treat missing bounds as empty here: the generic 1×1
|
|
2803
|
+
// fallback would invent a half-pixel anchor offset and shift every rebuilt
|
|
2804
|
+
// shape (notably mask sources) away from its authored position.
|
|
2805
|
+
var bounds = getLayerLocalBounds(layer, {
|
|
2806
|
+
x: 0,
|
|
2807
|
+
y: 0,
|
|
2808
|
+
width: 0,
|
|
2809
|
+
height: 0
|
|
2810
|
+
});
|
|
2024
2811
|
var anchor = getStaticAnchor(layer);
|
|
2025
|
-
var _computeAnchorInfo = computeAnchorInfo(layer,
|
|
2812
|
+
var _computeAnchorInfo = computeAnchorInfo(layer, bounds), anchorOffsetX = _computeAnchorInfo.anchorOffsetX, anchorOffsetY = _computeAnchorInfo.anchorOffsetY;
|
|
2026
2813
|
var animation = buildTransformAnimation(layer, ctx);
|
|
2027
2814
|
var colorAnimation = buildColorAnimation(layer, ctx.ir);
|
|
2028
2815
|
var fullAnimation = _extends({}, animation, {
|
|
@@ -2057,7 +2844,7 @@ function processShapeLayerMultiItem(layer, ctx) {
|
|
|
2057
2844
|
});
|
|
2058
2845
|
// Mask source shape (isMask:true) — copy onto the first shape item only.
|
|
2059
2846
|
if (shapeIdx === 0) {
|
|
2060
|
-
|
|
2847
|
+
applyGEMask(ctx.ir, layer, component);
|
|
2061
2848
|
}
|
|
2062
2849
|
ctx.collector.components.push(component);
|
|
2063
2850
|
if (shapeIdx === 0) {
|
|
@@ -2070,7 +2857,7 @@ function processShapeLayerMultiItem(layer, ctx) {
|
|
|
2070
2857
|
name: shapeIdx === 0 ? layer.name : layer.name + "_shape_" + shapeIdx,
|
|
2071
2858
|
duration: layerDuration,
|
|
2072
2859
|
type: 'shape',
|
|
2073
|
-
visible: layer.
|
|
2860
|
+
visible: layer.visible,
|
|
2074
2861
|
endBehavior: 0,
|
|
2075
2862
|
delay: delay,
|
|
2076
2863
|
renderLevel: 'B+',
|
|
@@ -2177,7 +2964,7 @@ var DEFAULT_PLAYER_VERSION = {
|
|
|
2177
2964
|
};
|
|
2178
2965
|
}
|
|
2179
2966
|
return {
|
|
2180
|
-
version:
|
|
2967
|
+
version: JSONSceneVersion['3_6'],
|
|
2181
2968
|
playerVersion: DEFAULT_PLAYER_VERSION,
|
|
2182
2969
|
images: collector.images,
|
|
2183
2970
|
fonts: [],
|
|
@@ -2203,16 +2990,20 @@ function deriveDuration(ir) {
|
|
|
2203
2990
|
}
|
|
2204
2991
|
/**
|
|
2205
2992
|
* Map IR composition end behavior to GE's numeric end-behavior.
|
|
2206
|
-
*
|
|
2207
|
-
*
|
|
2993
|
+
* Undefined defaults to Restart (5) for backward compatibility. DSL's boolean
|
|
2994
|
+
* loop flag maps to either Restart or Destroy at the adapter boundary.
|
|
2208
2995
|
*/ function mapCompositionEndBehavior(eb) {
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2996
|
+
switch(eb){
|
|
2997
|
+
case undefined:
|
|
2998
|
+
case animationIr.IREndBehavior.Restart:
|
|
2999
|
+
return 5;
|
|
3000
|
+
case animationIr.IREndBehavior.Forward:
|
|
3001
|
+
return 2;
|
|
3002
|
+
case animationIr.IREndBehavior.Freeze:
|
|
3003
|
+
return 4;
|
|
3004
|
+
case animationIr.IREndBehavior.Destroy:
|
|
3005
|
+
return 0;
|
|
2214
3006
|
}
|
|
2215
|
-
return 0;
|
|
2216
3007
|
}
|
|
2217
3008
|
function colorToRoundedRgba(color) {
|
|
2218
3009
|
return [
|
|
@@ -2283,13 +3074,10 @@ function applyMasks(ir, collector, processedItems, ratio, width, height, frameRa
|
|
|
2283
3074
|
continue;
|
|
2284
3075
|
}
|
|
2285
3076
|
var layerComponentId = lookup.getComponentId(layer.index);
|
|
2286
|
-
buildMaskForLayer(layer, layerItemId, layerComponentId, collector, processedItems, ratio, width, height, frameRate, lookup, maskSlotMeta, componentById, maskData);
|
|
3077
|
+
buildMaskForLayer(layer, layerItemId, layerComponentId, collector, processedItems, ratio, width, height, frameRate, ir.inPoint, lookup, maskSlotMeta, componentById, maskData);
|
|
2287
3078
|
}
|
|
2288
3079
|
}
|
|
2289
|
-
function
|
|
2290
|
-
return mask.paths[0];
|
|
2291
|
-
}
|
|
2292
|
-
function buildMaskForLayer(layer, layerItemId, layerComponentId, collector, processedItems, ratio, width, height, frameRate, lookup, maskSlotMeta, componentById, maskData) {
|
|
3080
|
+
function buildMaskForLayer(layer, layerItemId, layerComponentId, collector, processedItems, ratio, width, height, frameRate, compositionInPoint, lookup, maskSlotMeta, componentById, maskData) {
|
|
2293
3081
|
var mask = maskData != null ? maskData : layer.mask;
|
|
2294
3082
|
var maskItemId = createId();
|
|
2295
3083
|
var maskComponentId = createId();
|
|
@@ -2297,7 +3085,7 @@ function buildMaskForLayer(layer, layerItemId, layerComponentId, collector, proc
|
|
|
2297
3085
|
var _getStaticAnchor = getStaticAnchor(layer), anchorX = _getStaticAnchor[0], anchorY = _getStaticAnchor[1];
|
|
2298
3086
|
var maskPosX = roundNumber((maskBounds.cx - anchorX) * ratio, 4);
|
|
2299
3087
|
var maskPosY = roundNumber(-(maskBounds.cy - anchorY) * ratio, 4);
|
|
2300
|
-
var timing = computeLayerTiming(layer, frameRate);
|
|
3088
|
+
var timing = computeLayerTiming(layer, frameRate, compositionInPoint);
|
|
2301
3089
|
var delay = timing.delay;
|
|
2302
3090
|
var maskDuration = timing.layerDuration;
|
|
2303
3091
|
var layerIsParent = lookup.isParentLayer(layer.index) || layer.type === 'null' || layer.type === 'precomp';
|
|
@@ -2489,8 +3277,8 @@ function computePointBounds(points) {
|
|
|
2489
3277
|
};
|
|
2490
3278
|
}
|
|
2491
3279
|
function isMaskExactCrop(mask, layer, width, height, lookup) {
|
|
2492
|
-
var path =
|
|
2493
|
-
if (path
|
|
3280
|
+
var path = mask.path;
|
|
3281
|
+
if (path.points.length === 0) {
|
|
2494
3282
|
return true;
|
|
2495
3283
|
}
|
|
2496
3284
|
var _computePointBounds = computePointBounds(path.points), minX = _computePointBounds.minX, minY = _computePointBounds.minY, maxX = _computePointBounds.maxX, maxY = _computePointBounds.maxY;
|
|
@@ -2515,8 +3303,8 @@ function isMaskExactCrop(mask, layer, width, height, lookup) {
|
|
|
2515
3303
|
return false;
|
|
2516
3304
|
}
|
|
2517
3305
|
function getMaskBounds(mask) {
|
|
2518
|
-
var path =
|
|
2519
|
-
if (path
|
|
3306
|
+
var path = mask.path;
|
|
3307
|
+
if (path.points.length === 0) {
|
|
2520
3308
|
return {
|
|
2521
3309
|
cx: 0,
|
|
2522
3310
|
cy: 0,
|
|
@@ -2533,47 +3321,41 @@ function getMaskBounds(mask) {
|
|
|
2533
3321
|
};
|
|
2534
3322
|
}
|
|
2535
3323
|
function isSimpleRectMask(mask) {
|
|
2536
|
-
var path =
|
|
2537
|
-
|
|
2538
|
-
return
|
|
2539
|
-
}
|
|
2540
|
-
|
|
2541
|
-
return Math.abs(e.x) < 0.01 && Math.abs(e.y) < 0.01;
|
|
2542
|
-
}) && path.easingOuts.every(function(e) {
|
|
2543
|
-
return Math.abs(e.x) < 0.01 && Math.abs(e.y) < 0.01;
|
|
3324
|
+
var path = mask.path;
|
|
3325
|
+
return path.points.length === 4 && path.inTangents.every(function(tangent) {
|
|
3326
|
+
return Math.abs(tangent.x) < 0.01 && Math.abs(tangent.y) < 0.01;
|
|
3327
|
+
}) && path.outTangents.every(function(tangent) {
|
|
3328
|
+
return Math.abs(tangent.x) < 0.01 && Math.abs(tangent.y) < 0.01;
|
|
2544
3329
|
});
|
|
2545
3330
|
}
|
|
2546
3331
|
function buildPolygonMaskComponent(maskComponentId, maskItemId, mask, bounds, ratio) {
|
|
2547
|
-
var
|
|
2548
|
-
var path = getPrimaryPath(mask);
|
|
3332
|
+
var path = mask.path;
|
|
2549
3333
|
var customPoints = [];
|
|
2550
3334
|
var customEasingIns = [];
|
|
2551
3335
|
var customEasingOuts = [];
|
|
2552
3336
|
var customIndexes = [];
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
});
|
|
2576
|
-
}
|
|
3337
|
+
for(var idx = 0; idx < path.points.length; idx++){
|
|
3338
|
+
var _ref, _ref1, _ref2, _ref3;
|
|
3339
|
+
var pt = path.points[idx];
|
|
3340
|
+
var ei = path.inTangents[idx];
|
|
3341
|
+
var eo = path.outTangents[idx];
|
|
3342
|
+
customPoints.push({
|
|
3343
|
+
x: roundNumber((pt.x - bounds.cx) * ratio, 4),
|
|
3344
|
+
y: roundNumber(-(pt.y - bounds.cy) * ratio, 4)
|
|
3345
|
+
});
|
|
3346
|
+
customEasingIns.push({
|
|
3347
|
+
x: roundNumber(((_ref = ei == null ? void 0 : ei.x) != null ? _ref : 0) * ratio, 4),
|
|
3348
|
+
y: roundNumber(-((_ref1 = ei == null ? void 0 : ei.y) != null ? _ref1 : 0) * ratio, 4)
|
|
3349
|
+
});
|
|
3350
|
+
customEasingOuts.push({
|
|
3351
|
+
x: roundNumber(((_ref2 = eo == null ? void 0 : eo.x) != null ? _ref2 : 0) * ratio, 4),
|
|
3352
|
+
y: roundNumber(-((_ref3 = eo == null ? void 0 : eo.y) != null ? _ref3 : 0) * ratio, 4)
|
|
3353
|
+
});
|
|
3354
|
+
customIndexes.push({
|
|
3355
|
+
point: idx,
|
|
3356
|
+
easingIn: idx,
|
|
3357
|
+
easingOut: idx
|
|
3358
|
+
});
|
|
2577
3359
|
}
|
|
2578
3360
|
return {
|
|
2579
3361
|
id: maskComponentId,
|
|
@@ -2585,7 +3367,7 @@ function buildPolygonMaskComponent(maskComponentId, maskItemId, mask, bounds, ra
|
|
|
2585
3367
|
easingOuts: customEasingOuts,
|
|
2586
3368
|
shapes: [
|
|
2587
3369
|
{
|
|
2588
|
-
close:
|
|
3370
|
+
close: path.closed,
|
|
2589
3371
|
indexes: customIndexes
|
|
2590
3372
|
}
|
|
2591
3373
|
],
|
|
@@ -2618,10 +3400,10 @@ function buildPolygonMaskComponent(maskComponentId, maskItemId, mask, bounds, ra
|
|
|
2618
3400
|
* Remap GE mask references after ge2ir round-trip.
|
|
2619
3401
|
*
|
|
2620
3402
|
* ge2ir carries each masked component's raw `mask` object verbatim (via
|
|
2621
|
-
* `IRLayerNode.
|
|
3403
|
+
* `IRLayerNode.specific.effects.mask`), but `mask.reference.id` still points at the
|
|
2622
3404
|
* ORIGINAL (GE1) mask-source component id, which ir2ge has regenerated. This
|
|
2623
3405
|
* pass rewrites every target's `reference.id` from the stale GE1 id to the
|
|
2624
|
-
* freshly-minted GE2 component id, using the `
|
|
3406
|
+
* freshly-minted GE2 component id, using the `GEComponentId → newId` map built
|
|
2625
3407
|
* during the layer walk.
|
|
2626
3408
|
*
|
|
2627
3409
|
* Mirrors `applyParenting`: an IR-side reference (here the stale id stored in
|
|
@@ -2629,7 +3411,7 @@ function buildPolygonMaskComponent(maskComponentId, maskItemId, mask, bounds, ra
|
|
|
2629
3411
|
* no `reference` and are skipped. Dangling references (source not regenerated —
|
|
2630
3412
|
* e.g. dropped by the null+sprite merger) have their `mask` removed so the GE
|
|
2631
3413
|
* runtime doesn't choke on an id that resolves to nothing.
|
|
2632
|
-
*/ function
|
|
3414
|
+
*/ function applyGEMaskRemap(collector, GEComponentIdToNewId) {
|
|
2633
3415
|
for(var _iterator = _create_for_of_iterator_helper_loose(collector.components), _step; !(_step = _iterator()).done;){
|
|
2634
3416
|
var component = _step.value;
|
|
2635
3417
|
var mask = component['mask'];
|
|
@@ -2641,7 +3423,7 @@ function buildPolygonMaskComponent(maskComponentId, maskItemId, mask, bounds, ra
|
|
|
2641
3423
|
if (oldId == null) {
|
|
2642
3424
|
continue;
|
|
2643
3425
|
}
|
|
2644
|
-
var newId =
|
|
3426
|
+
var newId = GEComponentIdToNewId[oldId];
|
|
2645
3427
|
if (newId == null) {
|
|
2646
3428
|
// Dangling: the referenced source was not regenerated. Drop the mask so
|
|
2647
3429
|
// the target renders unmasked rather than referencing a nonexistent id.
|
|
@@ -2656,15 +3438,15 @@ function buildPolygonMaskComponent(maskComponentId, maskItemId, mask, bounds, ra
|
|
|
2656
3438
|
* Normalize child visibility delays so children never appear before their parent.
|
|
2657
3439
|
*
|
|
2658
3440
|
* Topologically sorts items (parent-first) so by the time we process any child
|
|
2659
|
-
* its parent's delay/duration are already finalized. For
|
|
2660
|
-
*
|
|
3441
|
+
* its parent's delay/duration are already finalized. For children with an
|
|
3442
|
+
* independent lifetime, we instead advance the parent's delay/duration so the
|
|
2661
3443
|
* child can render from its own start time (GE requires the parent to be active
|
|
2662
3444
|
* for transform inheritance, but the parent-link relationship does not propagate
|
|
2663
3445
|
* visibility). Only the ActivationTrack clip is updated; TransformTrack
|
|
2664
3446
|
* keyframes are normalized to the original time range and would hold their
|
|
2665
3447
|
* first frame value if the track started earlier.
|
|
2666
3448
|
*/ function normalizeChildVisibilityByParentDelays(param) {
|
|
2667
|
-
var items = param.items, miscs = param.miscs, processedItems = param.processedItems,
|
|
3449
|
+
var items = param.items, miscs = param.miscs, processedItems = param.processedItems, _param_independentLifetimeChildItemIds = param.independentLifetimeChildItemIds, independentLifetimeChildItemIds = _param_independentLifetimeChildItemIds === void 0 ? new Set() : _param_independentLifetimeChildItemIds, roundNumber = param.roundNumber;
|
|
2668
3450
|
var itemById = new Map();
|
|
2669
3451
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
2670
3452
|
var item = _step.value;
|
|
@@ -2680,9 +3462,9 @@ function buildPolygonMaskComponent(maskComponentId, maskItemId, mask, bounds, ra
|
|
|
2680
3462
|
var misc = _step2.value;
|
|
2681
3463
|
miscById.set(misc['id'], misc);
|
|
2682
3464
|
}
|
|
2683
|
-
// Phase 1: Advance transform
|
|
3465
|
+
// Phase 1: Advance transform parents so independent-lifetime children can
|
|
2684
3466
|
// render from the child's own start time.
|
|
2685
|
-
|
|
3467
|
+
advanceIndependentLifetimeParents(items, itemById, processedByItemId, miscById, independentLifetimeChildItemIds, roundNumber);
|
|
2686
3468
|
// Phase 2: Normalize precomp child visibility (unchanged).
|
|
2687
3469
|
var effectiveDelayCache = new Map();
|
|
2688
3470
|
function getEffectiveDelay(itemId, visited) {
|
|
@@ -2744,8 +3526,8 @@ function buildPolygonMaskComponent(maskComponentId, maskItemId, mask, bounds, ra
|
|
|
2744
3526
|
syncTimelineClips(itemId, effectiveDelay, newDuration, processedByItemId, miscById, roundNumber);
|
|
2745
3527
|
}
|
|
2746
3528
|
}
|
|
2747
|
-
function
|
|
2748
|
-
if (
|
|
3529
|
+
function advanceIndependentLifetimeParents(items, itemById, processedByItemId, miscById, independentLifetimeChildItemIds, roundNumber) {
|
|
3530
|
+
if (independentLifetimeChildItemIds.size === 0) {
|
|
2749
3531
|
return;
|
|
2750
3532
|
}
|
|
2751
3533
|
// Collect the maximum advance (head) and extension (tail) needed per parent.
|
|
@@ -2754,7 +3536,7 @@ function advanceTransformOnlyParentLinkParents(items, itemById, processedByItemI
|
|
|
2754
3536
|
for(var _iterator = _create_for_of_iterator_helper_loose(items), _step; !(_step = _iterator()).done;){
|
|
2755
3537
|
var item = _step.value;
|
|
2756
3538
|
var _item_delay, _item_duration, _parentItem_delay, _parentItem_duration;
|
|
2757
|
-
if (!
|
|
3539
|
+
if (!independentLifetimeChildItemIds.has(item['id'])) {
|
|
2758
3540
|
continue;
|
|
2759
3541
|
}
|
|
2760
3542
|
var parentId = item['parentId'];
|
|
@@ -2789,7 +3571,8 @@ function advanceTransformOnlyParentLinkParents(items, itemById, processedByItemI
|
|
|
2789
3571
|
}
|
|
2790
3572
|
}
|
|
2791
3573
|
// Merge all parent IDs that need adjustment.
|
|
2792
|
-
|
|
3574
|
+
// Materialize Map iterators: loose SWC array-spread lowering assumes arrays.
|
|
3575
|
+
var allParentIds = new Set([].concat(Array.from(parentAdvanceMap.keys()), Array.from(parentExtendMap.keys())));
|
|
2793
3576
|
// Apply adjustments: update parent item delay/duration and sync ActivationTrack clips.
|
|
2794
3577
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(allParentIds), _step1; !(_step1 = _iterator1()).done;){
|
|
2795
3578
|
var parentId1 = _step1.value;
|
|
@@ -2889,18 +3672,18 @@ function syncTimelineClips(itemId, delay, duration, processedByItemId, miscById,
|
|
|
2889
3672
|
*/ function applyPostProcess(ir, state) {
|
|
2890
3673
|
applyParentingStep(ir, state);
|
|
2891
3674
|
applySharedMaskPostProcess(ir, state);
|
|
2892
|
-
|
|
3675
|
+
applyGEMaskRemapStep(ir, state);
|
|
2893
3676
|
applyVisibilityStep(ir, state);
|
|
2894
3677
|
}
|
|
2895
|
-
function
|
|
2896
|
-
// Only
|
|
3678
|
+
function applyGEMaskRemapStep(ir, state) {
|
|
3679
|
+
// Only Effects-sourced compositions carry passthrough mask references that need
|
|
2897
3680
|
// remapping. Lottie/dsl masks are built with correct ids by applyMasks and
|
|
2898
|
-
// must not be touched (their reference ids are absent from the
|
|
3681
|
+
// must not be touched (their reference ids are absent from the GE map, so a
|
|
2899
3682
|
// blind remap would wrongly delete them).
|
|
2900
|
-
if (ir.source !== '
|
|
3683
|
+
if (ir.source !== 'effects' || state.GEComponentIdToNewId == null) {
|
|
2901
3684
|
return;
|
|
2902
3685
|
}
|
|
2903
|
-
|
|
3686
|
+
applyGEMaskRemap(state.collector, state.GEComponentIdToNewId);
|
|
2904
3687
|
}
|
|
2905
3688
|
function applySharedMaskPostProcess(ir, state) {
|
|
2906
3689
|
if (state.maskLookup == null || state.ratio == null || state.width == null || state.height == null || state.frameRate == null) {
|
|
@@ -2920,13 +3703,13 @@ function applyVisibilityStep(ir, state) {
|
|
|
2920
3703
|
if (layerToItemId == null) {
|
|
2921
3704
|
return;
|
|
2922
3705
|
}
|
|
2923
|
-
var
|
|
3706
|
+
var independentLifetimeChildItemIds = new Set();
|
|
2924
3707
|
for(var _iterator = _create_for_of_iterator_helper_loose(ir.layers), _step; !(_step = _iterator()).done;){
|
|
2925
3708
|
var layer = _step.value;
|
|
2926
|
-
if (
|
|
3709
|
+
if (hasIndependentParentLifetime(layer)) {
|
|
2927
3710
|
var itemId = layerToItemId[layer.index];
|
|
2928
3711
|
if (itemId != null) {
|
|
2929
|
-
|
|
3712
|
+
independentLifetimeChildItemIds.add(itemId);
|
|
2930
3713
|
}
|
|
2931
3714
|
}
|
|
2932
3715
|
}
|
|
@@ -2934,25 +3717,72 @@ function applyVisibilityStep(ir, state) {
|
|
|
2934
3717
|
items: collector.items,
|
|
2935
3718
|
miscs: collector.miscs,
|
|
2936
3719
|
processedItems: processedItems,
|
|
2937
|
-
|
|
3720
|
+
independentLifetimeChildItemIds: independentLifetimeChildItemIds,
|
|
2938
3721
|
roundNumber: roundNumber
|
|
2939
3722
|
});
|
|
2940
3723
|
}
|
|
2941
3724
|
|
|
3725
|
+
var OMIT = Symbol('omit-json-value');
|
|
3726
|
+
/** Return a detached value whose runtime shape is stable across JSON persistence. */ function normalizeJsonValue(value) {
|
|
3727
|
+
var normalized = normalize(value, '$', false);
|
|
3728
|
+
if (normalized === OMIT) {
|
|
3729
|
+
throw new TypeError('[ge-ir] A top-level JSON value cannot be undefined.');
|
|
3730
|
+
}
|
|
3731
|
+
return normalized;
|
|
3732
|
+
}
|
|
3733
|
+
function normalize(value, path, inArray) {
|
|
3734
|
+
if (value === undefined) {
|
|
3735
|
+
return inArray ? null : OMIT;
|
|
3736
|
+
}
|
|
3737
|
+
if (value === null || typeof value === 'string' || typeof value === 'boolean') {
|
|
3738
|
+
return value;
|
|
3739
|
+
}
|
|
3740
|
+
if (typeof value === 'number') {
|
|
3741
|
+
if (!Number.isFinite(value)) {
|
|
3742
|
+
throw new TypeError("[ge-ir] Non-finite number at " + path + " is not JSON-compatible.");
|
|
3743
|
+
}
|
|
3744
|
+
return Object.is(value, -0) ? 0 : value;
|
|
3745
|
+
}
|
|
3746
|
+
if (Array.isArray(value)) {
|
|
3747
|
+
return value.map(function(item, index) {
|
|
3748
|
+
var normalizedItem = normalize(item, path + "[" + index + "]", true);
|
|
3749
|
+
if (normalizedItem === OMIT) {
|
|
3750
|
+
throw new TypeError("[ge-ir] Array item at " + path + "[" + index + "] could not be normalized.");
|
|
3751
|
+
}
|
|
3752
|
+
return normalizedItem;
|
|
3753
|
+
});
|
|
3754
|
+
}
|
|
3755
|
+
if ((typeof value === "undefined" ? "undefined" : _type_of(value)) !== 'object') {
|
|
3756
|
+
throw new TypeError("[ge-ir] " + (typeof value === "undefined" ? "undefined" : _type_of(value)) + " at " + path + " is not JSON-compatible.");
|
|
3757
|
+
}
|
|
3758
|
+
var prototype = Reflect.getPrototypeOf(value);
|
|
3759
|
+
if (prototype !== Object.prototype && prototype !== null) {
|
|
3760
|
+
throw new TypeError("[ge-ir] Non-plain object at " + path + " is not JSON-compatible.");
|
|
3761
|
+
}
|
|
3762
|
+
var result = {};
|
|
3763
|
+
for(var _iterator = _create_for_of_iterator_helper_loose(Object.entries(value)), _step; !(_step = _iterator()).done;){
|
|
3764
|
+
var _step_value = _step.value, key = _step_value[0], item = _step_value[1];
|
|
3765
|
+
var normalizedItem = normalize(item, path + "." + key, false);
|
|
3766
|
+
if (normalizedItem !== OMIT) {
|
|
3767
|
+
result[key] = normalizedItem;
|
|
3768
|
+
}
|
|
3769
|
+
}
|
|
3770
|
+
return result;
|
|
3771
|
+
}
|
|
3772
|
+
|
|
2942
3773
|
/**
|
|
2943
3774
|
* Convert an IR composition to a GE JSONScene.
|
|
2944
3775
|
*
|
|
2945
|
-
* All IR sources (lottie,
|
|
2946
|
-
* pipeline.
|
|
2947
|
-
*
|
|
2948
|
-
*
|
|
2949
|
-
* that cannot be expressed via data existence.
|
|
3776
|
+
* All IR sources (lottie, dsl, future) go through this single unified
|
|
3777
|
+
* pipeline. Normalized animation semantics select the GE lowering plan;
|
|
3778
|
+
* source-specific payloads may preserve authored GE hierarchy or restore
|
|
3779
|
+
* mask and precomp graphs.
|
|
2950
3780
|
*
|
|
2951
3781
|
* The optional `duration` arg is a caller override; lottie2ge currently passes
|
|
2952
3782
|
* the duration computed from the raw json upstream. When omitted, the
|
|
2953
3783
|
* canonical assembler derives it from `(outPoint - inPoint) / frameRate`.
|
|
2954
3784
|
*/ function convertIRToGE(ir, duration) {
|
|
2955
|
-
animationIr.
|
|
3785
|
+
animationIr.validateIRCompositionOrThrow(ir);
|
|
2956
3786
|
var width = ir.width, height = ir.height, frameRate = ir.frameRate;
|
|
2957
3787
|
var ratio = get2dTo3dRatio(width, height);
|
|
2958
3788
|
var collector = {
|
|
@@ -2995,15 +3825,15 @@ function applyVisibilityStep(ir, state) {
|
|
|
2995
3825
|
}
|
|
2996
3826
|
// Build GE1-component-id → regenerated-component-id map for mask reference
|
|
2997
3827
|
// remapping (ge2ir round-trip). Keyed by the original GE component id that
|
|
2998
|
-
// ge2ir stored in
|
|
2999
|
-
var
|
|
3828
|
+
// ge2ir stored in specific.effects; value is the component id this layer minted.
|
|
3829
|
+
var GEComponentIdToNewId = {};
|
|
3000
3830
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(workingIR.layers), _step2; !(_step2 = _iterator2()).done;){
|
|
3001
3831
|
var layer2 = _step2.value;
|
|
3002
|
-
var
|
|
3003
|
-
var
|
|
3832
|
+
var _getEffectsLayerSpecific;
|
|
3833
|
+
var GEComponentId = (_getEffectsLayerSpecific = getEffectsLayerSpecific(workingIR, layer2)) == null ? void 0 : _getEffectsLayerSpecific.sourceComponentId;
|
|
3004
3834
|
var newId = layerToComponentId[layer2.index];
|
|
3005
|
-
if (
|
|
3006
|
-
|
|
3835
|
+
if (GEComponentId != null && newId != null) {
|
|
3836
|
+
GEComponentIdToNewId[GEComponentId] = newId;
|
|
3007
3837
|
}
|
|
3008
3838
|
}
|
|
3009
3839
|
applyPostProcess(workingIR, {
|
|
@@ -3014,7 +3844,7 @@ function applyVisibilityStep(ir, state) {
|
|
|
3014
3844
|
width: width,
|
|
3015
3845
|
height: height,
|
|
3016
3846
|
frameRate: frameRate,
|
|
3017
|
-
|
|
3847
|
+
GEComponentIdToNewId: GEComponentIdToNewId,
|
|
3018
3848
|
maskLookup: {
|
|
3019
3849
|
getItemId: function getItemId(idx) {
|
|
3020
3850
|
return layerToItemId[idx];
|
|
@@ -3029,7 +3859,7 @@ function applyVisibilityStep(ir, state) {
|
|
|
3029
3859
|
});
|
|
3030
3860
|
collector.items.reverse();
|
|
3031
3861
|
processedItems.reverse();
|
|
3032
|
-
return mergePreservedPrecompScene(assembleScene(workingIR, collector, processedItems, duration), workingIR);
|
|
3862
|
+
return normalizeJsonValue(mergePreservedPrecompScene(assembleScene(workingIR, collector, processedItems, duration), workingIR));
|
|
3033
3863
|
}
|
|
3034
3864
|
function processLayer(layer, ctx) {
|
|
3035
3865
|
if (layer.type === 'precomp') {
|
|
@@ -3047,16 +3877,16 @@ function processLayer(layer, ctx) {
|
|
|
3047
3877
|
}
|
|
3048
3878
|
}
|
|
3049
3879
|
function hasGEPrecompMetadata(ir, layer) {
|
|
3050
|
-
var
|
|
3051
|
-
return (
|
|
3880
|
+
var specific = getEffectsLayerSpecific(ir, layer);
|
|
3881
|
+
return (specific == null ? void 0 : specific.precompRefId) != null || (specific == null ? void 0 : specific.precompContent) != null;
|
|
3052
3882
|
}
|
|
3053
3883
|
/**
|
|
3054
|
-
* Extend parent layers' endFrame to cover
|
|
3884
|
+
* Extend parent layers' endFrame to cover independent child lifetimes.
|
|
3055
3885
|
*
|
|
3056
3886
|
* In Lottie, child layers (linked via layer.parent) inherit the parent's transform
|
|
3057
3887
|
* even after the parent becomes invisible. GE requires the parent item to be active
|
|
3058
3888
|
* for transform inheritance to work, so we extend the parent's endFrame to cover
|
|
3059
|
-
* the full lifetime of
|
|
3889
|
+
* the full lifetime of children whose lifetime is independent.
|
|
3060
3890
|
*
|
|
3061
3891
|
* Keyframes beyond the extended endFrame are NOT included — they represent animation
|
|
3062
3892
|
* that never plays in Lottie (layer is invisible and has no child needing it).
|
|
@@ -3075,7 +3905,7 @@ function hasGEPrecompMetadata(ir, layer) {
|
|
|
3075
3905
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(clonedLayers), _step1; !(_step1 = _iterator1()).done;){
|
|
3076
3906
|
var child = _step1.value;
|
|
3077
3907
|
var _child_parent;
|
|
3078
|
-
if (((_child_parent = child.parent) == null ? void 0 : _child_parent.index) === layer.index && child.parent.
|
|
3908
|
+
if (((_child_parent = child.parent) == null ? void 0 : _child_parent.index) === layer.index && child.parent.lifetimeMode === 'independent') {
|
|
3079
3909
|
if (child.time.endFrame > maxEnd) {
|
|
3080
3910
|
maxEnd = child.time.endFrame;
|
|
3081
3911
|
}
|
|
@@ -3094,13 +3924,13 @@ function mergePreservedPrecompScene(generated, ir) {
|
|
|
3094
3924
|
return !isExcludedPoolEntry(pool, entry, excluded);
|
|
3095
3925
|
}));
|
|
3096
3926
|
};
|
|
3097
|
-
var
|
|
3098
|
-
var sourceScene =
|
|
3927
|
+
var specific = getEffectsCompositionSpecific(ir);
|
|
3928
|
+
var sourceScene = specific == null ? void 0 : specific.sourceScene;
|
|
3099
3929
|
if (sourceScene == null) {
|
|
3100
3930
|
return generated;
|
|
3101
3931
|
}
|
|
3102
3932
|
var result = _extends({}, generated);
|
|
3103
|
-
var sourceCompositionId =
|
|
3933
|
+
var sourceCompositionId = specific == null ? void 0 : specific.sourceCompositionId;
|
|
3104
3934
|
var excluded = collectRootCompositionIds(sourceScene, sourceCompositionId);
|
|
3105
3935
|
var pools = [
|
|
3106
3936
|
'images',
|
|
@@ -3282,10 +4112,7 @@ function indexById(entries) {
|
|
|
3282
4112
|
return map;
|
|
3283
4113
|
}
|
|
3284
4114
|
function cloneJson$1(value) {
|
|
3285
|
-
|
|
3286
|
-
return value;
|
|
3287
|
-
}
|
|
3288
|
-
return JSON.parse(JSON.stringify(value));
|
|
4115
|
+
return normalizeJsonValue(value);
|
|
3289
4116
|
}
|
|
3290
4117
|
function isRecord$2(value) {
|
|
3291
4118
|
return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && !Array.isArray(value);
|
|
@@ -3323,23 +4150,25 @@ function resolveDataPathId(ref) {
|
|
|
3323
4150
|
return typeof id === 'string' ? id : undefined;
|
|
3324
4151
|
}
|
|
3325
4152
|
|
|
3326
|
-
function reverseEndBehavior(
|
|
3327
|
-
if (
|
|
4153
|
+
function reverseEndBehavior(GEBehavior) {
|
|
4154
|
+
if (GEBehavior == null) {
|
|
3328
4155
|
return undefined;
|
|
3329
4156
|
}
|
|
3330
|
-
switch(
|
|
4157
|
+
switch(GEBehavior){
|
|
3331
4158
|
case 0:
|
|
3332
|
-
return animationIr.IREndBehavior.
|
|
4159
|
+
return animationIr.IREndBehavior.Destroy;
|
|
4160
|
+
case 2:
|
|
4161
|
+
return animationIr.IREndBehavior.Forward;
|
|
3333
4162
|
case 4:
|
|
3334
|
-
return animationIr.IREndBehavior.
|
|
4163
|
+
return animationIr.IREndBehavior.Freeze;
|
|
3335
4164
|
case 5:
|
|
3336
|
-
return animationIr.IREndBehavior.
|
|
4165
|
+
return animationIr.IREndBehavior.Restart;
|
|
3337
4166
|
default:
|
|
3338
4167
|
return undefined;
|
|
3339
4168
|
}
|
|
3340
4169
|
}
|
|
3341
|
-
function reverseCompositionEndBehavior(
|
|
3342
|
-
return reverseEndBehavior(
|
|
4170
|
+
function reverseCompositionEndBehavior(GEBehavior) {
|
|
4171
|
+
return reverseEndBehavior(GEBehavior);
|
|
3343
4172
|
}
|
|
3344
4173
|
|
|
3345
4174
|
function buildSceneContext(scene, options) {
|
|
@@ -3359,7 +4188,10 @@ function buildSceneContext(scene, options) {
|
|
|
3359
4188
|
var frameRate = options.frameRate;
|
|
3360
4189
|
var ratio = get2dTo3dRatio(width, height);
|
|
3361
4190
|
var inPoint = 0;
|
|
3362
|
-
|
|
4191
|
+
// GE durations are expressed in seconds and are not guaranteed to land on
|
|
4192
|
+
// an integer frame. Preserve the fractional frame so GE → IR → GE does not
|
|
4193
|
+
// shorten or extend the composition at the tail.
|
|
4194
|
+
var outPoint = duration * frameRate;
|
|
3363
4195
|
var endBehavior = reverseCompositionEndBehavior(composition['endBehavior']);
|
|
3364
4196
|
var backgroundColor;
|
|
3365
4197
|
var bg = composition['background'];
|
|
@@ -3567,16 +4399,26 @@ function parseStaticTransform(itemTransform, ctx) {
|
|
|
3567
4399
|
}
|
|
3568
4400
|
var eulerHint = itemTransform['eulerHint'];
|
|
3569
4401
|
if (eulerHint != null) {
|
|
3570
|
-
var
|
|
3571
|
-
|
|
3572
|
-
|
|
3573
|
-
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
|
|
3577
|
-
|
|
3578
|
-
|
|
3579
|
-
|
|
4402
|
+
var x = Math.abs(eulerHint.x) > 1e-6 ? {
|
|
4403
|
+
keyframed: false,
|
|
4404
|
+
value: eulerHint.x
|
|
4405
|
+
} : undefined;
|
|
4406
|
+
var y = Math.abs(eulerHint.y) > 1e-6 ? {
|
|
4407
|
+
keyframed: false,
|
|
4408
|
+
value: eulerHint.y
|
|
4409
|
+
} : undefined;
|
|
4410
|
+
var z = Math.abs(eulerHint.z) > 1e-6 ? {
|
|
4411
|
+
keyframed: false,
|
|
4412
|
+
value: eulerHint.z
|
|
4413
|
+
} : undefined;
|
|
4414
|
+
if (x != null || y != null || z != null) {
|
|
4415
|
+
channels.rotation = _extends({}, x != null && {
|
|
4416
|
+
x: x
|
|
4417
|
+
}, y != null && {
|
|
4418
|
+
y: y
|
|
4419
|
+
}, z != null && {
|
|
4420
|
+
z: z
|
|
4421
|
+
});
|
|
3580
4422
|
}
|
|
3581
4423
|
}
|
|
3582
4424
|
return channels;
|
|
@@ -3625,7 +4467,7 @@ function parseBezierKeyframes(curves, startFrame, endFrame) {
|
|
|
3625
4467
|
};
|
|
3626
4468
|
if (i === 0) {
|
|
3627
4469
|
keyframes.push(_extends({
|
|
3628
|
-
|
|
4470
|
+
frame: frameTime,
|
|
3629
4471
|
value: v0
|
|
3630
4472
|
}, isHold ? {
|
|
3631
4473
|
hold: true
|
|
@@ -3645,7 +4487,7 @@ function parseBezierKeyframes(curves, startFrame, endFrame) {
|
|
|
3645
4487
|
y: inverseLerp(prevV0, prevV1, prevInCpY)
|
|
3646
4488
|
};
|
|
3647
4489
|
keyframes.push(_extends({
|
|
3648
|
-
|
|
4490
|
+
frame: frameTime,
|
|
3649
4491
|
value: v0,
|
|
3650
4492
|
inTangent: inTangent
|
|
3651
4493
|
}, isHold ? {
|
|
@@ -3664,7 +4506,7 @@ function parseBezierKeyframes(curves, startFrame, endFrame) {
|
|
|
3664
4506
|
y: inverseLerp(lastSeg[1], lastSeg[7], lastSeg[5])
|
|
3665
4507
|
};
|
|
3666
4508
|
keyframes.push({
|
|
3667
|
-
|
|
4509
|
+
frame: lastFrameTime,
|
|
3668
4510
|
value: lastV1,
|
|
3669
4511
|
inTangent: lastInTangent
|
|
3670
4512
|
});
|
|
@@ -3760,7 +4602,7 @@ function parsePositionTimingKeyframes(curves, startFrame, endFrame) {
|
|
|
3760
4602
|
};
|
|
3761
4603
|
if (i === 0) {
|
|
3762
4604
|
result.push({
|
|
3763
|
-
|
|
4605
|
+
frame: frameTime,
|
|
3764
4606
|
outTangent: outTangent
|
|
3765
4607
|
});
|
|
3766
4608
|
} else {
|
|
@@ -3770,7 +4612,7 @@ function parsePositionTimingKeyframes(curves, startFrame, endFrame) {
|
|
|
3770
4612
|
y: inverseLerp(prevSeg[0], prevSeg[6], prevSeg[5])
|
|
3771
4613
|
};
|
|
3772
4614
|
result.push({
|
|
3773
|
-
|
|
4615
|
+
frame: frameTime,
|
|
3774
4616
|
outTangent: outTangent,
|
|
3775
4617
|
inTangent: inTangent
|
|
3776
4618
|
});
|
|
@@ -3783,7 +4625,7 @@ function parsePositionTimingKeyframes(curves, startFrame, endFrame) {
|
|
|
3783
4625
|
y: inverseLerp(lastSeg[0], lastSeg[6], lastSeg[5])
|
|
3784
4626
|
};
|
|
3785
4627
|
result.push({
|
|
3786
|
-
|
|
4628
|
+
frame: lastFrameTime,
|
|
3787
4629
|
inTangent: lastInTangent
|
|
3788
4630
|
});
|
|
3789
4631
|
return result;
|
|
@@ -3800,12 +4642,9 @@ function parseTransformAnimation(asset, startFrame, endFrame, ctx) {
|
|
|
3800
4642
|
}
|
|
3801
4643
|
var rotOverLifetime = asset['rotationOverLifetime'];
|
|
3802
4644
|
if (rotOverLifetime != null) {
|
|
3803
|
-
var
|
|
3804
|
-
if (
|
|
3805
|
-
channels.rotation =
|
|
3806
|
-
}
|
|
3807
|
-
if (rotResult.separatedRotation != null) {
|
|
3808
|
-
channels.separatedRotation = rotResult.separatedRotation;
|
|
4645
|
+
var rotation = parseRotationAnimation(rotOverLifetime, startFrame, endFrame);
|
|
4646
|
+
if (rotation != null) {
|
|
4647
|
+
channels.rotation = rotation;
|
|
3809
4648
|
}
|
|
3810
4649
|
}
|
|
3811
4650
|
var sizeOverLifetime = asset['sizeOverLifetime'];
|
|
@@ -3885,7 +4724,7 @@ function parsePositionAnimation(posOverLifetime, startFrame, endFrame, ctx) {
|
|
|
3885
4724
|
var pp = pathPoints[Math.min(i, pathPoints.length - 1)];
|
|
3886
4725
|
var pos2d = convert3dTo2dPoint(pp[0], pp[1], (_pp_ = pp[2]) != null ? _pp_ : 0, ctx.width, ctx.height);
|
|
3887
4726
|
var kf = {
|
|
3888
|
-
|
|
4727
|
+
frame: timing.frame,
|
|
3889
4728
|
value: pos2d
|
|
3890
4729
|
};
|
|
3891
4730
|
if (i > startIdx && timing.inTangent != null) {
|
|
@@ -3934,83 +4773,26 @@ function parsePositionAnimation(posOverLifetime, startFrame, endFrame, ctx) {
|
|
|
3934
4773
|
};
|
|
3935
4774
|
}
|
|
3936
4775
|
function parseRotationAnimation(rotOverLifetime, startFrame, endFrame) {
|
|
3937
|
-
var separateAxes = rotOverLifetime['separateAxes'];
|
|
4776
|
+
var separateAxes = rotOverLifetime['separateAxes'] === true;
|
|
3938
4777
|
var xData = rotOverLifetime['x'];
|
|
3939
4778
|
var yData = rotOverLifetime['y'];
|
|
3940
4779
|
var zData = rotOverLifetime['z'];
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
var hasXOrY = x != null || y != null;
|
|
3947
|
-
if (hasMultiAxis || hasXOrY) {
|
|
3948
|
-
return {
|
|
3949
|
-
separatedRotation: _extends({}, x != null && {
|
|
3950
|
-
x: x
|
|
3951
|
-
}, y != null && {
|
|
3952
|
-
y: y
|
|
3953
|
-
}, z != null && {
|
|
3954
|
-
z: z
|
|
3955
|
-
})
|
|
3956
|
-
};
|
|
3957
|
-
}
|
|
3958
|
-
if (z != null) {
|
|
3959
|
-
return {
|
|
3960
|
-
separatedRotation: {
|
|
3961
|
-
z: z
|
|
3962
|
-
}
|
|
3963
|
-
};
|
|
3964
|
-
}
|
|
3965
|
-
}
|
|
3966
|
-
// Single-axis z rotation (non-separated)
|
|
3967
|
-
if (zData != null) {
|
|
3968
|
-
var z1 = parseScalarChannel(zData, startFrame, endFrame);
|
|
3969
|
-
if (z1 != null) {
|
|
3970
|
-
if (z1.keyframed) {
|
|
3971
|
-
var vecKeyframes = z1.keyframes.map(function(kf) {
|
|
3972
|
-
var result = {
|
|
3973
|
-
t: kf.t,
|
|
3974
|
-
value: [
|
|
3975
|
-
0,
|
|
3976
|
-
0,
|
|
3977
|
-
kf.value
|
|
3978
|
-
]
|
|
3979
|
-
};
|
|
3980
|
-
if (kf.hold != null) {
|
|
3981
|
-
result.hold = kf.hold;
|
|
3982
|
-
}
|
|
3983
|
-
if (kf.inTangent != null) {
|
|
3984
|
-
result.inTangent = kf.inTangent;
|
|
3985
|
-
}
|
|
3986
|
-
if (kf.outTangent != null) {
|
|
3987
|
-
result.outTangent = kf.outTangent;
|
|
3988
|
-
}
|
|
3989
|
-
return result;
|
|
3990
|
-
});
|
|
3991
|
-
return {
|
|
3992
|
-
rotation: {
|
|
3993
|
-
keyframed: true,
|
|
3994
|
-
keyframes: vecKeyframes
|
|
3995
|
-
}
|
|
3996
|
-
};
|
|
3997
|
-
}
|
|
3998
|
-
return {
|
|
3999
|
-
rotation: {
|
|
4000
|
-
keyframed: false,
|
|
4001
|
-
value: [
|
|
4002
|
-
0,
|
|
4003
|
-
0,
|
|
4004
|
-
z1.value
|
|
4005
|
-
]
|
|
4006
|
-
}
|
|
4007
|
-
};
|
|
4008
|
-
}
|
|
4780
|
+
var x = separateAxes ? parseScalarChannel(xData, startFrame, endFrame) : undefined;
|
|
4781
|
+
var y = separateAxes ? parseScalarChannel(yData, startFrame, endFrame) : undefined;
|
|
4782
|
+
var z = parseScalarChannel(zData, startFrame, endFrame);
|
|
4783
|
+
if (x == null && y == null && z == null) {
|
|
4784
|
+
return undefined;
|
|
4009
4785
|
}
|
|
4010
|
-
return {}
|
|
4786
|
+
return _extends({}, x != null && {
|
|
4787
|
+
x: x
|
|
4788
|
+
}, y != null && {
|
|
4789
|
+
y: y
|
|
4790
|
+
}, z != null && {
|
|
4791
|
+
z: z
|
|
4792
|
+
});
|
|
4011
4793
|
}
|
|
4012
4794
|
function parseScaleAnimation(sizeOverLifetime, startFrame, endFrame) {
|
|
4013
|
-
var _ref, _ref1, _ref2
|
|
4795
|
+
var _ref, _ref1, _ref2;
|
|
4014
4796
|
var xData = sizeOverLifetime['x'];
|
|
4015
4797
|
var yData = sizeOverLifetime['y'];
|
|
4016
4798
|
var zData = sizeOverLifetime['z'];
|
|
@@ -4023,70 +4805,72 @@ function parseScaleAnimation(sizeOverLifetime, startFrame, endFrame) {
|
|
|
4023
4805
|
var xKeyframed = (x == null ? void 0 : x.keyframed) === true;
|
|
4024
4806
|
var yKeyframed = (y == null ? void 0 : y.keyframed) === true;
|
|
4025
4807
|
var zKeyframed = (z == null ? void 0 : z.keyframed) === true;
|
|
4808
|
+
var xStaticValue = (x == null ? void 0 : x.keyframed) === false ? x.value : 1;
|
|
4809
|
+
var yStaticValue = (y == null ? void 0 : y.keyframed) === false ? y.value : 1;
|
|
4810
|
+
var zStaticValue = (z == null ? void 0 : z.keyframed) === false ? z.value : 1;
|
|
4026
4811
|
if (!xKeyframed && !yKeyframed && !zKeyframed) {
|
|
4027
|
-
var _ref9, _ref10, _ref11;
|
|
4028
4812
|
return {
|
|
4029
4813
|
keyframed: false,
|
|
4030
4814
|
value: [
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4815
|
+
xStaticValue,
|
|
4816
|
+
yStaticValue,
|
|
4817
|
+
zStaticValue
|
|
4034
4818
|
]
|
|
4035
4819
|
};
|
|
4036
4820
|
}
|
|
4037
4821
|
var xKfs = (_ref = x == null ? void 0 : x.keyframes) != null ? _ref : [
|
|
4038
4822
|
{
|
|
4039
|
-
|
|
4040
|
-
value:
|
|
4823
|
+
frame: startFrame,
|
|
4824
|
+
value: xStaticValue
|
|
4041
4825
|
},
|
|
4042
4826
|
{
|
|
4043
|
-
|
|
4044
|
-
value:
|
|
4827
|
+
frame: endFrame,
|
|
4828
|
+
value: xStaticValue
|
|
4045
4829
|
}
|
|
4046
4830
|
];
|
|
4047
|
-
var yKfs = (
|
|
4831
|
+
var yKfs = (_ref1 = y == null ? void 0 : y.keyframes) != null ? _ref1 : [
|
|
4048
4832
|
{
|
|
4049
|
-
|
|
4050
|
-
value:
|
|
4833
|
+
frame: startFrame,
|
|
4834
|
+
value: yStaticValue
|
|
4051
4835
|
},
|
|
4052
4836
|
{
|
|
4053
|
-
|
|
4054
|
-
value:
|
|
4837
|
+
frame: endFrame,
|
|
4838
|
+
value: yStaticValue
|
|
4055
4839
|
}
|
|
4056
4840
|
];
|
|
4057
|
-
var zKfs = (
|
|
4841
|
+
var zKfs = (_ref2 = z == null ? void 0 : z.keyframes) != null ? _ref2 : [
|
|
4058
4842
|
{
|
|
4059
|
-
|
|
4060
|
-
value:
|
|
4843
|
+
frame: startFrame,
|
|
4844
|
+
value: zStaticValue
|
|
4061
4845
|
},
|
|
4062
4846
|
{
|
|
4063
|
-
|
|
4064
|
-
value:
|
|
4847
|
+
frame: endFrame,
|
|
4848
|
+
value: zStaticValue
|
|
4065
4849
|
}
|
|
4066
4850
|
];
|
|
4067
|
-
var
|
|
4851
|
+
var allFrames = new Set();
|
|
4068
4852
|
for(var _iterator = _create_for_of_iterator_helper_loose(xKfs), _step; !(_step = _iterator()).done;){
|
|
4069
4853
|
var kf = _step.value;
|
|
4070
|
-
|
|
4854
|
+
allFrames.add(kf.frame);
|
|
4071
4855
|
}
|
|
4072
4856
|
for(var _iterator1 = _create_for_of_iterator_helper_loose(yKfs), _step1; !(_step1 = _iterator1()).done;){
|
|
4073
4857
|
var kf1 = _step1.value;
|
|
4074
|
-
|
|
4858
|
+
allFrames.add(kf1.frame);
|
|
4075
4859
|
}
|
|
4076
4860
|
for(var _iterator2 = _create_for_of_iterator_helper_loose(zKfs), _step2; !(_step2 = _iterator2()).done;){
|
|
4077
4861
|
var kf2 = _step2.value;
|
|
4078
|
-
|
|
4862
|
+
allFrames.add(kf2.frame);
|
|
4079
4863
|
}
|
|
4080
|
-
|
|
4864
|
+
// Keep Array.from: loose SWC array-spread lowering does not expand Set in dist.
|
|
4865
|
+
var sortedFrames = Array.from(allFrames).sort(function(a, b) {
|
|
4081
4866
|
return a - b;
|
|
4082
4867
|
});
|
|
4083
|
-
var keyframes =
|
|
4084
|
-
var
|
|
4085
|
-
var
|
|
4086
|
-
var
|
|
4087
|
-
var zv = findValueAtTime(zKfs, t, (_ref2 = z == null ? void 0 : z.value) != null ? _ref2 : 1);
|
|
4868
|
+
var keyframes = sortedFrames.map(function(frame) {
|
|
4869
|
+
var xv = findValueAtFrame(xKfs, frame, xStaticValue);
|
|
4870
|
+
var yv = findValueAtFrame(yKfs, frame, yStaticValue);
|
|
4871
|
+
var zv = findValueAtFrame(zKfs, frame, zStaticValue);
|
|
4088
4872
|
var kf = {
|
|
4089
|
-
|
|
4873
|
+
frame: frame,
|
|
4090
4874
|
value: [
|
|
4091
4875
|
xv.value,
|
|
4092
4876
|
yv.value,
|
|
@@ -4132,10 +4916,10 @@ function parseScalarChannel(data, startFrame, endFrame) {
|
|
|
4132
4916
|
}
|
|
4133
4917
|
return undefined;
|
|
4134
4918
|
}
|
|
4135
|
-
function
|
|
4919
|
+
function findValueAtFrame(keyframes, frame, defaultValue) {
|
|
4136
4920
|
for(var _iterator = _create_for_of_iterator_helper_loose(keyframes), _step; !(_step = _iterator()).done;){
|
|
4137
4921
|
var kf = _step.value;
|
|
4138
|
-
if (Math.abs(kf.
|
|
4922
|
+
if (Math.abs(kf.frame - frame) < 1e-6) {
|
|
4139
4923
|
return {
|
|
4140
4924
|
value: kf.value,
|
|
4141
4925
|
outTangent: kf.outTangent,
|
|
@@ -4167,11 +4951,11 @@ var IR_BLEND_MODE_BY_GE = {
|
|
|
4167
4951
|
15: animationIr.IRBlendMode.SoftLight,
|
|
4168
4952
|
16: animationIr.IRBlendMode.Luminosity
|
|
4169
4953
|
};
|
|
4170
|
-
function reverseBlendMode(
|
|
4171
|
-
if (
|
|
4954
|
+
function reverseBlendMode(GECode) {
|
|
4955
|
+
if (GECode == null) {
|
|
4172
4956
|
return undefined;
|
|
4173
4957
|
}
|
|
4174
|
-
return IR_BLEND_MODE_BY_GE[
|
|
4958
|
+
return IR_BLEND_MODE_BY_GE[GECode];
|
|
4175
4959
|
}
|
|
4176
4960
|
|
|
4177
4961
|
function parseComponent(item, ctx) {
|
|
@@ -4201,7 +4985,7 @@ function parseComponent(item, ctx) {
|
|
|
4201
4985
|
if (result == null) {
|
|
4202
4986
|
continue;
|
|
4203
4987
|
}
|
|
4204
|
-
result.
|
|
4988
|
+
result.GEComponentId = component['id'];
|
|
4205
4989
|
var mask = component['mask'];
|
|
4206
4990
|
if (mask != null) {
|
|
4207
4991
|
result.rawMask = mask;
|
|
@@ -4325,7 +5109,7 @@ function parseShapeComponent(component, ctx) {
|
|
|
4325
5109
|
if (renderer != null) {
|
|
4326
5110
|
blendMode = reverseBlendMode(renderer['blending']);
|
|
4327
5111
|
}
|
|
4328
|
-
var shapeData = parseShapeOptions(component, ctx
|
|
5112
|
+
var shapeData = parseShapeOptions(component, ctx);
|
|
4329
5113
|
return {
|
|
4330
5114
|
type: 'shape',
|
|
4331
5115
|
shapes: shapeData != null ? [
|
|
@@ -4334,85 +5118,100 @@ function parseShapeComponent(component, ctx) {
|
|
|
4334
5118
|
blendMode: blendMode
|
|
4335
5119
|
};
|
|
4336
5120
|
}
|
|
4337
|
-
function parseShapeOptions(component,
|
|
4338
|
-
var
|
|
4339
|
-
var primitiveType = reverseShapePrimitiveType(
|
|
4340
|
-
var
|
|
4341
|
-
var ySize = component['ySize'];
|
|
4342
|
-
var size = [
|
|
4343
|
-
xSize != null ? xSize / ratio : 0,
|
|
4344
|
-
ySize != null ? ySize / ratio : 0
|
|
4345
|
-
];
|
|
4346
|
-
var shape = {
|
|
4347
|
-
primitiveType: primitiveType,
|
|
5121
|
+
function parseShapeOptions(component, ctx) {
|
|
5122
|
+
var GEType = component['type'];
|
|
5123
|
+
var primitiveType = reverseShapePrimitiveType(GEType != null ? GEType : 0);
|
|
5124
|
+
var style = {
|
|
4348
5125
|
position: [
|
|
4349
5126
|
0,
|
|
4350
5127
|
0
|
|
4351
5128
|
],
|
|
4352
|
-
size: size,
|
|
4353
5129
|
fills: [],
|
|
4354
5130
|
strokes: []
|
|
4355
5131
|
};
|
|
4356
|
-
var
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
reverseScaledNumber(shapeRec, component, 'height', ratio);
|
|
4361
|
-
reverseScaledNumber(shapeRec, component, 'innerRadius', ratio);
|
|
4362
|
-
reverseScaledNumber(shapeRec, component, 'outerRadius', ratio);
|
|
4363
|
-
reverseScaledNumber(shapeRec, component, 'radius', ratio);
|
|
4364
|
-
reverseRawNumber(shapeRec, component, 'roundness');
|
|
4365
|
-
reverseRawNumber(shapeRec, component, 'pointCount');
|
|
4366
|
-
reverseRawNumber(shapeRec, component, 'innerRoundness');
|
|
4367
|
-
reverseRawNumber(shapeRec, component, 'outerRoundness');
|
|
4368
|
-
var geFills = component['fills'];
|
|
4369
|
-
if (geFills != null) {
|
|
4370
|
-
shape.fills = geFills.map(function(f) {
|
|
4371
|
-
return reverseShapePaint(f, ratio);
|
|
5132
|
+
var GEFills = component['fills'];
|
|
5133
|
+
if (GEFills != null) {
|
|
5134
|
+
style.fills = GEFills.map(function(f) {
|
|
5135
|
+
return reverseShapePaint(f, ctx);
|
|
4372
5136
|
}).filter(function(f) {
|
|
4373
5137
|
return f != null;
|
|
4374
5138
|
});
|
|
4375
5139
|
}
|
|
4376
|
-
var
|
|
4377
|
-
if (
|
|
4378
|
-
|
|
4379
|
-
return reverseShapePaint(s,
|
|
5140
|
+
var GEStrokes = component['strokes'];
|
|
5141
|
+
if (GEStrokes != null) {
|
|
5142
|
+
style.strokes = GEStrokes.map(function(s) {
|
|
5143
|
+
return reverseShapePaint(s, ctx);
|
|
4380
5144
|
}).filter(function(s) {
|
|
4381
5145
|
return s != null;
|
|
4382
5146
|
});
|
|
4383
5147
|
}
|
|
4384
|
-
var
|
|
4385
|
-
if (
|
|
4386
|
-
|
|
4387
|
-
}
|
|
4388
|
-
var geStrokeCap = component['strokeCap'];
|
|
4389
|
-
if (geStrokeCap != null) {
|
|
4390
|
-
shape.strokeCap = reverseLineCap(geStrokeCap);
|
|
4391
|
-
}
|
|
4392
|
-
var geStrokeJoin = component['strokeJoin'];
|
|
4393
|
-
if (geStrokeJoin != null) {
|
|
4394
|
-
shape.strokeJoin = reverseLineJoin(geStrokeJoin);
|
|
5148
|
+
var GEStrokeWidth = component['strokeWidth'];
|
|
5149
|
+
if (typeof GEStrokeWidth === 'number' && Number.isFinite(GEStrokeWidth) && GEStrokeWidth >= 0) {
|
|
5150
|
+
style.strokeWidth = GEStrokeWidth / ctx.ratio;
|
|
4395
5151
|
}
|
|
4396
|
-
var
|
|
4397
|
-
if (
|
|
4398
|
-
|
|
4399
|
-
}
|
|
4400
|
-
var geShapes = component['shapes'];
|
|
4401
|
-
if (geShapes != null) {
|
|
4402
|
-
var paths = reverseCustomPaths(component, ratio);
|
|
4403
|
-
if (paths.length > 0) {
|
|
4404
|
-
shape.customPaths = paths;
|
|
4405
|
-
}
|
|
5152
|
+
var GEStrokeCap = component['strokeCap'];
|
|
5153
|
+
if (GEStrokeCap != null) {
|
|
5154
|
+
style.strokeCap = reverseLineCap(GEStrokeCap);
|
|
4406
5155
|
}
|
|
4407
|
-
var
|
|
4408
|
-
if (
|
|
4409
|
-
|
|
5156
|
+
var GEStrokeJoin = component['strokeJoin'];
|
|
5157
|
+
if (GEStrokeJoin != null) {
|
|
5158
|
+
style.strokeJoin = reverseLineJoin(GEStrokeJoin);
|
|
4410
5159
|
}
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
5160
|
+
switch(primitiveType){
|
|
5161
|
+
case animationIr.IRShapePrimitiveType.Custom:
|
|
5162
|
+
{
|
|
5163
|
+
var customPaths = reverseCustomPaths(component, ctx.ratio);
|
|
5164
|
+
var firstPath = customPaths[0];
|
|
5165
|
+
return firstPath != null ? _extends({}, style, {
|
|
5166
|
+
primitiveType: primitiveType,
|
|
5167
|
+
customPaths: [].concat([
|
|
5168
|
+
firstPath
|
|
5169
|
+
], customPaths.slice(1))
|
|
5170
|
+
}) : undefined;
|
|
5171
|
+
}
|
|
5172
|
+
case animationIr.IRShapePrimitiveType.Rectangle:
|
|
5173
|
+
{
|
|
5174
|
+
var width = readScaledNumber(component, 'width', ctx.ratio);
|
|
5175
|
+
var height = readScaledNumber(component, 'height', ctx.ratio);
|
|
5176
|
+
return width != null && height != null ? _extends({}, style, {
|
|
5177
|
+
primitiveType: primitiveType,
|
|
5178
|
+
width: width,
|
|
5179
|
+
height: height
|
|
5180
|
+
}, readOptionalNumberField(component, 'roundness')) : undefined;
|
|
5181
|
+
}
|
|
5182
|
+
case animationIr.IRShapePrimitiveType.Ellipse:
|
|
5183
|
+
{
|
|
5184
|
+
var xRadius = readScaledNumber(component, 'xRadius', ctx.ratio);
|
|
5185
|
+
var yRadius = readScaledNumber(component, 'yRadius', ctx.ratio);
|
|
5186
|
+
return xRadius != null && yRadius != null ? _extends({}, style, {
|
|
5187
|
+
primitiveType: primitiveType,
|
|
5188
|
+
xRadius: xRadius,
|
|
5189
|
+
yRadius: yRadius
|
|
5190
|
+
}) : undefined;
|
|
5191
|
+
}
|
|
5192
|
+
case animationIr.IRShapePrimitiveType.Polygon:
|
|
5193
|
+
{
|
|
5194
|
+
var pointCount = readPointCount(component);
|
|
5195
|
+
var radius = readScaledNumber(component, 'radius', ctx.ratio);
|
|
5196
|
+
return pointCount != null && radius != null ? _extends({}, style, {
|
|
5197
|
+
primitiveType: primitiveType,
|
|
5198
|
+
pointCount: pointCount,
|
|
5199
|
+
radius: radius
|
|
5200
|
+
}, readOptionalNumberField(component, 'roundness')) : undefined;
|
|
5201
|
+
}
|
|
5202
|
+
case animationIr.IRShapePrimitiveType.Star:
|
|
5203
|
+
{
|
|
5204
|
+
var pointCount1 = readPointCount(component);
|
|
5205
|
+
var innerRadius = readScaledNumber(component, 'innerRadius', ctx.ratio);
|
|
5206
|
+
var outerRadius = readScaledNumber(component, 'outerRadius', ctx.ratio);
|
|
5207
|
+
return pointCount1 != null && innerRadius != null && outerRadius != null ? _extends({}, style, {
|
|
5208
|
+
primitiveType: primitiveType,
|
|
5209
|
+
pointCount: pointCount1,
|
|
5210
|
+
innerRadius: innerRadius,
|
|
5211
|
+
outerRadius: outerRadius
|
|
5212
|
+
}, readOptionalNumberField(component, 'innerRoundness'), readOptionalNumberField(component, 'outerRoundness')) : undefined;
|
|
5213
|
+
}
|
|
4414
5214
|
}
|
|
4415
|
-
return shape;
|
|
4416
5215
|
}
|
|
4417
5216
|
var GE_TO_SHAPE_PRIMITIVE_TYPE = {
|
|
4418
5217
|
0: animationIr.IRShapePrimitiveType.Custom,
|
|
@@ -4421,13 +5220,13 @@ var GE_TO_SHAPE_PRIMITIVE_TYPE = {
|
|
|
4421
5220
|
3: animationIr.IRShapePrimitiveType.Polygon,
|
|
4422
5221
|
4: animationIr.IRShapePrimitiveType.Star
|
|
4423
5222
|
};
|
|
4424
|
-
function reverseShapePrimitiveType(
|
|
4425
|
-
var
|
|
4426
|
-
return (
|
|
5223
|
+
function reverseShapePrimitiveType(GEType) {
|
|
5224
|
+
var _GE_TO_SHAPE_PRIMITIVE_TYPE_GEType;
|
|
5225
|
+
return (_GE_TO_SHAPE_PRIMITIVE_TYPE_GEType = GE_TO_SHAPE_PRIMITIVE_TYPE[GEType]) != null ? _GE_TO_SHAPE_PRIMITIVE_TYPE_GEType : animationIr.IRShapePrimitiveType.Custom;
|
|
4427
5226
|
}
|
|
4428
|
-
function reverseShapePaint(paint,
|
|
4429
|
-
var
|
|
4430
|
-
if (
|
|
5227
|
+
function reverseShapePaint(paint, ctx) {
|
|
5228
|
+
var GEType = paint['type'];
|
|
5229
|
+
if (GEType === 0) {
|
|
4431
5230
|
var color = paint['color'];
|
|
4432
5231
|
if (color == null) {
|
|
4433
5232
|
return undefined;
|
|
@@ -4442,7 +5241,7 @@ function reverseShapePaint(paint, ratio) {
|
|
|
4442
5241
|
]
|
|
4443
5242
|
};
|
|
4444
5243
|
}
|
|
4445
|
-
if (
|
|
5244
|
+
if (GEType === 1 || GEType === 2 || GEType === 3) {
|
|
4446
5245
|
var typeMap = {
|
|
4447
5246
|
1: animationIr.IRFillType.LinearGradient,
|
|
4448
5247
|
2: animationIr.IRFillType.RadialGradient,
|
|
@@ -4453,45 +5252,50 @@ function reverseShapePaint(paint, ratio) {
|
|
|
4453
5252
|
var startPoint = paint['startPoint'];
|
|
4454
5253
|
var endPoint = paint['endPoint'];
|
|
4455
5254
|
return {
|
|
4456
|
-
type: typeMap[
|
|
5255
|
+
type: typeMap[GEType],
|
|
4457
5256
|
gradientStops: stops,
|
|
4458
5257
|
gradientStart: startPoint != null ? [
|
|
4459
|
-
startPoint.x / ratio,
|
|
4460
|
-
-startPoint.y / ratio
|
|
5258
|
+
startPoint.x / ctx.ratio,
|
|
5259
|
+
-startPoint.y / ctx.ratio
|
|
4461
5260
|
] : undefined,
|
|
4462
5261
|
gradientEnd: endPoint != null ? [
|
|
4463
|
-
endPoint.x / ratio,
|
|
4464
|
-
-endPoint.y / ratio
|
|
5262
|
+
endPoint.x / ctx.ratio,
|
|
5263
|
+
-endPoint.y / ctx.ratio
|
|
4465
5264
|
] : undefined
|
|
4466
5265
|
};
|
|
4467
5266
|
}
|
|
5267
|
+
if (GEType === 4) {
|
|
5268
|
+
var texture = resolveTextureAsset(paint['texture'], ctx);
|
|
5269
|
+
if (texture == null) {
|
|
5270
|
+
return undefined;
|
|
5271
|
+
}
|
|
5272
|
+
var scaleMode = paint['scaleMode'];
|
|
5273
|
+
return _extends({
|
|
5274
|
+
type: animationIr.IRFillType.Texture,
|
|
5275
|
+
texture: texture
|
|
5276
|
+
}, isTextureScaleMode(scaleMode) && {
|
|
5277
|
+
scaleMode: scaleMode
|
|
5278
|
+
});
|
|
5279
|
+
}
|
|
4468
5280
|
return undefined;
|
|
4469
5281
|
}
|
|
4470
|
-
function reverseLineCap(
|
|
4471
|
-
var
|
|
5282
|
+
function reverseLineCap(GECode) {
|
|
5283
|
+
var _map_GECode;
|
|
4472
5284
|
var map = {
|
|
4473
5285
|
0: animationIr.IRLineCap.Butt,
|
|
4474
5286
|
1: animationIr.IRLineCap.Round,
|
|
4475
5287
|
2: animationIr.IRLineCap.Square
|
|
4476
5288
|
};
|
|
4477
|
-
return (
|
|
5289
|
+
return (_map_GECode = map[GECode]) != null ? _map_GECode : animationIr.IRLineCap.Butt;
|
|
4478
5290
|
}
|
|
4479
|
-
function reverseLineJoin(
|
|
4480
|
-
var
|
|
5291
|
+
function reverseLineJoin(GECode) {
|
|
5292
|
+
var _map_GECode;
|
|
4481
5293
|
var map = {
|
|
4482
5294
|
0: animationIr.IRLineJoin.Round,
|
|
4483
5295
|
1: animationIr.IRLineJoin.Bevel,
|
|
4484
5296
|
2: animationIr.IRLineJoin.Miter
|
|
4485
5297
|
};
|
|
4486
|
-
return (
|
|
4487
|
-
}
|
|
4488
|
-
function reverseShapeFillRule(geCode) {
|
|
4489
|
-
var _map_geCode;
|
|
4490
|
-
var map = {
|
|
4491
|
-
0: animationIr.IRShapeFillRule.NonZero,
|
|
4492
|
-
1: animationIr.IRShapeFillRule.EvenOdd
|
|
4493
|
-
};
|
|
4494
|
-
return (_map_geCode = map[geCode]) != null ? _map_geCode : animationIr.IRShapeFillRule.NonZero;
|
|
5298
|
+
return (_map_GECode = map[GECode]) != null ? _map_GECode : animationIr.IRLineJoin.Miter;
|
|
4495
5299
|
}
|
|
4496
5300
|
function reverseCustomPaths(component, ratio) {
|
|
4497
5301
|
var points = component['points'];
|
|
@@ -4503,8 +5307,8 @@ function reverseCustomPaths(component, ratio) {
|
|
|
4503
5307
|
}
|
|
4504
5308
|
return shapes.map(function(shape) {
|
|
4505
5309
|
var pathPoints = [];
|
|
4506
|
-
var
|
|
4507
|
-
var
|
|
5310
|
+
var pathInTangents = [];
|
|
5311
|
+
var pathOutTangents = [];
|
|
4508
5312
|
for(var _iterator = _create_for_of_iterator_helper_loose(shape.indexes), _step; !(_step = _iterator()).done;){
|
|
4509
5313
|
var idx = _step.value;
|
|
4510
5314
|
var _ref, _ref1, _ref2, _ref3;
|
|
@@ -4515,34 +5319,50 @@ function reverseCustomPaths(component, ratio) {
|
|
|
4515
5319
|
x: pt.x / ratio,
|
|
4516
5320
|
y: -pt.y / ratio
|
|
4517
5321
|
});
|
|
4518
|
-
|
|
5322
|
+
pathInTangents.push({
|
|
4519
5323
|
x: ((_ref = ei == null ? void 0 : ei.x) != null ? _ref : 0) / ratio,
|
|
4520
5324
|
y: -((_ref1 = ei == null ? void 0 : ei.y) != null ? _ref1 : 0) / ratio
|
|
4521
5325
|
});
|
|
4522
|
-
|
|
5326
|
+
pathOutTangents.push({
|
|
4523
5327
|
x: ((_ref2 = eo == null ? void 0 : eo.x) != null ? _ref2 : 0) / ratio,
|
|
4524
5328
|
y: -((_ref3 = eo == null ? void 0 : eo.y) != null ? _ref3 : 0) / ratio
|
|
4525
5329
|
});
|
|
4526
5330
|
}
|
|
4527
5331
|
return {
|
|
4528
5332
|
points: pathPoints,
|
|
4529
|
-
|
|
4530
|
-
|
|
4531
|
-
|
|
5333
|
+
inTangents: pathInTangents,
|
|
5334
|
+
outTangents: pathOutTangents,
|
|
5335
|
+
closed: shape.close
|
|
4532
5336
|
};
|
|
4533
5337
|
});
|
|
4534
5338
|
}
|
|
4535
|
-
function
|
|
5339
|
+
function readScaledNumber(component, key, ratio) {
|
|
4536
5340
|
var value = component[key];
|
|
4537
|
-
if (typeof value
|
|
4538
|
-
|
|
5341
|
+
if (typeof value !== 'number' || !Number.isFinite(value) || value < 0) {
|
|
5342
|
+
return undefined;
|
|
4539
5343
|
}
|
|
5344
|
+
return value / ratio;
|
|
4540
5345
|
}
|
|
4541
|
-
function
|
|
5346
|
+
function readOptionalNumberField(component, key) {
|
|
4542
5347
|
var value = component[key];
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
5348
|
+
var _obj;
|
|
5349
|
+
return typeof value === 'number' && Number.isFinite(value) ? (_obj = {}, _obj[key] = value, _obj) : {};
|
|
5350
|
+
}
|
|
5351
|
+
function readPointCount(component) {
|
|
5352
|
+
var value = component['pointCount'];
|
|
5353
|
+
return typeof value === 'number' && Number.isInteger(value) && value >= 2 ? value : undefined;
|
|
5354
|
+
}
|
|
5355
|
+
function resolveTextureAsset(textureRef, ctx) {
|
|
5356
|
+
var texture = resolveDataPath(ctx.textureById, textureRef);
|
|
5357
|
+
var sourceRef = texture == null ? void 0 : texture['source'];
|
|
5358
|
+
var image = sourceRef != null ? resolveDataPath(ctx.imageById, sourceRef) : undefined;
|
|
5359
|
+
var url = image == null ? void 0 : image['url'];
|
|
5360
|
+
return typeof url === 'string' && url.trim() !== '' ? {
|
|
5361
|
+
url: url
|
|
5362
|
+
} : undefined;
|
|
5363
|
+
}
|
|
5364
|
+
function isTextureScaleMode(value) {
|
|
5365
|
+
return typeof value === 'number' && Number.isInteger(value) && value >= 0 && value <= 3;
|
|
4546
5366
|
}
|
|
4547
5367
|
|
|
4548
5368
|
function reverseLayerTiming(delay, duration, frameRate) {
|
|
@@ -4583,7 +5403,7 @@ function mergeNullSpritePairs(descriptors, ctx) {
|
|
|
4583
5403
|
// child is exactly one same-name visual sprite. ir2ge's emitNullSpritePair
|
|
4584
5404
|
// produces precisely this shape (null + one same-name child). If the null
|
|
4585
5405
|
// has any OTHER children, it is a genuine Lottie parent null — merging it
|
|
4586
|
-
// into a
|
|
5406
|
+
// into a single semantic layer would change the anchor those other children are
|
|
4587
5407
|
// parented against, shifting them. Leave such nulls intact.
|
|
4588
5408
|
if (children.length !== 1) {
|
|
4589
5409
|
continue;
|
|
@@ -4697,19 +5517,17 @@ function isRecord$1(value) {
|
|
|
4697
5517
|
return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && !Array.isArray(value);
|
|
4698
5518
|
}
|
|
4699
5519
|
function mergeNullAndSprite(nullDesc, childDesc, ctx) {
|
|
4700
|
-
var _childDesc_layer_transform;
|
|
5520
|
+
var _childDesc_layer_transform, _merged_specific;
|
|
4701
5521
|
var merged = _extends({}, nullDesc.layer);
|
|
4702
5522
|
// Take type from child
|
|
4703
5523
|
merged.type = childDesc.layer.type;
|
|
4704
5524
|
merged.asset = childDesc.layer.asset;
|
|
4705
5525
|
merged.text = childDesc.layer.text;
|
|
4706
5526
|
merged.shapes = childDesc.layer.shapes;
|
|
4707
|
-
merged.shapeLayer = childDesc.layer.shapeLayer;
|
|
4708
5527
|
merged.solidColor = childDesc.layer.solidColor;
|
|
4709
5528
|
merged.blendMode = childDesc.layer.blendMode;
|
|
4710
|
-
merged.transformSplit = true;
|
|
4711
5529
|
// Visibility from child
|
|
4712
|
-
merged.
|
|
5530
|
+
merged.visible = childDesc.layer.visible;
|
|
4713
5531
|
// Compute anchor from child position offset
|
|
4714
5532
|
var childTransform = childDesc.item['transform'];
|
|
4715
5533
|
var childPosition = childTransform == null ? void 0 : childTransform['position'];
|
|
@@ -4730,7 +5548,9 @@ function mergeNullAndSprite(nullDesc, childDesc, ctx) {
|
|
|
4730
5548
|
0
|
|
4731
5549
|
]
|
|
4732
5550
|
};
|
|
4733
|
-
merged.
|
|
5551
|
+
merged.localBounds = {
|
|
5552
|
+
x: 0,
|
|
5553
|
+
y: 0,
|
|
4734
5554
|
width: layerWidth,
|
|
4735
5555
|
height: layerHeight
|
|
4736
5556
|
};
|
|
@@ -4743,17 +5563,21 @@ function mergeNullAndSprite(nullDesc, childDesc, ctx) {
|
|
|
4743
5563
|
merged.transform.opacity = childDesc.layer.transform.opacity;
|
|
4744
5564
|
}
|
|
4745
5565
|
// The merged layer renders the child's visual component, but the parent owns
|
|
4746
|
-
// transform animation passthrough. Deep-merge
|
|
4747
|
-
//
|
|
4748
|
-
if (childDesc.layer.
|
|
4749
|
-
var
|
|
4750
|
-
var
|
|
4751
|
-
var
|
|
4752
|
-
merged.
|
|
4753
|
-
|
|
4754
|
-
|
|
4755
|
-
}
|
|
5566
|
+
// transform animation passthrough. Deep-merge specific.effects so neither side
|
|
5567
|
+
// loses GE reconstruction data.
|
|
5568
|
+
if (childDesc.layer.specific != null) {
|
|
5569
|
+
var _merged_specific1;
|
|
5570
|
+
var parentEffects = (_merged_specific1 = merged.specific) == null ? void 0 : _merged_specific1.effects;
|
|
5571
|
+
var childEffects = childDesc.layer.specific.effects;
|
|
5572
|
+
merged.specific = _extends({}, merged.specific, childDesc.layer.specific, (parentEffects != null || childEffects != null) && {
|
|
5573
|
+
effects: _extends({}, parentEffects != null ? parentEffects : {}, childEffects != null ? childEffects : {})
|
|
5574
|
+
});
|
|
4756
5575
|
}
|
|
5576
|
+
merged.specific = _extends({}, merged.specific, {
|
|
5577
|
+
effects: _extends({}, (_merged_specific = merged.specific) == null ? void 0 : _merged_specific.effects, {
|
|
5578
|
+
sourceHierarchy: 'null-sprite-pair'
|
|
5579
|
+
})
|
|
5580
|
+
});
|
|
4757
5581
|
return {
|
|
4758
5582
|
itemId: nullDesc.itemId,
|
|
4759
5583
|
item: nullDesc.item,
|
|
@@ -4782,7 +5606,7 @@ function resolveHierarchy(descriptors, ctx) {
|
|
|
4782
5606
|
}
|
|
4783
5607
|
desc1.layer.parent = {
|
|
4784
5608
|
index: parentIndex,
|
|
4785
|
-
|
|
5609
|
+
lifetimeMode: 'clipped'
|
|
4786
5610
|
};
|
|
4787
5611
|
var parentAnchor = getAnchorFromDesc(parentDesc);
|
|
4788
5612
|
var pos = (_desc_layer_transform = desc1.layer.transform) == null ? void 0 : _desc_layer_transform.position;
|
|
@@ -4846,8 +5670,8 @@ function convertGEToIR(scene, options) {
|
|
|
4846
5670
|
var layers = merged.map(function(d) {
|
|
4847
5671
|
return d.layer;
|
|
4848
5672
|
});
|
|
4849
|
-
return {
|
|
4850
|
-
source: '
|
|
5673
|
+
return normalizeJsonValue({
|
|
5674
|
+
source: 'effects',
|
|
4851
5675
|
name: ctx.compositionName,
|
|
4852
5676
|
width: ctx.width,
|
|
4853
5677
|
height: ctx.height,
|
|
@@ -4857,14 +5681,14 @@ function convertGEToIR(scene, options) {
|
|
|
4857
5681
|
backgroundColor: ctx.backgroundColor,
|
|
4858
5682
|
endBehavior: ctx.endBehavior,
|
|
4859
5683
|
layers: layers,
|
|
4860
|
-
|
|
4861
|
-
};
|
|
5684
|
+
specific: buildCompositionSpecific(scene, ctx.compositionId, itemIds, ctx)
|
|
5685
|
+
});
|
|
4862
5686
|
}
|
|
4863
5687
|
function parseItemToLayer(item, itemId, index, ctx) {
|
|
4864
|
-
var _item_name, _item_visible, _ref, _item_delay, _ref1, _item_duration;
|
|
5688
|
+
var _item_name, _item_visible, _ref, _item_delay, _ref1, _item_duration, _ref2;
|
|
4865
5689
|
var _item_transform;
|
|
4866
5690
|
var name = (_item_name = item['name']) != null ? _item_name : "layer_" + index;
|
|
4867
|
-
var
|
|
5691
|
+
var GEType = item['type'];
|
|
4868
5692
|
var visible = (_item_visible = item['visible']) != null ? _item_visible : true;
|
|
4869
5693
|
var rawTransformPassthrough;
|
|
4870
5694
|
var timeline = parseTimeline(itemId, ctx);
|
|
@@ -4873,19 +5697,19 @@ function parseItemToLayer(item, itemId, index, ctx) {
|
|
|
4873
5697
|
var time = reverseLayerTiming(delay, duration, ctx.frameRate);
|
|
4874
5698
|
var componentData = parseComponent(item, ctx);
|
|
4875
5699
|
var type;
|
|
4876
|
-
if (
|
|
5700
|
+
if (GEType === '3') {
|
|
4877
5701
|
type = 'null';
|
|
4878
|
-
} else if ((componentData == null ? void 0 : componentData.type) === 'text' ||
|
|
5702
|
+
} else if ((componentData == null ? void 0 : componentData.type) === 'text' || GEType === 'text') {
|
|
4879
5703
|
type = 'text';
|
|
4880
|
-
} else if ((componentData == null ? void 0 : componentData.type) === 'shape' ||
|
|
5704
|
+
} else if ((componentData == null ? void 0 : componentData.type) === 'shape' || GEType === 'shape') {
|
|
4881
5705
|
type = 'shape';
|
|
4882
5706
|
} else if ((componentData == null ? void 0 : componentData.type) === 'image') {
|
|
4883
5707
|
type = 'image';
|
|
4884
|
-
} else if (
|
|
5708
|
+
} else if (GEType === '7') {
|
|
4885
5709
|
type = 'precomp';
|
|
4886
5710
|
} else if ((componentData == null ? void 0 : componentData.solidColor) != null) {
|
|
4887
5711
|
type = 'solid';
|
|
4888
|
-
} else if (
|
|
5712
|
+
} else if (GEType === '1') {
|
|
4889
5713
|
type = 'solid';
|
|
4890
5714
|
} else {
|
|
4891
5715
|
type = 'null';
|
|
@@ -4897,18 +5721,18 @@ function parseItemToLayer(item, itemId, index, ctx) {
|
|
|
4897
5721
|
var staticChannels = parseStaticTransform(itemTransform, ctx);
|
|
4898
5722
|
transform = _extends({}, staticChannels);
|
|
4899
5723
|
// Text layers carry their pixel-sizing scale on transform.scale
|
|
4900
|
-
// (scale = ratio ×
|
|
4901
|
-
//
|
|
5724
|
+
// (scale = ratio × local bounds). ir2ge RECOMPUTES this item scale from
|
|
5725
|
+
// localBounds in processVisualLayer, so keeping it in the IR scale channel
|
|
4902
5726
|
// would make buildSizeAnim emit a duplicate sizeOverLifetime constant that
|
|
4903
5727
|
// double-scales the glyphs (garbled/stretched text). Drop the static scale
|
|
4904
5728
|
// for text; genuine text scale animation still rides through
|
|
4905
|
-
//
|
|
5729
|
+
// specific.effects.sizeOverLifetime passthrough.
|
|
4906
5730
|
if (type === 'text') {
|
|
4907
5731
|
delete transform.scale;
|
|
4908
5732
|
}
|
|
4909
5733
|
}
|
|
4910
5734
|
// Parse animation from timeline tracks — passthrough raw GE animation data
|
|
4911
|
-
// via
|
|
5735
|
+
// via specific.effects. Converting to IR keyframes and back would lose data (ir2ge
|
|
4912
5736
|
// only handles specific ValueType variants and makes assumptions about
|
|
4913
5737
|
// static positions). The raw data is injected verbatim by ir2ge.
|
|
4914
5738
|
if ((timeline == null ? void 0 : timeline.transformAsset) != null) {
|
|
@@ -4922,10 +5746,6 @@ function parseItemToLayer(item, itemId, index, ctx) {
|
|
|
4922
5746
|
if (animChannels.rotation != null) {
|
|
4923
5747
|
transform.rotation = animChannels.rotation;
|
|
4924
5748
|
}
|
|
4925
|
-
if (animChannels.separatedRotation != null) {
|
|
4926
|
-
transform.separatedRotation = animChannels.separatedRotation;
|
|
4927
|
-
delete transform.rotation;
|
|
4928
|
-
}
|
|
4929
5749
|
if (animChannels.scale != null) {
|
|
4930
5750
|
transform.scale = animChannels.scale;
|
|
4931
5751
|
}
|
|
@@ -4967,10 +5787,10 @@ function parseItemToLayer(item, itemId, index, ctx) {
|
|
|
4967
5787
|
var _item_transform1;
|
|
4968
5788
|
var itemSize = (_item_transform1 = item['transform']) == null ? void 0 : _item_transform1['size'];
|
|
4969
5789
|
if (itemSize != null) {
|
|
4970
|
-
var
|
|
5790
|
+
var _ref3;
|
|
4971
5791
|
var layerWidth = itemSize.x / ctx.ratio;
|
|
4972
5792
|
var layerHeight = itemSize.y / ctx.ratio;
|
|
4973
|
-
var anchorScale = (
|
|
5793
|
+
var anchorScale = (_ref3 = componentData == null ? void 0 : componentData.anchorScale) != null ? _ref3 : [
|
|
4974
5794
|
0.5,
|
|
4975
5795
|
0.5
|
|
4976
5796
|
];
|
|
@@ -5035,35 +5855,46 @@ function parseItemToLayer(item, itemId, index, ctx) {
|
|
|
5035
5855
|
}
|
|
5036
5856
|
}
|
|
5037
5857
|
}
|
|
5038
|
-
//
|
|
5039
|
-
var
|
|
5858
|
+
// Layer-local bounds from item transform.size
|
|
5859
|
+
var localBounds;
|
|
5040
5860
|
var itemSize1 = (_item_transform = item['transform']) == null ? void 0 : _item_transform['size'];
|
|
5041
|
-
if (itemSize1 != null) {
|
|
5042
|
-
|
|
5861
|
+
if (itemSize1 != null && itemSize1.x > 0 && itemSize1.y > 0) {
|
|
5862
|
+
localBounds = {
|
|
5863
|
+
x: 0,
|
|
5864
|
+
y: 0,
|
|
5043
5865
|
width: itemSize1.x / ctx.ratio,
|
|
5044
5866
|
height: itemSize1.y / ctx.ratio
|
|
5045
5867
|
};
|
|
5046
5868
|
}
|
|
5869
|
+
var text = (componentData == null ? void 0 : componentData.text) == null ? undefined : _extends({}, componentData.text);
|
|
5870
|
+
var solidColor = type === 'solid' ? (_ref2 = componentData == null ? void 0 : componentData.solidColor) != null ? _ref2 : [
|
|
5871
|
+
1,
|
|
5872
|
+
1,
|
|
5873
|
+
1,
|
|
5874
|
+
1
|
|
5875
|
+
] : componentData == null ? void 0 : componentData.solidColor;
|
|
5876
|
+
if ((text == null ? void 0 : text.autoWidth) === false) {
|
|
5877
|
+
var _text, _width, _text1, _height;
|
|
5878
|
+
(_width = (_text = text).width) != null ? _width : _text.width = localBounds == null ? void 0 : localBounds.width;
|
|
5879
|
+
(_height = (_text1 = text).height) != null ? _height : _text1.height = localBounds == null ? void 0 : localBounds.height;
|
|
5880
|
+
}
|
|
5047
5881
|
var layer = {
|
|
5048
5882
|
index: index,
|
|
5049
5883
|
name: name,
|
|
5050
5884
|
type: type,
|
|
5051
5885
|
time: time,
|
|
5052
|
-
|
|
5053
|
-
hidden: !visible,
|
|
5054
|
-
enabled: visible
|
|
5055
|
-
},
|
|
5886
|
+
visible: visible,
|
|
5056
5887
|
transform: transform,
|
|
5057
|
-
|
|
5888
|
+
localBounds: localBounds
|
|
5058
5889
|
};
|
|
5059
5890
|
if ((componentData == null ? void 0 : componentData.asset) != null) {
|
|
5060
5891
|
layer.asset = componentData.asset;
|
|
5061
5892
|
}
|
|
5062
|
-
if (
|
|
5063
|
-
layer.solidColor =
|
|
5893
|
+
if (solidColor != null) {
|
|
5894
|
+
layer.solidColor = solidColor;
|
|
5064
5895
|
}
|
|
5065
|
-
if (
|
|
5066
|
-
layer.text =
|
|
5896
|
+
if (text != null) {
|
|
5897
|
+
layer.text = text;
|
|
5067
5898
|
}
|
|
5068
5899
|
if ((componentData == null ? void 0 : componentData.shapes) != null) {
|
|
5069
5900
|
layer.shapes = componentData.shapes;
|
|
@@ -5071,38 +5902,39 @@ function parseItemToLayer(item, itemId, index, ctx) {
|
|
|
5071
5902
|
if ((componentData == null ? void 0 : componentData.blendMode) != null) {
|
|
5072
5903
|
layer.blendMode = componentData.blendMode;
|
|
5073
5904
|
}
|
|
5074
|
-
var
|
|
5905
|
+
var GEComponentId = componentData == null ? void 0 : componentData.GEComponentId;
|
|
5075
5906
|
var rawMask = componentData == null ? void 0 : componentData.rawMask;
|
|
5076
|
-
var precompContent =
|
|
5907
|
+
var precompContent = GEType === '7' ? item['content'] : undefined;
|
|
5077
5908
|
var precompRefId = isRecord(precompContent == null ? void 0 : precompContent['options']) ? precompContent['options']['refId'] : undefined;
|
|
5078
|
-
|
|
5079
|
-
|
|
5080
|
-
|
|
5081
|
-
|
|
5082
|
-
|
|
5083
|
-
|
|
5084
|
-
|
|
5085
|
-
|
|
5086
|
-
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5909
|
+
// Mask round-trip: GEComponentId is the rendezvous key linking a target's
|
|
5910
|
+
// mask.reference.id (a GE1 component id) to the regenerated GE2 component id.
|
|
5911
|
+
// ir2ge copies specific.effects.mask onto the rebuilt component and a post-process pass
|
|
5912
|
+
// remaps the stale reference id. sourceHierarchy records the pre-merge shape;
|
|
5913
|
+
// mergeNullSpritePairs replaces it when a pair collapses into one semantic layer.
|
|
5914
|
+
var effectsSpecific = _extends({
|
|
5915
|
+
sourceHierarchy: 'single-item'
|
|
5916
|
+
}, rawTransformPassthrough != null ? rawTransformPassthrough : {}, rawColorOverLifetime != null && {
|
|
5917
|
+
colorOverLifetime: rawColorOverLifetime
|
|
5918
|
+
}, GEComponentId != null && {
|
|
5919
|
+
sourceComponentId: GEComponentId
|
|
5920
|
+
}, rawMask != null && {
|
|
5921
|
+
mask: rawMask
|
|
5922
|
+
}, typeof precompRefId === 'string' && {
|
|
5923
|
+
precompRefId: precompRefId
|
|
5924
|
+
}, precompContent != null && {
|
|
5925
|
+
precompContent: cloneJson(precompContent)
|
|
5926
|
+
});
|
|
5927
|
+
layer.specific = _extends({}, layer.specific, {
|
|
5928
|
+
effects: effectsSpecific
|
|
5929
|
+
});
|
|
5098
5930
|
return layer;
|
|
5099
5931
|
}
|
|
5100
|
-
function
|
|
5932
|
+
function buildCompositionSpecific(scene, compositionId, itemIds, ctx) {
|
|
5101
5933
|
if (!hasPrecompItem(itemIds, ctx)) {
|
|
5102
5934
|
return undefined;
|
|
5103
5935
|
}
|
|
5104
5936
|
return {
|
|
5105
|
-
|
|
5937
|
+
effects: {
|
|
5106
5938
|
sourceCompositionId: compositionId,
|
|
5107
5939
|
sourceScene: cloneJson(scene)
|
|
5108
5940
|
}
|
|
@@ -5115,7 +5947,7 @@ function hasPrecompItem(itemIds, ctx) {
|
|
|
5115
5947
|
});
|
|
5116
5948
|
}
|
|
5117
5949
|
function cloneJson(value) {
|
|
5118
|
-
return
|
|
5950
|
+
return normalizeJsonValue(value);
|
|
5119
5951
|
}
|
|
5120
5952
|
function isRecord(value) {
|
|
5121
5953
|
return value != null && (typeof value === "undefined" ? "undefined" : _type_of(value)) === 'object' && !Array.isArray(value);
|
|
@@ -5125,12 +5957,10 @@ function isRecord(value) {
|
|
|
5125
5957
|
* Read-side accessors for the `IRLayerNode.specific.lottie` slot.
|
|
5126
5958
|
*
|
|
5127
5959
|
* The shared generator must not branch on lottie semantics directly — every
|
|
5128
|
-
*
|
|
5960
|
+
* Lottie-specific reads go through these helpers so the rest of ir2ge stays
|
|
5129
5961
|
* agnostic to the producing tool.
|
|
5130
5962
|
*
|
|
5131
|
-
*
|
|
5132
|
-
* `specific.lottie.explicitParent`. It was promoted to a generic IR field
|
|
5133
|
-
* (`IRLayerReference.linkKind`); the accessor now lives at `./parent-link.ts`.
|
|
5963
|
+
* Parent lifetime semantics are represented directly by the generic IR relation.
|
|
5134
5964
|
*/ function readLottieSpecific(layer) {
|
|
5135
5965
|
var _layer_specific;
|
|
5136
5966
|
return (_layer_specific = layer.specific) == null ? void 0 : _layer_specific.lottie;
|
|
@@ -5147,10 +5977,15 @@ exports.convertIRToGE = convertIRToGE;
|
|
|
5147
5977
|
exports.createId = createId;
|
|
5148
5978
|
exports.estimateTextWidth = estimateTextWidth;
|
|
5149
5979
|
exports.get2dTo3dRatio = get2dTo3dRatio;
|
|
5980
|
+
exports.getEffectsCompositionSpecific = getEffectsCompositionSpecific;
|
|
5981
|
+
exports.getEffectsLayerSpecific = getEffectsLayerSpecific;
|
|
5982
|
+
exports.hasEffectsAnimationPassthrough = hasEffectsAnimationPassthrough;
|
|
5983
|
+
exports.hasEffectsColorAnimationPassthrough = hasEffectsColorAnimationPassthrough;
|
|
5984
|
+
exports.hasIndependentParentLifetime = hasIndependentParentLifetime;
|
|
5985
|
+
exports.invalidateEffectsLayerSpecific = invalidateEffectsLayerSpecific;
|
|
5150
5986
|
exports.irPositionKeyframesToGE = irPositionKeyframesToGE;
|
|
5151
5987
|
exports.irScalarKeyframesToGE = irScalarKeyframesToGE;
|
|
5152
5988
|
exports.irVectorKeyframesToGE = irVectorKeyframesToGE;
|
|
5153
|
-
exports.isTransformOnlyParentLink = isTransformOnlyParentLink;
|
|
5154
5989
|
exports.lerp = lerp;
|
|
5155
5990
|
exports.normalizeChildVisibilityByParentDelays = normalizeChildVisibilityByParentDelays;
|
|
5156
5991
|
exports.readLottieSpecific = readLottieSpecific;
|