File indexing completed on 2025-01-19 04:00:00

0001 import { value_to_lottie, value_from_lottie, LottieObject } from '../base.js';
0002 import { Value, MultiDimensional } from './properties.js';
0003 
0004 /*
0005 */
0006 export class Font extends LottieObject
0007 {
0008     ascent;
0009     font_family;
0010     name;
0011     font_style;
0012 
0013     constructor()
0014     {
0015         super();
0016         this.ascent = null;
0017         this.font_family = 'sans';
0018         this.name = 'sans-Regular';
0019         this.font_style = 'Regular';
0020     }
0021 
0022     to_lottie()
0023     {
0024         var arr = {};
0025         if ( this.ascent !== null )
0026             arr["ascent"] = value_to_lottie(this.ascent);
0027         if ( this.font_family !== null )
0028             arr["fFamily"] = value_to_lottie(this.font_family);
0029         if ( this.name !== null )
0030             arr["fName"] = value_to_lottie(this.name);
0031         if ( this.font_style !== null )
0032             arr["fStyle"] = value_to_lottie(this.font_style);
0033         return arr;
0034     }
0035 
0036     static from_lottie(arr)
0037     {
0038         var obj = new Font();
0039         if ( arr["ascent"] !== undefined )
0040             obj.ascent = value_from_lottie(arr["ascent"]);
0041         if ( arr["fFamily"] !== undefined )
0042             obj.font_family = value_from_lottie(arr["fFamily"]);
0043         if ( arr["fName"] !== undefined )
0044             obj.name = value_from_lottie(arr["fName"]);
0045         if ( arr["fStyle"] !== undefined )
0046             obj.font_style = value_from_lottie(arr["fStyle"]);
0047         return obj;
0048     }
0049 }
0050 
0051 /*
0052 */
0053 export class FontList extends LottieObject
0054 {
0055     list;
0056 
0057     constructor()
0058     {
0059         super();
0060         this.list = [];
0061     }
0062 
0063     to_lottie()
0064     {
0065         var arr = {};
0066         if ( this.list !== null )
0067             arr["list"] = value_to_lottie(this.list);
0068         return arr;
0069     }
0070 
0071     static from_lottie(arr)
0072     {
0073         var obj = new FontList();
0074         if ( arr["list"] !== undefined )
0075             obj.list = value_from_lottie(arr["list"]);
0076         return obj;
0077     }
0078 }
0079 
0080 /*
0081 */
0082 export class MaskedPath extends LottieObject
0083 {
0084     mask;
0085     f;
0086     l;
0087     r;
0088 
0089     constructor()
0090     {
0091         super();
0092         this.mask = null;
0093         this.f = null;
0094         this.l = null;
0095         this.r = null;
0096     }
0097 
0098     to_lottie()
0099     {
0100         var arr = {};
0101         if ( this.mask !== null )
0102             arr["m"] = value_to_lottie(this.mask);
0103         if ( this.f !== null )
0104             arr["f"] = value_to_lottie(this.f);
0105         if ( this.l !== null )
0106             arr["l"] = value_to_lottie(this.l);
0107         if ( this.r !== null )
0108             arr["r"] = value_to_lottie(this.r);
0109         return arr;
0110     }
0111 
0112     static from_lottie(arr)
0113     {
0114         var obj = new MaskedPath();
0115         if ( arr["m"] !== undefined )
0116             obj.mask = value_from_lottie(arr["m"]);
0117         if ( arr["f"] !== undefined )
0118             obj.f = value_from_lottie(arr["f"]);
0119         if ( arr["l"] !== undefined )
0120             obj.l = value_from_lottie(arr["l"]);
0121         if ( arr["r"] !== undefined )
0122             obj.r = value_from_lottie(arr["r"]);
0123         return obj;
0124     }
0125 }
0126 
0127 /*
0128 */
0129 export class TextAnimatorDataProperty extends LottieObject
0130 {
0131     rotation;
0132     rx;
0133     ry;
0134     skew;
0135     skew_axis;
0136     scale;
0137     anchor;
0138     opacity;
0139     position;
0140     stroke_width;
0141     stroke_color;
0142     fill_color;
0143     fh;
0144     fs;
0145     fb;
0146     tracking;
0147 
0148     constructor()
0149     {
0150         super();
0151         this.rotation = new Value(0);
0152         this.rx = new Value(0);
0153         this.ry = new Value(0);
0154         this.skew = new Value(0);
0155         this.skew_axis = new Value(0);
0156         this.scale = new MultiDimensional(null);
0157         this.anchor = new MultiDimensional(null);
0158         this.opacity = new Value(0);
0159         this.position = new MultiDimensional(null);
0160         this.stroke_width = new Value(0);
0161         this.stroke_color = new MultiDimensional(null);
0162         this.fill_color = new MultiDimensional(null);
0163         this.fh = new Value(0);
0164         this.fs = new Value(0);
0165         this.fb = new Value(0);
0166         this.tracking = new Value(0);
0167     }
0168 
0169     to_lottie()
0170     {
0171         var arr = {};
0172         if ( this.rotation !== null )
0173             arr["r"] = value_to_lottie(this.rotation);
0174         if ( this.rx !== null )
0175             arr["rx"] = value_to_lottie(this.rx);
0176         if ( this.ry !== null )
0177             arr["ry"] = value_to_lottie(this.ry);
0178         if ( this.skew !== null )
0179             arr["sk"] = value_to_lottie(this.skew);
0180         if ( this.skew_axis !== null )
0181             arr["sa"] = value_to_lottie(this.skew_axis);
0182         if ( this.scale !== null )
0183             arr["s"] = value_to_lottie(this.scale);
0184         if ( this.anchor !== null )
0185             arr["a"] = value_to_lottie(this.anchor);
0186         if ( this.opacity !== null )
0187             arr["o"] = value_to_lottie(this.opacity);
0188         if ( this.position !== null )
0189             arr["p"] = value_to_lottie(this.position);
0190         if ( this.stroke_width !== null )
0191             arr["sw"] = value_to_lottie(this.stroke_width);
0192         if ( this.stroke_color !== null )
0193             arr["sc"] = value_to_lottie(this.stroke_color);
0194         if ( this.fill_color !== null )
0195             arr["fc"] = value_to_lottie(this.fill_color);
0196         if ( this.fh !== null )
0197             arr["fh"] = value_to_lottie(this.fh);
0198         if ( this.fs !== null )
0199             arr["fs"] = value_to_lottie(this.fs);
0200         if ( this.fb !== null )
0201             arr["fb"] = value_to_lottie(this.fb);
0202         if ( this.tracking !== null )
0203             arr["t"] = value_to_lottie(this.tracking);
0204         return arr;
0205     }
0206 
0207     static from_lottie(arr)
0208     {
0209         var obj = new TextAnimatorDataProperty();
0210         if ( arr["r"] !== undefined )
0211             obj.rotation = value_from_lottie(arr["r"]);
0212         if ( arr["rx"] !== undefined )
0213             obj.rx = value_from_lottie(arr["rx"]);
0214         if ( arr["ry"] !== undefined )
0215             obj.ry = value_from_lottie(arr["ry"]);
0216         if ( arr["sk"] !== undefined )
0217             obj.skew = value_from_lottie(arr["sk"]);
0218         if ( arr["sa"] !== undefined )
0219             obj.skew_axis = value_from_lottie(arr["sa"]);
0220         if ( arr["s"] !== undefined )
0221             obj.scale = value_from_lottie(arr["s"]);
0222         if ( arr["a"] !== undefined )
0223             obj.anchor = value_from_lottie(arr["a"]);
0224         if ( arr["o"] !== undefined )
0225             obj.opacity = value_from_lottie(arr["o"]);
0226         if ( arr["p"] !== undefined )
0227             obj.position = value_from_lottie(arr["p"]);
0228         if ( arr["sw"] !== undefined )
0229             obj.stroke_width = value_from_lottie(arr["sw"]);
0230         if ( arr["sc"] !== undefined )
0231             obj.stroke_color = value_from_lottie(arr["sc"]);
0232         if ( arr["fc"] !== undefined )
0233             obj.fill_color = value_from_lottie(arr["fc"]);
0234         if ( arr["fh"] !== undefined )
0235             obj.fh = value_from_lottie(arr["fh"]);
0236         if ( arr["fs"] !== undefined )
0237             obj.fs = value_from_lottie(arr["fs"]);
0238         if ( arr["fb"] !== undefined )
0239             obj.fb = value_from_lottie(arr["fb"]);
0240         if ( arr["t"] !== undefined )
0241             obj.tracking = value_from_lottie(arr["t"]);
0242         return obj;
0243     }
0244 }
0245 
0246 /*An enumeration.
0247 */
0248 export const TextJustify = Object.freeze({
0249     Left: 0,
0250     Right: 1,
0251     Center: 2,
0252 });
0253 /*
0254 */
0255 export class TextMoreOptions extends LottieObject
0256 {
0257     alignment;
0258     g;
0259 
0260     constructor()
0261     {
0262         super();
0263         this.alignment = new MultiDimensional([0, 0]);
0264         this.g = null;
0265     }
0266 
0267     to_lottie()
0268     {
0269         var arr = {};
0270         if ( this.alignment !== null )
0271             arr["a"] = value_to_lottie(this.alignment);
0272         if ( this.g !== null )
0273             arr["g"] = value_to_lottie(this.g);
0274         return arr;
0275     }
0276 
0277     static from_lottie(arr)
0278     {
0279         var obj = new TextMoreOptions();
0280         if ( arr["a"] !== undefined )
0281             obj.alignment = value_from_lottie(arr["a"]);
0282         if ( arr["g"] !== undefined )
0283             obj.g = value_from_lottie(arr["g"]);
0284         return obj;
0285     }
0286 }
0287 
0288 /*!
0289     @see http://docs.aenhancers.com/other/textdocument/
0290 */
0291 export class TextDocument extends LottieObject
0292 {
0293     font_family;
0294     color;
0295     font_size;
0296     line_height;
0297     wrap_size;
0298     text;
0299     justify;
0300 
0301     constructor()
0302     {
0303         super();
0304         this.font_family = '';
0305         this.color = [0, 0, 0];
0306         this.font_size = 10;
0307         this.line_height = null;
0308         this.wrap_size = null;
0309         this.text = '';
0310         this.justify = TextJustify.Left;
0311     }
0312 
0313     to_lottie()
0314     {
0315         var arr = {};
0316         if ( this.font_family !== null )
0317             arr["f"] = value_to_lottie(this.font_family);
0318         if ( this.color !== null )
0319             arr["fc"] = value_to_lottie(this.color);
0320         if ( this.font_size !== null )
0321             arr["s"] = value_to_lottie(this.font_size);
0322         if ( this.line_height !== null )
0323             arr["lh"] = value_to_lottie(this.line_height);
0324         if ( this.wrap_size !== null )
0325             arr["sz"] = value_to_lottie(this.wrap_size);
0326         if ( this.text !== null )
0327             arr["t"] = value_to_lottie(this.text);
0328         if ( this.justify !== null )
0329             arr["j"] = value_to_lottie(this.justify);
0330         return arr;
0331     }
0332 
0333     static from_lottie(arr)
0334     {
0335         var obj = new TextDocument();
0336         if ( arr["f"] !== undefined )
0337             obj.font_family = value_from_lottie(arr["f"]);
0338         if ( arr["fc"] !== undefined )
0339             obj.color = value_from_lottie(arr["fc"]);
0340         if ( arr["s"] !== undefined )
0341             obj.font_size = value_from_lottie(arr["s"]);
0342         if ( arr["lh"] !== undefined )
0343             obj.line_height = value_from_lottie(arr["lh"]);
0344         if ( arr["sz"] !== undefined )
0345             obj.wrap_size = value_from_lottie(arr["sz"]);
0346         if ( arr["t"] !== undefined )
0347             obj.text = value_from_lottie(arr["t"]);
0348         if ( arr["j"] !== undefined )
0349             obj.justify = value_from_lottie(arr["j"]);
0350         return obj;
0351     }
0352 }
0353 
0354 /*
0355 */
0356 export class TextDataKeyframe extends LottieObject
0357 {
0358     start;
0359     time;
0360 
0361     constructor()
0362     {
0363         super();
0364         this.start = null;
0365         this.time = 0;
0366     }
0367 
0368     to_lottie()
0369     {
0370         var arr = {};
0371         if ( this.start !== null )
0372             arr["s"] = value_to_lottie(this.start);
0373         if ( this.time !== null )
0374             arr["t"] = value_to_lottie(this.time);
0375         return arr;
0376     }
0377 
0378     static from_lottie(arr)
0379     {
0380         var obj = new TextDataKeyframe();
0381         if ( arr["s"] !== undefined )
0382             obj.start = value_from_lottie(arr["s"]);
0383         if ( arr["t"] !== undefined )
0384             obj.time = value_from_lottie(arr["t"]);
0385         return obj;
0386     }
0387 }
0388 
0389 /*
0390 */
0391 export class TextData extends LottieObject
0392 {
0393     keyframes;
0394 
0395     constructor()
0396     {
0397         super();
0398         this.keyframes = [];
0399     }
0400 
0401     to_lottie()
0402     {
0403         var arr = {};
0404         if ( this.keyframes !== null )
0405             arr["k"] = value_to_lottie(this.keyframes);
0406         return arr;
0407     }
0408 
0409     static from_lottie(arr)
0410     {
0411         var obj = new TextData();
0412         if ( arr["k"] !== undefined )
0413             obj.keyframes = value_from_lottie(arr["k"]);
0414         return obj;
0415     }
0416 }
0417 
0418 /*
0419 */
0420 export class TextAnimatorData extends LottieObject
0421 {
0422     properties;
0423     data;
0424     more_options;
0425     masked_path;
0426 
0427     constructor()
0428     {
0429         super();
0430         this.properties = [];
0431         this.data = new TextData();
0432         this.more_options = new TextMoreOptions();
0433         this.masked_path = new MaskedPath();
0434     }
0435 
0436     to_lottie()
0437     {
0438         var arr = {};
0439         if ( this.properties !== null )
0440             arr["a"] = value_to_lottie(this.properties);
0441         if ( this.data !== null )
0442             arr["d"] = value_to_lottie(this.data);
0443         if ( this.more_options !== null )
0444             arr["m"] = value_to_lottie(this.more_options);
0445         if ( this.masked_path !== null )
0446             arr["p"] = value_to_lottie(this.masked_path);
0447         return arr;
0448     }
0449 
0450     static from_lottie(arr)
0451     {
0452         var obj = new TextAnimatorData();
0453         if ( arr["a"] !== undefined )
0454             obj.properties = value_from_lottie(arr["a"]);
0455         if ( arr["d"] !== undefined )
0456             obj.data = value_from_lottie(arr["d"]);
0457         if ( arr["m"] !== undefined )
0458             obj.more_options = value_from_lottie(arr["m"]);
0459         if ( arr["p"] !== undefined )
0460             obj.masked_path = value_from_lottie(arr["p"]);
0461         return obj;
0462     }
0463 }
0464