File indexing completed on 2025-01-19 03:59:59

0001 import { value_to_lottie, value_from_lottie, LottieObject } from '../base.js';
0002 import { Layer } from './layers.js';
0003 import { ShapeElement } from './shapes.js';
0004 
0005 /*
0006 */
0007 export class Asset extends LottieObject
0008 {
0009 
0010     constructor()
0011     {
0012         super();
0013     }
0014 
0015     to_lottie()
0016     {
0017         var arr = {};
0018         return arr;
0019     }
0020 
0021     static from_lottie(arr)
0022     {
0023         var obj = new Asset();
0024         return obj;
0025     }
0026 }
0027 
0028 /*!
0029     Character shapes
0030 */
0031 export class CharacterData extends LottieObject
0032 {
0033     shapes;
0034 
0035     constructor()
0036     {
0037         super();
0038         this.shapes = [];
0039     }
0040 
0041     to_lottie()
0042     {
0043         var arr = {};
0044         if ( this.shapes !== null )
0045             arr["shapes"] = value_to_lottie(this.shapes);
0046         return arr;
0047     }
0048 
0049     static from_lottie(arr)
0050     {
0051         var obj = new CharacterData();
0052         if ( arr["shapes"] !== undefined )
0053             obj.shapes = value_from_lottie(arr["shapes"]);
0054         return obj;
0055     }
0056 }
0057 
0058 /*!
0059     Defines character shapes to avoid loading system fonts
0060 */
0061 export class Chars extends LottieObject
0062 {
0063     character;
0064     font_family;
0065     font_size;
0066     font_style;
0067     width;
0068     data;
0069 
0070     constructor()
0071     {
0072         super();
0073         this.character = '';
0074         this.font_family = '';
0075         this.font_size = 0;
0076         this.font_style = '';
0077         this.width = 0;
0078         this.data = new CharacterData();
0079     }
0080 
0081     to_lottie()
0082     {
0083         var arr = {};
0084         if ( this.character !== null )
0085             arr["ch"] = value_to_lottie(this.character);
0086         if ( this.font_family !== null )
0087             arr["fFamily"] = value_to_lottie(this.font_family);
0088         if ( this.font_size !== null )
0089             arr["size"] = value_to_lottie(this.font_size);
0090         if ( this.font_style !== null )
0091             arr["style"] = value_to_lottie(this.font_style);
0092         if ( this.width !== null )
0093             arr["w"] = value_to_lottie(this.width);
0094         if ( this.data !== null )
0095             arr["data"] = value_to_lottie(this.data);
0096         return arr;
0097     }
0098 
0099     static from_lottie(arr)
0100     {
0101         var obj = new Chars();
0102         if ( arr["ch"] !== undefined )
0103             obj.character = value_from_lottie(arr["ch"]);
0104         if ( arr["fFamily"] !== undefined )
0105             obj.font_family = value_from_lottie(arr["fFamily"]);
0106         if ( arr["size"] !== undefined )
0107             obj.font_size = value_from_lottie(arr["size"]);
0108         if ( arr["style"] !== undefined )
0109             obj.font_style = value_from_lottie(arr["style"]);
0110         if ( arr["w"] !== undefined )
0111             obj.width = value_from_lottie(arr["w"]);
0112         if ( arr["data"] !== undefined )
0113             obj.data = value_from_lottie(arr["data"]);
0114         return obj;
0115     }
0116 }
0117 
0118 /*!
0119         External image
0120 
0121         \see http://docs.aenhancers.com/sources/filesource/
0122 */
0123 export class Image extends Asset
0124 {
0125     height;
0126     width;
0127     id;
0128     image;
0129     image_path;
0130     embedded;
0131 
0132     constructor()
0133     {
0134         super();
0135         this.height = 0;
0136         this.width = 0;
0137         this.id = '';
0138         this.image = '';
0139         this.image_path = '';
0140         this.embedded = false;
0141     }
0142 
0143     to_lottie()
0144     {
0145         var arr = {};
0146         if ( this.height !== null )
0147             arr["h"] = value_to_lottie(this.height);
0148         if ( this.width !== null )
0149             arr["w"] = value_to_lottie(this.width);
0150         if ( this.id !== null )
0151             arr["id"] = value_to_lottie(this.id);
0152         if ( this.image !== null )
0153             arr["p"] = value_to_lottie(this.image);
0154         if ( this.image_path !== null )
0155             arr["u"] = value_to_lottie(this.image_path);
0156         if ( this.embedded !== null )
0157             arr["e"] = value_to_lottie(Number(this.embedded));
0158         return arr;
0159     }
0160 
0161     static from_lottie(arr)
0162     {
0163         var obj = new Image();
0164         if ( arr["h"] !== undefined )
0165             obj.height = value_from_lottie(arr["h"]);
0166         if ( arr["w"] !== undefined )
0167             obj.width = value_from_lottie(arr["w"]);
0168         if ( arr["id"] !== undefined )
0169             obj.id = value_from_lottie(arr["id"]);
0170         if ( arr["p"] !== undefined )
0171             obj.image = value_from_lottie(arr["p"]);
0172         if ( arr["u"] !== undefined )
0173             obj.image_path = value_from_lottie(arr["u"]);
0174         if ( arr["e"] !== undefined )
0175             obj.embedded = value_from_lottie(Boolean(arr["e"]));
0176         return obj;
0177     }
0178 }
0179 
0180 /*
0181 */
0182 export class Precomp extends Asset
0183 {
0184     id;
0185     layers;
0186 
0187     constructor()
0188     {
0189         super();
0190         this.id = '';
0191         this.layers = [];
0192     }
0193 
0194     to_lottie()
0195     {
0196         var arr = {};
0197         if ( this.id !== null )
0198             arr["id"] = value_to_lottie(this.id);
0199         if ( this.layers !== null )
0200             arr["layers"] = value_to_lottie(this.layers);
0201         return arr;
0202     }
0203 
0204     static from_lottie(arr)
0205     {
0206         var obj = new Precomp();
0207         if ( arr["id"] !== undefined )
0208             obj.id = value_from_lottie(arr["id"]);
0209         if ( arr["layers"] !== undefined )
0210             obj.layers = value_from_lottie(arr["layers"]);
0211         return obj;
0212     }
0213 }
0214