egret 常用代码
// 播放声音 static playSound(sound: string) { let playSound:egret.Sound = RES.getRes(sound); let channel:egret.SoundChannel = playSound.play(0, 1); return channel } // 动画 static initGif(param) { const data = RES.getRes(param.json); const txtr = RES.getRes(param.img); let mcFanctory: egret.MovieClipDataFactory = new egret.MovieClipDataFactory(data, txtr); const obj = new egret.MovieClip(mcFanctory.generateMovieClipData(param.playName)); // 动画的位置 obj.x = param.x || 0; obj.y = param.y || 0; obj.scaleX = 2; obj.scaleY = 2; obj.name = param.name || ""; return obj; } // 滤镜 static setFilter(color: number, alpha: number) { const blurX: number = 45; const blurY: number = 45; const strength: number = 3; const quality: number = egret.BitmapFilterQuality.HIGH; const inner: boolean = false; const knockout: boolean = false; const glowFilter:egret.GlowFilter = new egret.GlowFilter(color, alpha, blurX, blurY, strength, quality, inner, knockout); return glowFilter; }