import { delay , loadRes } from './delay.js' ; import { ColorFilter } from 'laya/filters/ColorFilter.js' ; import { Laya } from 'Laya.js' ; import { Image } from 'laya/ui/Image.js' ; import { getResPath } from './resPath.js' ; class Main { constructor ( ) { Laya . init ( 800 , 600 ) ; Laya . stage . screenMode = 'none' ; this . test1 ( ) ; } /**
     * colorfilter多个的情况下，使用缓存的texture的问题
     */ async test1 ( ) { var redMat = [ 1 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 1 , 0 ] ; var redFilter = new ColorFilter ( redMat ) ; await loadRes ( getResPath ( 'monkey0.png' ) ) ; var sp = new Image ( ) ; sp . skin = getResPath ( 'monkey0.png' ) ; sp . filters = [ redFilter ] ; var fs = sp . filters ; fs . push ( redFilter ) ; sp . filters = fs ; Laya . stage . addChild ( sp ) ; await delay ( 10 ) ; sp . cacheAs = 'none' ; await delay ( 2000 ) ; Laya . stage . removeChild ( sp ) ; delay ( 100 ) ; ( window as any ) . testEnd = true ; } } new Main ( ) ;