File indexing completed on 2025-01-19 03:59:59
0001 import { value_to_lottie, value_from_lottie, LottieObject } from '../base.js'; 0002 import { Mask, Transform } from './helpers.js'; 0003 import { ShapeElement } from './shapes.js'; 0004 import { Value } from './properties.js'; 0005 import { Effect } from './effects.js'; 0006 import { TextAnimatorData } from './text.js'; 0007 0008 /*An enumeration. 0009 */ 0010 export const BlendMode = Object.freeze({ 0011 Normal: 0, 0012 Multiply: 1, 0013 Screen: 2, 0014 Overlay: 3, 0015 Darken: 4, 0016 Lighten: 5, 0017 ColorDodge: 6, 0018 ColorBurn: 7, 0019 HardLight: 8, 0020 SoftLight: 9, 0021 Difference: 10, 0022 Exclusion: 11, 0023 Hue: 12, 0024 Saturation: 13, 0025 Color: 14, 0026 Luminosity: 15, 0027 }); 0028 /*An enumeration. 0029 */ 0030 export const MatteMode = Object.freeze({ 0031 Normal: 0, 0032 Alpha: 1, 0033 InvertedAlpha: 2, 0034 Luma: 3, 0035 InvertedLuma: 4, 0036 }); 0037 /* 0038 */ 0039 export class Layer extends LottieObject 0040 { 0041 threedimensional; 0042 hidden; 0043 type; 0044 name; 0045 parent; 0046 stretch; 0047 transform; 0048 auto_orient; 0049 in_point; 0050 out_point; 0051 start_time; 0052 blend_mode; 0053 matte_mode; 0054 index; 0055 has_masks; 0056 masks; 0057 effects; 0058 0059 constructor() 0060 { 0061 super(); 0062 this.threedimensional = false; 0063 this.hidden = null; 0064 this.type = null; 0065 this.name = null; 0066 this.parent = null; 0067 this.stretch = 1; 0068 this.transform = new Transform(); 0069 this.auto_orient = false; 0070 this.in_point = null; 0071 this.out_point = null; 0072 this.start_time = 0; 0073 this.blend_mode = BlendMode.Normal; 0074 this.matte_mode = null; 0075 this.index = null; 0076 this.has_masks = null; 0077 this.masks = null; 0078 this.effects = null; 0079 } 0080 0081 to_lottie() 0082 { 0083 var arr = {}; 0084 if ( this.threedimensional !== null ) 0085 arr["ddd"] = value_to_lottie(Number(this.threedimensional)); 0086 if ( this.hidden !== null ) 0087 arr["hd"] = value_to_lottie(this.hidden); 0088 if ( this.type !== null ) 0089 arr["ty"] = value_to_lottie(this.type); 0090 if ( this.name !== null ) 0091 arr["nm"] = value_to_lottie(this.name); 0092 if ( this.parent !== null ) 0093 arr["parent"] = value_to_lottie(this.parent); 0094 if ( this.stretch !== null ) 0095 arr["sr"] = value_to_lottie(this.stretch); 0096 if ( this.transform !== null ) 0097 arr["ks"] = value_to_lottie(this.transform); 0098 if ( this.auto_orient !== null ) 0099 arr["ao"] = value_to_lottie(Number(this.auto_orient)); 0100 if ( this.in_point !== null ) 0101 arr["ip"] = value_to_lottie(this.in_point); 0102 if ( this.out_point !== null ) 0103 arr["op"] = value_to_lottie(this.out_point); 0104 if ( this.start_time !== null ) 0105 arr["st"] = value_to_lottie(this.start_time); 0106 if ( this.blend_mode !== null ) 0107 arr["bm"] = value_to_lottie(this.blend_mode); 0108 if ( this.matte_mode !== null ) 0109 arr["tt"] = value_to_lottie(this.matte_mode); 0110 if ( this.index !== null ) 0111 arr["ind"] = value_to_lottie(this.index); 0112 if ( this.has_masks !== null ) 0113 arr["hasMask"] = value_to_lottie(this.has_masks); 0114 if ( this.masks !== null ) 0115 arr["masksProperties"] = value_to_lottie(this.masks); 0116 if ( this.effects !== null ) 0117 arr["ef"] = value_to_lottie(this.effects); 0118 return arr; 0119 } 0120 0121 static from_lottie(arr) 0122 { 0123 var obj = new Layer(); 0124 if ( arr["ddd"] !== undefined ) 0125 obj.threedimensional = value_from_lottie(Boolean(arr["ddd"])); 0126 if ( arr["hd"] !== undefined ) 0127 obj.hidden = value_from_lottie(arr["hd"]); 0128 if ( arr["ty"] !== undefined ) 0129 obj.type = value_from_lottie(arr["ty"]); 0130 if ( arr["nm"] !== undefined ) 0131 obj.name = value_from_lottie(arr["nm"]); 0132 if ( arr["parent"] !== undefined ) 0133 obj.parent = value_from_lottie(arr["parent"]); 0134 if ( arr["sr"] !== undefined ) 0135 obj.stretch = value_from_lottie(arr["sr"]); 0136 if ( arr["ks"] !== undefined ) 0137 obj.transform = value_from_lottie(arr["ks"]); 0138 if ( arr["ao"] !== undefined ) 0139 obj.auto_orient = value_from_lottie(Boolean(arr["ao"])); 0140 if ( arr["ip"] !== undefined ) 0141 obj.in_point = value_from_lottie(arr["ip"]); 0142 if ( arr["op"] !== undefined ) 0143 obj.out_point = value_from_lottie(arr["op"]); 0144 if ( arr["st"] !== undefined ) 0145 obj.start_time = value_from_lottie(arr["st"]); 0146 if ( arr["bm"] !== undefined ) 0147 obj.blend_mode = value_from_lottie(arr["bm"]); 0148 if ( arr["tt"] !== undefined ) 0149 obj.matte_mode = value_from_lottie(arr["tt"]); 0150 if ( arr["ind"] !== undefined ) 0151 obj.index = value_from_lottie(arr["ind"]); 0152 if ( arr["hasMask"] !== undefined ) 0153 obj.has_masks = value_from_lottie(arr["hasMask"]); 0154 if ( arr["masksProperties"] !== undefined ) 0155 obj.masks = value_from_lottie(arr["masksProperties"]); 0156 if ( arr["ef"] !== undefined ) 0157 obj.effects = value_from_lottie(arr["ef"]); 0158 return obj; 0159 } 0160 } 0161 0162 /*! 0163 Layer with no data, useful to group layers together 0164 */ 0165 export class NullLayer extends Layer 0166 { 0167 threedimensional; 0168 hidden; 0169 type; 0170 name; 0171 parent; 0172 stretch; 0173 transform; 0174 auto_orient; 0175 in_point; 0176 out_point; 0177 start_time; 0178 blend_mode; 0179 matte_mode; 0180 index; 0181 has_masks; 0182 masks; 0183 effects; 0184 0185 constructor() 0186 { 0187 super(); 0188 this.type = 3; 0189 this.threedimensional = false; 0190 this.hidden = null; 0191 this.name = null; 0192 this.parent = null; 0193 this.stretch = 1; 0194 this.transform = new Transform(); 0195 this.auto_orient = false; 0196 this.in_point = null; 0197 this.out_point = null; 0198 this.start_time = 0; 0199 this.blend_mode = BlendMode.Normal; 0200 this.matte_mode = null; 0201 this.index = null; 0202 this.has_masks = null; 0203 this.masks = null; 0204 this.effects = null; 0205 } 0206 0207 to_lottie() 0208 { 0209 var arr = {}; 0210 if ( this.threedimensional !== null ) 0211 arr["ddd"] = value_to_lottie(Number(this.threedimensional)); 0212 if ( this.hidden !== null ) 0213 arr["hd"] = value_to_lottie(this.hidden); 0214 if ( this.type !== null ) 0215 arr["ty"] = value_to_lottie(this.type); 0216 if ( this.name !== null ) 0217 arr["nm"] = value_to_lottie(this.name); 0218 if ( this.parent !== null ) 0219 arr["parent"] = value_to_lottie(this.parent); 0220 if ( this.stretch !== null ) 0221 arr["sr"] = value_to_lottie(this.stretch); 0222 if ( this.transform !== null ) 0223 arr["ks"] = value_to_lottie(this.transform); 0224 if ( this.auto_orient !== null ) 0225 arr["ao"] = value_to_lottie(Number(this.auto_orient)); 0226 if ( this.in_point !== null ) 0227 arr["ip"] = value_to_lottie(this.in_point); 0228 if ( this.out_point !== null ) 0229 arr["op"] = value_to_lottie(this.out_point); 0230 if ( this.start_time !== null ) 0231 arr["st"] = value_to_lottie(this.start_time); 0232 if ( this.blend_mode !== null ) 0233 arr["bm"] = value_to_lottie(this.blend_mode); 0234 if ( this.matte_mode !== null ) 0235 arr["tt"] = value_to_lottie(this.matte_mode); 0236 if ( this.index !== null ) 0237 arr["ind"] = value_to_lottie(this.index); 0238 if ( this.has_masks !== null ) 0239 arr["hasMask"] = value_to_lottie(this.has_masks); 0240 if ( this.masks !== null ) 0241 arr["masksProperties"] = value_to_lottie(this.masks); 0242 if ( this.effects !== null ) 0243 arr["ef"] = value_to_lottie(this.effects); 0244 return arr; 0245 } 0246 0247 static from_lottie(arr) 0248 { 0249 var obj = new NullLayer(); 0250 if ( arr["ddd"] !== undefined ) 0251 obj.threedimensional = value_from_lottie(Boolean(arr["ddd"])); 0252 if ( arr["hd"] !== undefined ) 0253 obj.hidden = value_from_lottie(arr["hd"]); 0254 if ( arr["ty"] !== undefined ) 0255 obj.type = value_from_lottie(arr["ty"]); 0256 if ( arr["nm"] !== undefined ) 0257 obj.name = value_from_lottie(arr["nm"]); 0258 if ( arr["parent"] !== undefined ) 0259 obj.parent = value_from_lottie(arr["parent"]); 0260 if ( arr["sr"] !== undefined ) 0261 obj.stretch = value_from_lottie(arr["sr"]); 0262 if ( arr["ks"] !== undefined ) 0263 obj.transform = value_from_lottie(arr["ks"]); 0264 if ( arr["ao"] !== undefined ) 0265 obj.auto_orient = value_from_lottie(Boolean(arr["ao"])); 0266 if ( arr["ip"] !== undefined ) 0267 obj.in_point = value_from_lottie(arr["ip"]); 0268 if ( arr["op"] !== undefined ) 0269 obj.out_point = value_from_lottie(arr["op"]); 0270 if ( arr["st"] !== undefined ) 0271 obj.start_time = value_from_lottie(arr["st"]); 0272 if ( arr["bm"] !== undefined ) 0273 obj.blend_mode = value_from_lottie(arr["bm"]); 0274 if ( arr["tt"] !== undefined ) 0275 obj.matte_mode = value_from_lottie(arr["tt"]); 0276 if ( arr["ind"] !== undefined ) 0277 obj.index = value_from_lottie(arr["ind"]); 0278 if ( arr["hasMask"] !== undefined ) 0279 obj.has_masks = value_from_lottie(arr["hasMask"]); 0280 if ( arr["masksProperties"] !== undefined ) 0281 obj.masks = value_from_lottie(arr["masksProperties"]); 0282 if ( arr["ef"] !== undefined ) 0283 obj.effects = value_from_lottie(arr["ef"]); 0284 return obj; 0285 } 0286 } 0287 0288 /* 0289 */ 0290 export class PreCompLayer extends Layer 0291 { 0292 threedimensional; 0293 hidden; 0294 type; 0295 name; 0296 parent; 0297 stretch; 0298 transform; 0299 auto_orient; 0300 in_point; 0301 out_point; 0302 start_time; 0303 blend_mode; 0304 matte_mode; 0305 index; 0306 has_masks; 0307 masks; 0308 effects; 0309 reference_id; 0310 time_remapping; 0311 width; 0312 height; 0313 0314 constructor() 0315 { 0316 super(); 0317 this.threedimensional = false; 0318 this.hidden = null; 0319 this.type = null; 0320 this.name = null; 0321 this.parent = null; 0322 this.stretch = 1; 0323 this.transform = new Transform(); 0324 this.auto_orient = false; 0325 this.in_point = null; 0326 this.out_point = null; 0327 this.start_time = 0; 0328 this.blend_mode = BlendMode.Normal; 0329 this.matte_mode = null; 0330 this.index = null; 0331 this.has_masks = null; 0332 this.masks = null; 0333 this.effects = null; 0334 this.reference_id = ''; 0335 this.time_remapping = null; 0336 this.width = 512; 0337 this.height = 512; 0338 } 0339 0340 to_lottie() 0341 { 0342 var arr = {}; 0343 if ( this.threedimensional !== null ) 0344 arr["ddd"] = value_to_lottie(Number(this.threedimensional)); 0345 if ( this.hidden !== null ) 0346 arr["hd"] = value_to_lottie(this.hidden); 0347 if ( this.type !== null ) 0348 arr["ty"] = value_to_lottie(this.type); 0349 if ( this.name !== null ) 0350 arr["nm"] = value_to_lottie(this.name); 0351 if ( this.parent !== null ) 0352 arr["parent"] = value_to_lottie(this.parent); 0353 if ( this.stretch !== null ) 0354 arr["sr"] = value_to_lottie(this.stretch); 0355 if ( this.transform !== null ) 0356 arr["ks"] = value_to_lottie(this.transform); 0357 if ( this.auto_orient !== null ) 0358 arr["ao"] = value_to_lottie(Number(this.auto_orient)); 0359 if ( this.in_point !== null ) 0360 arr["ip"] = value_to_lottie(this.in_point); 0361 if ( this.out_point !== null ) 0362 arr["op"] = value_to_lottie(this.out_point); 0363 if ( this.start_time !== null ) 0364 arr["st"] = value_to_lottie(this.start_time); 0365 if ( this.blend_mode !== null ) 0366 arr["bm"] = value_to_lottie(this.blend_mode); 0367 if ( this.matte_mode !== null ) 0368 arr["tt"] = value_to_lottie(this.matte_mode); 0369 if ( this.index !== null ) 0370 arr["ind"] = value_to_lottie(this.index); 0371 if ( this.has_masks !== null ) 0372 arr["hasMask"] = value_to_lottie(this.has_masks); 0373 if ( this.masks !== null ) 0374 arr["masksProperties"] = value_to_lottie(this.masks); 0375 if ( this.effects !== null ) 0376 arr["ef"] = value_to_lottie(this.effects); 0377 if ( this.reference_id !== null ) 0378 arr["refId"] = value_to_lottie(this.reference_id); 0379 if ( this.time_remapping !== null ) 0380 arr["tm"] = value_to_lottie(this.time_remapping); 0381 if ( this.width !== null ) 0382 arr["w"] = value_to_lottie(this.width); 0383 if ( this.height !== null ) 0384 arr["h"] = value_to_lottie(this.height); 0385 return arr; 0386 } 0387 0388 static from_lottie(arr) 0389 { 0390 var obj = new PreCompLayer(); 0391 if ( arr["ddd"] !== undefined ) 0392 obj.threedimensional = value_from_lottie(Boolean(arr["ddd"])); 0393 if ( arr["hd"] !== undefined ) 0394 obj.hidden = value_from_lottie(arr["hd"]); 0395 if ( arr["ty"] !== undefined ) 0396 obj.type = value_from_lottie(arr["ty"]); 0397 if ( arr["nm"] !== undefined ) 0398 obj.name = value_from_lottie(arr["nm"]); 0399 if ( arr["parent"] !== undefined ) 0400 obj.parent = value_from_lottie(arr["parent"]); 0401 if ( arr["sr"] !== undefined ) 0402 obj.stretch = value_from_lottie(arr["sr"]); 0403 if ( arr["ks"] !== undefined ) 0404 obj.transform = value_from_lottie(arr["ks"]); 0405 if ( arr["ao"] !== undefined ) 0406 obj.auto_orient = value_from_lottie(Boolean(arr["ao"])); 0407 if ( arr["ip"] !== undefined ) 0408 obj.in_point = value_from_lottie(arr["ip"]); 0409 if ( arr["op"] !== undefined ) 0410 obj.out_point = value_from_lottie(arr["op"]); 0411 if ( arr["st"] !== undefined ) 0412 obj.start_time = value_from_lottie(arr["st"]); 0413 if ( arr["bm"] !== undefined ) 0414 obj.blend_mode = value_from_lottie(arr["bm"]); 0415 if ( arr["tt"] !== undefined ) 0416 obj.matte_mode = value_from_lottie(arr["tt"]); 0417 if ( arr["ind"] !== undefined ) 0418 obj.index = value_from_lottie(arr["ind"]); 0419 if ( arr["hasMask"] !== undefined ) 0420 obj.has_masks = value_from_lottie(arr["hasMask"]); 0421 if ( arr["masksProperties"] !== undefined ) 0422 obj.masks = value_from_lottie(arr["masksProperties"]); 0423 if ( arr["ef"] !== undefined ) 0424 obj.effects = value_from_lottie(arr["ef"]); 0425 if ( arr["refId"] !== undefined ) 0426 obj.reference_id = value_from_lottie(arr["refId"]); 0427 if ( arr["tm"] !== undefined ) 0428 obj.time_remapping = value_from_lottie(arr["tm"]); 0429 if ( arr["w"] !== undefined ) 0430 obj.width = value_from_lottie(arr["w"]); 0431 if ( arr["h"] !== undefined ) 0432 obj.height = value_from_lottie(arr["h"]); 0433 return obj; 0434 } 0435 } 0436 0437 /*! 0438 Layer containing ShapeElement objects 0439 */ 0440 export class ShapeLayer extends Layer 0441 { 0442 threedimensional; 0443 hidden; 0444 type; 0445 name; 0446 parent; 0447 stretch; 0448 transform; 0449 auto_orient; 0450 in_point; 0451 out_point; 0452 start_time; 0453 blend_mode; 0454 matte_mode; 0455 index; 0456 has_masks; 0457 masks; 0458 effects; 0459 shapes; 0460 0461 constructor() 0462 { 0463 super(); 0464 this.type = 4; 0465 this.threedimensional = false; 0466 this.hidden = null; 0467 this.name = null; 0468 this.parent = null; 0469 this.stretch = 1; 0470 this.transform = new Transform(); 0471 this.auto_orient = false; 0472 this.in_point = null; 0473 this.out_point = null; 0474 this.start_time = 0; 0475 this.blend_mode = BlendMode.Normal; 0476 this.matte_mode = null; 0477 this.index = null; 0478 this.has_masks = null; 0479 this.masks = null; 0480 this.effects = null; 0481 this.shapes = []; 0482 } 0483 0484 to_lottie() 0485 { 0486 var arr = {}; 0487 if ( this.threedimensional !== null ) 0488 arr["ddd"] = value_to_lottie(Number(this.threedimensional)); 0489 if ( this.hidden !== null ) 0490 arr["hd"] = value_to_lottie(this.hidden); 0491 if ( this.type !== null ) 0492 arr["ty"] = value_to_lottie(this.type); 0493 if ( this.name !== null ) 0494 arr["nm"] = value_to_lottie(this.name); 0495 if ( this.parent !== null ) 0496 arr["parent"] = value_to_lottie(this.parent); 0497 if ( this.stretch !== null ) 0498 arr["sr"] = value_to_lottie(this.stretch); 0499 if ( this.transform !== null ) 0500 arr["ks"] = value_to_lottie(this.transform); 0501 if ( this.auto_orient !== null ) 0502 arr["ao"] = value_to_lottie(Number(this.auto_orient)); 0503 if ( this.in_point !== null ) 0504 arr["ip"] = value_to_lottie(this.in_point); 0505 if ( this.out_point !== null ) 0506 arr["op"] = value_to_lottie(this.out_point); 0507 if ( this.start_time !== null ) 0508 arr["st"] = value_to_lottie(this.start_time); 0509 if ( this.blend_mode !== null ) 0510 arr["bm"] = value_to_lottie(this.blend_mode); 0511 if ( this.matte_mode !== null ) 0512 arr["tt"] = value_to_lottie(this.matte_mode); 0513 if ( this.index !== null ) 0514 arr["ind"] = value_to_lottie(this.index); 0515 if ( this.has_masks !== null ) 0516 arr["hasMask"] = value_to_lottie(this.has_masks); 0517 if ( this.masks !== null ) 0518 arr["masksProperties"] = value_to_lottie(this.masks); 0519 if ( this.effects !== null ) 0520 arr["ef"] = value_to_lottie(this.effects); 0521 if ( this.shapes !== null ) 0522 arr["shapes"] = value_to_lottie(this.shapes); 0523 return arr; 0524 } 0525 0526 static from_lottie(arr) 0527 { 0528 var obj = new ShapeLayer(); 0529 if ( arr["ddd"] !== undefined ) 0530 obj.threedimensional = value_from_lottie(Boolean(arr["ddd"])); 0531 if ( arr["hd"] !== undefined ) 0532 obj.hidden = value_from_lottie(arr["hd"]); 0533 if ( arr["ty"] !== undefined ) 0534 obj.type = value_from_lottie(arr["ty"]); 0535 if ( arr["nm"] !== undefined ) 0536 obj.name = value_from_lottie(arr["nm"]); 0537 if ( arr["parent"] !== undefined ) 0538 obj.parent = value_from_lottie(arr["parent"]); 0539 if ( arr["sr"] !== undefined ) 0540 obj.stretch = value_from_lottie(arr["sr"]); 0541 if ( arr["ks"] !== undefined ) 0542 obj.transform = value_from_lottie(arr["ks"]); 0543 if ( arr["ao"] !== undefined ) 0544 obj.auto_orient = value_from_lottie(Boolean(arr["ao"])); 0545 if ( arr["ip"] !== undefined ) 0546 obj.in_point = value_from_lottie(arr["ip"]); 0547 if ( arr["op"] !== undefined ) 0548 obj.out_point = value_from_lottie(arr["op"]); 0549 if ( arr["st"] !== undefined ) 0550 obj.start_time = value_from_lottie(arr["st"]); 0551 if ( arr["bm"] !== undefined ) 0552 obj.blend_mode = value_from_lottie(arr["bm"]); 0553 if ( arr["tt"] !== undefined ) 0554 obj.matte_mode = value_from_lottie(arr["tt"]); 0555 if ( arr["ind"] !== undefined ) 0556 obj.index = value_from_lottie(arr["ind"]); 0557 if ( arr["hasMask"] !== undefined ) 0558 obj.has_masks = value_from_lottie(arr["hasMask"]); 0559 if ( arr["masksProperties"] !== undefined ) 0560 obj.masks = value_from_lottie(arr["masksProperties"]); 0561 if ( arr["ef"] !== undefined ) 0562 obj.effects = value_from_lottie(arr["ef"]); 0563 if ( arr["shapes"] !== undefined ) 0564 obj.shapes = value_from_lottie(arr["shapes"]); 0565 return obj; 0566 } 0567 } 0568 0569 /*! 0570 Layer with a solid color rectangle 0571 */ 0572 export class SolidColorLayer extends Layer 0573 { 0574 threedimensional; 0575 hidden; 0576 type; 0577 name; 0578 parent; 0579 stretch; 0580 transform; 0581 auto_orient; 0582 in_point; 0583 out_point; 0584 start_time; 0585 blend_mode; 0586 matte_mode; 0587 index; 0588 has_masks; 0589 masks; 0590 effects; 0591 color; 0592 height; 0593 width; 0594 0595 constructor() 0596 { 0597 super(); 0598 this.type = 1; 0599 this.threedimensional = false; 0600 this.hidden = null; 0601 this.name = null; 0602 this.parent = null; 0603 this.stretch = 1; 0604 this.transform = new Transform(); 0605 this.auto_orient = false; 0606 this.in_point = null; 0607 this.out_point = null; 0608 this.start_time = 0; 0609 this.blend_mode = BlendMode.Normal; 0610 this.matte_mode = null; 0611 this.index = null; 0612 this.has_masks = null; 0613 this.masks = null; 0614 this.effects = null; 0615 this.color = ''; 0616 this.height = 0; 0617 this.width = 0; 0618 } 0619 0620 to_lottie() 0621 { 0622 var arr = {}; 0623 if ( this.threedimensional !== null ) 0624 arr["ddd"] = value_to_lottie(Number(this.threedimensional)); 0625 if ( this.hidden !== null ) 0626 arr["hd"] = value_to_lottie(this.hidden); 0627 if ( this.type !== null ) 0628 arr["ty"] = value_to_lottie(this.type); 0629 if ( this.name !== null ) 0630 arr["nm"] = value_to_lottie(this.name); 0631 if ( this.parent !== null ) 0632 arr["parent"] = value_to_lottie(this.parent); 0633 if ( this.stretch !== null ) 0634 arr["sr"] = value_to_lottie(this.stretch); 0635 if ( this.transform !== null ) 0636 arr["ks"] = value_to_lottie(this.transform); 0637 if ( this.auto_orient !== null ) 0638 arr["ao"] = value_to_lottie(Number(this.auto_orient)); 0639 if ( this.in_point !== null ) 0640 arr["ip"] = value_to_lottie(this.in_point); 0641 if ( this.out_point !== null ) 0642 arr["op"] = value_to_lottie(this.out_point); 0643 if ( this.start_time !== null ) 0644 arr["st"] = value_to_lottie(this.start_time); 0645 if ( this.blend_mode !== null ) 0646 arr["bm"] = value_to_lottie(this.blend_mode); 0647 if ( this.matte_mode !== null ) 0648 arr["tt"] = value_to_lottie(this.matte_mode); 0649 if ( this.index !== null ) 0650 arr["ind"] = value_to_lottie(this.index); 0651 if ( this.has_masks !== null ) 0652 arr["hasMask"] = value_to_lottie(this.has_masks); 0653 if ( this.masks !== null ) 0654 arr["masksProperties"] = value_to_lottie(this.masks); 0655 if ( this.effects !== null ) 0656 arr["ef"] = value_to_lottie(this.effects); 0657 if ( this.color !== null ) 0658 arr["sc"] = value_to_lottie(this.color); 0659 if ( this.height !== null ) 0660 arr["sh"] = value_to_lottie(this.height); 0661 if ( this.width !== null ) 0662 arr["sw"] = value_to_lottie(this.width); 0663 return arr; 0664 } 0665 0666 static from_lottie(arr) 0667 { 0668 var obj = new SolidColorLayer(); 0669 if ( arr["ddd"] !== undefined ) 0670 obj.threedimensional = value_from_lottie(Boolean(arr["ddd"])); 0671 if ( arr["hd"] !== undefined ) 0672 obj.hidden = value_from_lottie(arr["hd"]); 0673 if ( arr["ty"] !== undefined ) 0674 obj.type = value_from_lottie(arr["ty"]); 0675 if ( arr["nm"] !== undefined ) 0676 obj.name = value_from_lottie(arr["nm"]); 0677 if ( arr["parent"] !== undefined ) 0678 obj.parent = value_from_lottie(arr["parent"]); 0679 if ( arr["sr"] !== undefined ) 0680 obj.stretch = value_from_lottie(arr["sr"]); 0681 if ( arr["ks"] !== undefined ) 0682 obj.transform = value_from_lottie(arr["ks"]); 0683 if ( arr["ao"] !== undefined ) 0684 obj.auto_orient = value_from_lottie(Boolean(arr["ao"])); 0685 if ( arr["ip"] !== undefined ) 0686 obj.in_point = value_from_lottie(arr["ip"]); 0687 if ( arr["op"] !== undefined ) 0688 obj.out_point = value_from_lottie(arr["op"]); 0689 if ( arr["st"] !== undefined ) 0690 obj.start_time = value_from_lottie(arr["st"]); 0691 if ( arr["bm"] !== undefined ) 0692 obj.blend_mode = value_from_lottie(arr["bm"]); 0693 if ( arr["tt"] !== undefined ) 0694 obj.matte_mode = value_from_lottie(arr["tt"]); 0695 if ( arr["ind"] !== undefined ) 0696 obj.index = value_from_lottie(arr["ind"]); 0697 if ( arr["hasMask"] !== undefined ) 0698 obj.has_masks = value_from_lottie(arr["hasMask"]); 0699 if ( arr["masksProperties"] !== undefined ) 0700 obj.masks = value_from_lottie(arr["masksProperties"]); 0701 if ( arr["ef"] !== undefined ) 0702 obj.effects = value_from_lottie(arr["ef"]); 0703 if ( arr["sc"] !== undefined ) 0704 obj.color = value_from_lottie(arr["sc"]); 0705 if ( arr["sh"] !== undefined ) 0706 obj.height = value_from_lottie(arr["sh"]); 0707 if ( arr["sw"] !== undefined ) 0708 obj.width = value_from_lottie(arr["sw"]); 0709 return obj; 0710 } 0711 } 0712 0713 /* 0714 */ 0715 export class TextLayer extends Layer 0716 { 0717 threedimensional; 0718 hidden; 0719 type; 0720 name; 0721 parent; 0722 stretch; 0723 transform; 0724 auto_orient; 0725 in_point; 0726 out_point; 0727 start_time; 0728 blend_mode; 0729 matte_mode; 0730 index; 0731 has_masks; 0732 masks; 0733 effects; 0734 data; 0735 0736 constructor() 0737 { 0738 super(); 0739 this.type = 5; 0740 this.threedimensional = false; 0741 this.hidden = null; 0742 this.name = null; 0743 this.parent = null; 0744 this.stretch = 1; 0745 this.transform = new Transform(); 0746 this.auto_orient = false; 0747 this.in_point = null; 0748 this.out_point = null; 0749 this.start_time = 0; 0750 this.blend_mode = BlendMode.Normal; 0751 this.matte_mode = null; 0752 this.index = null; 0753 this.has_masks = null; 0754 this.masks = null; 0755 this.effects = null; 0756 this.data = new TextAnimatorData(); 0757 } 0758 0759 to_lottie() 0760 { 0761 var arr = {}; 0762 if ( this.threedimensional !== null ) 0763 arr["ddd"] = value_to_lottie(Number(this.threedimensional)); 0764 if ( this.hidden !== null ) 0765 arr["hd"] = value_to_lottie(this.hidden); 0766 if ( this.type !== null ) 0767 arr["ty"] = value_to_lottie(this.type); 0768 if ( this.name !== null ) 0769 arr["nm"] = value_to_lottie(this.name); 0770 if ( this.parent !== null ) 0771 arr["parent"] = value_to_lottie(this.parent); 0772 if ( this.stretch !== null ) 0773 arr["sr"] = value_to_lottie(this.stretch); 0774 if ( this.transform !== null ) 0775 arr["ks"] = value_to_lottie(this.transform); 0776 if ( this.auto_orient !== null ) 0777 arr["ao"] = value_to_lottie(Number(this.auto_orient)); 0778 if ( this.in_point !== null ) 0779 arr["ip"] = value_to_lottie(this.in_point); 0780 if ( this.out_point !== null ) 0781 arr["op"] = value_to_lottie(this.out_point); 0782 if ( this.start_time !== null ) 0783 arr["st"] = value_to_lottie(this.start_time); 0784 if ( this.blend_mode !== null ) 0785 arr["bm"] = value_to_lottie(this.blend_mode); 0786 if ( this.matte_mode !== null ) 0787 arr["tt"] = value_to_lottie(this.matte_mode); 0788 if ( this.index !== null ) 0789 arr["ind"] = value_to_lottie(this.index); 0790 if ( this.has_masks !== null ) 0791 arr["hasMask"] = value_to_lottie(this.has_masks); 0792 if ( this.masks !== null ) 0793 arr["masksProperties"] = value_to_lottie(this.masks); 0794 if ( this.effects !== null ) 0795 arr["ef"] = value_to_lottie(this.effects); 0796 if ( this.data !== null ) 0797 arr["t"] = value_to_lottie(this.data); 0798 return arr; 0799 } 0800 0801 static from_lottie(arr) 0802 { 0803 var obj = new TextLayer(); 0804 if ( arr["ddd"] !== undefined ) 0805 obj.threedimensional = value_from_lottie(Boolean(arr["ddd"])); 0806 if ( arr["hd"] !== undefined ) 0807 obj.hidden = value_from_lottie(arr["hd"]); 0808 if ( arr["ty"] !== undefined ) 0809 obj.type = value_from_lottie(arr["ty"]); 0810 if ( arr["nm"] !== undefined ) 0811 obj.name = value_from_lottie(arr["nm"]); 0812 if ( arr["parent"] !== undefined ) 0813 obj.parent = value_from_lottie(arr["parent"]); 0814 if ( arr["sr"] !== undefined ) 0815 obj.stretch = value_from_lottie(arr["sr"]); 0816 if ( arr["ks"] !== undefined ) 0817 obj.transform = value_from_lottie(arr["ks"]); 0818 if ( arr["ao"] !== undefined ) 0819 obj.auto_orient = value_from_lottie(Boolean(arr["ao"])); 0820 if ( arr["ip"] !== undefined ) 0821 obj.in_point = value_from_lottie(arr["ip"]); 0822 if ( arr["op"] !== undefined ) 0823 obj.out_point = value_from_lottie(arr["op"]); 0824 if ( arr["st"] !== undefined ) 0825 obj.start_time = value_from_lottie(arr["st"]); 0826 if ( arr["bm"] !== undefined ) 0827 obj.blend_mode = value_from_lottie(arr["bm"]); 0828 if ( arr["tt"] !== undefined ) 0829 obj.matte_mode = value_from_lottie(arr["tt"]); 0830 if ( arr["ind"] !== undefined ) 0831 obj.index = value_from_lottie(arr["ind"]); 0832 if ( arr["hasMask"] !== undefined ) 0833 obj.has_masks = value_from_lottie(arr["hasMask"]); 0834 if ( arr["masksProperties"] !== undefined ) 0835 obj.masks = value_from_lottie(arr["masksProperties"]); 0836 if ( arr["ef"] !== undefined ) 0837 obj.effects = value_from_lottie(arr["ef"]); 0838 if ( arr["t"] !== undefined ) 0839 obj.data = value_from_lottie(arr["t"]); 0840 return obj; 0841 } 0842 } 0843 0844 /* 0845 */ 0846 export class ImageLayer extends Layer 0847 { 0848 threedimensional; 0849 hidden; 0850 type; 0851 name; 0852 parent; 0853 stretch; 0854 transform; 0855 auto_orient; 0856 in_point; 0857 out_point; 0858 start_time; 0859 blend_mode; 0860 matte_mode; 0861 index; 0862 has_masks; 0863 masks; 0864 effects; 0865 image_id; 0866 0867 constructor() 0868 { 0869 super(); 0870 this.type = 2; 0871 this.threedimensional = false; 0872 this.hidden = null; 0873 this.name = null; 0874 this.parent = null; 0875 this.stretch = 1; 0876 this.transform = new Transform(); 0877 this.auto_orient = false; 0878 this.in_point = null; 0879 this.out_point = null; 0880 this.start_time = 0; 0881 this.blend_mode = BlendMode.Normal; 0882 this.matte_mode = null; 0883 this.index = null; 0884 this.has_masks = null; 0885 this.masks = null; 0886 this.effects = null; 0887 this.image_id = ''; 0888 } 0889 0890 to_lottie() 0891 { 0892 var arr = {}; 0893 if ( this.threedimensional !== null ) 0894 arr["ddd"] = value_to_lottie(Number(this.threedimensional)); 0895 if ( this.hidden !== null ) 0896 arr["hd"] = value_to_lottie(this.hidden); 0897 if ( this.type !== null ) 0898 arr["ty"] = value_to_lottie(this.type); 0899 if ( this.name !== null ) 0900 arr["nm"] = value_to_lottie(this.name); 0901 if ( this.parent !== null ) 0902 arr["parent"] = value_to_lottie(this.parent); 0903 if ( this.stretch !== null ) 0904 arr["sr"] = value_to_lottie(this.stretch); 0905 if ( this.transform !== null ) 0906 arr["ks"] = value_to_lottie(this.transform); 0907 if ( this.auto_orient !== null ) 0908 arr["ao"] = value_to_lottie(Number(this.auto_orient)); 0909 if ( this.in_point !== null ) 0910 arr["ip"] = value_to_lottie(this.in_point); 0911 if ( this.out_point !== null ) 0912 arr["op"] = value_to_lottie(this.out_point); 0913 if ( this.start_time !== null ) 0914 arr["st"] = value_to_lottie(this.start_time); 0915 if ( this.blend_mode !== null ) 0916 arr["bm"] = value_to_lottie(this.blend_mode); 0917 if ( this.matte_mode !== null ) 0918 arr["tt"] = value_to_lottie(this.matte_mode); 0919 if ( this.index !== null ) 0920 arr["ind"] = value_to_lottie(this.index); 0921 if ( this.has_masks !== null ) 0922 arr["hasMask"] = value_to_lottie(this.has_masks); 0923 if ( this.masks !== null ) 0924 arr["masksProperties"] = value_to_lottie(this.masks); 0925 if ( this.effects !== null ) 0926 arr["ef"] = value_to_lottie(this.effects); 0927 if ( this.image_id !== null ) 0928 arr["refId"] = value_to_lottie(this.image_id); 0929 return arr; 0930 } 0931 0932 static from_lottie(arr) 0933 { 0934 var obj = new ImageLayer(); 0935 if ( arr["ddd"] !== undefined ) 0936 obj.threedimensional = value_from_lottie(Boolean(arr["ddd"])); 0937 if ( arr["hd"] !== undefined ) 0938 obj.hidden = value_from_lottie(arr["hd"]); 0939 if ( arr["ty"] !== undefined ) 0940 obj.type = value_from_lottie(arr["ty"]); 0941 if ( arr["nm"] !== undefined ) 0942 obj.name = value_from_lottie(arr["nm"]); 0943 if ( arr["parent"] !== undefined ) 0944 obj.parent = value_from_lottie(arr["parent"]); 0945 if ( arr["sr"] !== undefined ) 0946 obj.stretch = value_from_lottie(arr["sr"]); 0947 if ( arr["ks"] !== undefined ) 0948 obj.transform = value_from_lottie(arr["ks"]); 0949 if ( arr["ao"] !== undefined ) 0950 obj.auto_orient = value_from_lottie(Boolean(arr["ao"])); 0951 if ( arr["ip"] !== undefined ) 0952 obj.in_point = value_from_lottie(arr["ip"]); 0953 if ( arr["op"] !== undefined ) 0954 obj.out_point = value_from_lottie(arr["op"]); 0955 if ( arr["st"] !== undefined ) 0956 obj.start_time = value_from_lottie(arr["st"]); 0957 if ( arr["bm"] !== undefined ) 0958 obj.blend_mode = value_from_lottie(arr["bm"]); 0959 if ( arr["tt"] !== undefined ) 0960 obj.matte_mode = value_from_lottie(arr["tt"]); 0961 if ( arr["ind"] !== undefined ) 0962 obj.index = value_from_lottie(arr["ind"]); 0963 if ( arr["hasMask"] !== undefined ) 0964 obj.has_masks = value_from_lottie(arr["hasMask"]); 0965 if ( arr["masksProperties"] !== undefined ) 0966 obj.masks = value_from_lottie(arr["masksProperties"]); 0967 if ( arr["ef"] !== undefined ) 0968 obj.effects = value_from_lottie(arr["ef"]); 0969 if ( arr["refId"] !== undefined ) 0970 obj.image_id = value_from_lottie(arr["refId"]); 0971 return obj; 0972 } 0973 } 0974