import { ColorData } from "./data-color" ; import { AlphaCurveType } from "../enum/alpha-curve-type" ; /**
 * パーティクルの描画情報を扱うデータ型クラスです。
 */ export class DrawingData { type { string } bgColor : string = "" ; type { number } width : number = 0.0 ; type { number } height : number = 0.0 ; type { number } emitFrequency : number = 0 ; type { number } startX : number = 0 ; type { number } startXVariance : number = 0 ; type { number } startY : number = 0 ; type { number } startYVariance : number = 0 ; type { number } initialDirection : number = 0 ; type { number } initialDirectionVariance : number = 0 ; type { number } initialSpeed : number = 0 ; type { number } initialSpeedVariance : number = 0 ; type { number } friction : number = 0 ; type { number } accelerationSpeed : number = 0 ; type { number } accelerationDirection : number = 0 ; type { number } startScale : number = 0 ; type { number } startScaleVariance : number = 0 ; type { number } finishScale : number = 0 ; type { number } finishScaleVariance : number = 0 ; type { number } lifeSpan : number = 0 ; type { number } /**  */ lifeSpanVariance : number = 0 ; type { number } startAlpha : number = 0 ; type { number } startAlphaVariance : number = 0 ; type { number } finishAlpha : number = 0 ; type { number } finishAlphaVariance : number = 0 ; type { string [ ] } shapeIdList : string [ ] = [ "" ] ; type { ColorData } startColor : ColorData = new ColorData ( ) ; type { boolean } blendMode : boolean = true ; type { AlphaCurveType . Normal } alphaCurveType : number = AlphaCurveType . Normal ; param json constructor ( json = null ) { if ( json ) { this . importFromJson ( json ) ; } } static ENABLE_REFLECT : boolean = DrawingData . checkReflectEnable ( ) ; param json public importFromJson ( json ) { const checkSkipKey = ( key ) => { return key == "width" || key == "height" || key == "bgColor" ; } ; this . setData ( json , checkSkipKey ) ; } param { DrawingData } obj public importData ( obj ) { const checkSkipKey = ( key ) => { return ( key == "width" || key == "height" || key == "startX" || key == "startY" ) ; } ; this . setData ( obj , checkSkipKey ) ; } static checkReflectEnable ( ) { try { const result = ! ! ( Reflect && Reflect . has ) ; return result ; } catch ( e ) { return false ; } } private setData ( obj , checkSkipKey ) { if ( DrawingData . ENABLE_REFLECT ) { for ( let key in obj ) { if ( checkSkipKey ( key ) ) { continue ; } if ( Reflect . has ( this , key ) == true ) { let val = < any > obj [ key ] ; Reflect . set ( this , key , val ) ; } } } else { const self = < any > this ; for ( let key in obj ) { if ( checkSkipKey ( key ) ) { continue ; } if ( this . hasOwnProperty ( key ) ) { self [ key ] = obj [ key ] ; } } } } }