export namespace data { export class Layer { x: number; y: number; shadingMultiplier: number; static createFrom(source: any = {}) { return new Layer(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.x = source["x"]; this.y = source["y"]; this.shadingMultiplier = source["shadingMultiplier"]; } } export class Frame { layers: Layer[]; static createFrom(source: any = {}) { return new Frame(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.layers = this.convertValues(source["layers"], Layer); } convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; } if (a.slice) { return (a as any[]).map(elem => this.convertValues(elem, classs)); } else if ("object" === typeof a) { if (asMap) { for (const key of Object.keys(a)) { a[key] = new classs(a[key]); } return a; } return new classs(a); } return a; } } export class Animation { frames: Frame[]; time: number; static createFrom(source: any = {}) { return new Animation(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.frames = this.convertValues(source["frames"], Frame); this.time = source["time"]; } convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; } if (a.slice) { return (a as any[]).map(elem => this.convertValues(elem, classs)); } else if ("object" === typeof a) { if (asMap) { for (const key of Object.keys(a)) { a[key] = new classs(a[key]); } return a; } return new classs(a); } return a; } } export class Group { animations: {[key: string]: Animation}; static createFrom(source: any = {}) { return new Group(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.animations = this.convertValues(source["animations"], Animation, true); } convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; } if (a.slice) { return (a as any[]).map(elem => this.convertValues(elem, classs)); } else if ("object" === typeof a) { if (asMap) { for (const key of Object.keys(a)) { a[key] = new classs(a[key]); } return a; } return new classs(a); } return a; } } export class StackistFileV1 { version: string; groups: {[key: string]: Group}; width: number; height: number; static createFrom(source: any = {}) { return new StackistFileV1(source); } constructor(source: any = {}) { if ('string' === typeof source) source = JSON.parse(source); this.version = source["version"]; this.groups = this.convertValues(source["groups"], Group, true); this.width = source["width"]; this.height = source["height"]; } convertValues(a: any, classs: any, asMap: boolean = false): any { if (!a) { return a; } if (a.slice) { return (a as any[]).map(elem => this.convertValues(elem, classs)); } else if ("object" === typeof a) { if (asMap) { for (const key of Object.keys(a)) { a[key] = new classs(a[key]); } return a; } return new classs(a); } return a; } } }