import { Laya } from "Laya" ; import { Sprite } from "laya/display/Sprite" ; import { GlowFilter } from "laya/filters/GlowFilter" ; import { Texture } from "laya/resource/Texture" ; import { Browser } from "laya/utils/Browser" ; import { Handler } from "laya/utils/Handler" ; import { WebGL } from "laya/webgl/WebGL" ; import { Main } from "./../Main" ; export class Filters_Glow { private apePath : string = "res/apes/monkey2.png" ; private ape : Sprite ; Main : typeof Main = null ; constructor ( maincls ) { this . Main = maincls ; Laya . init ( Browser . clientWidth , Browser . clientHeight , WebGL ) ; Laya . stage . scaleMode = "showall" ; Laya . stage . bgColor = "#232628" ; Laya . loader . load ( this . apePath , Handler . create ( this , this . setup ) ) ; } private setup ( tex ) { this . createApe ( ) ; this . applayFilter ( ) ; } private createApe ( ) { this . ape = new Sprite ( ) ; this . ape . loadImage ( this . apePath ) ; var texture = Laya . loader . getRes ( this . apePath ) ; this . ape . x = ( Laya . stage . width - texture . width ) / 2 ; this . ape . y = ( Laya . stage . height - texture . height ) / 2 ; this . Main . box2D . addChild ( this . ape ) ; } private applayFilter ( ) { var glowFilter = new GlowFilter ( "#ffff00" , 10 , 0 , 0 ) ; this . ape . filters = [ glowFilter ] ; } }