import { Laya } from "Laya" ; import { Camera } from "laya/d3/core/Camera" ; import { Scene3D } from "laya/d3/core/scene/Scene3D" ; import { Vector3 } from "laya/d3/math/Vector3" ; import { Vector4 } from "laya/d3/math/Vector4" ; import { Stage } from "laya/display/Stage" ; import { Button } from "laya/ui/Button" ; import { Handler } from "laya/utils/Handler" ; import { Stat } from "laya/utils/Stat" ; import { Laya3D } from "Laya3D" ; import { Browser } from "laya/utils/Browser" ; import { BitmapFont } from "laya/display/BitmapFont" ; import { Text } from "laya/display/Text" ; import { Event } from "laya/events/Event" ; export class SkeletonMask { private fontName : string = "fontClip" ; constructor ( ) { Laya3D . init ( 0 , 0 ) ; Stat . show ( ) ; Laya . stage . scaleMode = Stage . SCALE_FULL ; Laya . stage . screenMode = Stage . SCREEN_NONE ; this . loadFont ( ) ; Scene3D . load ( "res/threeDimen/LayaScene_MaskModelTest/Conventional/MaskModelTest.ls" , Handler . create ( this , function ( scene ) : void { ( < Scene3D > Laya . stage . addChild ( scene ) ) ; var camera = ( < Camera > scene . getChildByName ( "Camera" ) ) ; } ) ) ; } private loadFont ( ) { var bitmapFont = new BitmapFont ( ) ; bitmapFont . loadFont ( "res/threeDimen/LayaScene_MaskModelTest/font/fontClip.fnt" , new Handler ( this , this . onFontLoaded , [ bitmapFont ] ) ) ; } private onFontLoaded ( bitmapFont ) { bitmapFont . setSpaceWidth ( 10 ) ; Text . registerBitmapFont ( this . fontName , bitmapFont ) ; this . createText ( this . fontName ) ; this . createText1 ( this . fontName ) ; this . createText2 ( this . fontName ) ; } private createText ( font ) { var txt = new Text ( ) ; txt . width = 250 ; txt . wordWrap = true ; txt . text = "带有骨骼遮罩的动画" ; txt . color = "#FFFFFFFF" ; txt . leading = 5 ; txt . fontSize = 10 ; txt . zOrder = 999999999 ; txt . scale ( Browser . pixelRatio , Browser . pixelRatio ) ; txt . pos ( Laya . stage . width / 2 - 50 , Laya . stage . height / 2 ) ; Laya . stage . on ( Event . RESIZE , txt , ( ) => { txt . pos ( Laya . stage . width / 2 - 50 , Laya . stage . height / 2 ) ; } ) ; Laya . stage . addChild ( txt ) ; } createText1 ( font ) { var txt = new Text ( ) ; txt . width = 250 ; txt . wordWrap = true ; txt . text = "正常动画一" ; txt . color = "#FFFFFFFF" ; txt . size ( 200 , 300 ) ; txt . leading = 5 ; txt . fontSize = 15 ; txt . zOrder = 999999999 ; txt . pos ( Laya . stage . width / 2 - 240 , Laya . stage . height / 2 ) ; Laya . stage . on ( Event . RESIZE , txt , ( ) => { txt . pos ( Laya . stage . width / 2 - 240 , Laya . stage . height / 2 ) ; } ) ; Laya . stage . addChild ( txt ) ; } createText2 ( font ) { var txt = new Text ( ) ; txt . width = 250 ; txt . wordWrap = true ; txt . text = "正常动画二" ; txt . color = "#FFFFFFFF" ; txt . leading = 5 ; txt . zOrder = 999999999 ; txt . fontSize = 15 ; txt . pos ( Laya . stage . width / 2 + 140 , Laya . stage . height / 2 ) ; Laya . stage . on ( Event . RESIZE , txt , ( ) => { txt . pos ( Laya . stage . width / 2 + 140 , Laya . stage . height / 2 ) ; } ) ; Laya . stage . addChild ( txt ) ; } }