Aar0n
class AnimatorDemo
{
private scene:Laya.Scene3D;
resource
constructor()
{
//初始化引擎
Laya3D.init(0, 0);
//适配模式
Laya.stage.scaleMode = Laya.Stage.SCALE_FULL;
Laya.stage.screenMode = Laya.Stage.SCREEN_NONE;
//开启统计信息
Laya.Stat.show();
Laya.stage.frameRate = Laya.Stage.FRAME_FAST;
//预加载所有资源
this.resource = [
"res/maze/img/demo/toolClock/Conventional/glow.lh",
"res/maze/img/demo/Conventional/wang06.lh",
"res/maze/img/demo/toolClock/Conventional/puzzleA.lh",
"res/maze/img/demo/toolClock/Conventional/puzzleB.lh"
];
Laya.loader.create(this.resource, Laya.Handler.create(this, this.onLoadFinish));
}
private onLoadFinish()
{
//初始化场景
this.scene = new Laya.Scene3D();
Laya.stage.addChild(this.scene);
this.scene.ambientColor = new Laya.Vector3(0.5, 0.5, 0.5);
//初始化相机
var camera = new Laya.Camera(0, 0.1, 100);
this.scene.addChild(camera);
camera.transform.translate(new Laya.Vector3(0, 3, 5));
camera.transform.rotate(new Laya.Vector3( -15, 0, 0), true, false);
var directionLight = new Laya.DirectionLight();
this.scene.addChild(directionLight);
//设置灯光方向
var mat = directionLight.transform.worldMatrix;
mat.setForward(new Laya.Vector3(-1.0, -1.0, -1.0));
directionLight.transform.worldMatrix = mat;
for(let i = 0;i<100;i++){
let glow = Laya.Loader.getRes("res/maze/img/demo/toolClock/Conventional/glow.lh").clone()
glow.transform.localPosition = new Laya.Vector3(-1,0,-i);
this.scene.addChild(glow);
let puzzleA = Laya.Loader.getRes("res/maze/img/demo/toolClock/Conventional/puzzleA.lh").clone()
puzzleA.transform.localPosition = new Laya.Vector3(0,1,0);
glow.addChild(puzzleA);
let wang = Laya.Loader.getRes("res/maze/img/demo/Conventional/wang06.lh").clone()
wang.transform.localPosition = new Laya.Vector3(1,0,-i);
this.scene.addChild(wang);
}
}
}
new AnimatorDemo;