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