LayaAir 加载图集资源并播放动画
2017-12-06 14:12
330 查看
首先初始化场景 并加载图片资源
最后在回调函数中显示一张图片和播放动画
constructor() { Laya.init(Browser.clientWidth, Browser.clientHeight, WebGL); Laya.stage.alignV = Stage.ALIGN_MIDDLE; Laya.stage.alignH = Stage.ALIGN_CENTER; Laya.stage.scaleMode = "showall"; Laya.stage.bgColor = "#232628"; Laya.loader.load("res/atlas/images.atlas",Laya.Handler.create(this,this.onLoaded),null,Laya.Loader.ATLAS); }
最后在回调函数中显示一张图片和播放动画
private onLoaded():void{ //显示一张图片 let mySprite:Laya.Sprite = new Laya.Sprite(); mySprite.loadImage("images/9.png"); mySprite.pos(200,200); Laya.stage.addChild(mySprite); //播放动画 Laya.Animation.createFrames(["images/9.png","images/8.png","images/7.png","images/6.png", "images/5.png","images/4.png","images/3.png","images/2.png","images/1.png", "images/0.png"],"number"); let animation:Laya.Animation = new Laya.Animation(); animation.interval = 1000; Laya.stage.addChild(animation); animation.play(0,false,"number",false); animation.on(Laya.Event.COMPLETE,this,this.onPlayComplete); } private onPlayComplete():void{ alert("animations has finishe"); }
相关文章推荐
- LayaAir 加载图集资源并播放动画
- 人物动画声音随机播放,资源加载
- Delphi 自带GIF控件的动画图片加载和播放
- 安卓视频播放API--VideoView如何加载项目视频资源,如何全屏播放,如何作为欢迎页面的背景显示?
- Unity3D之Mecanim动画系统学习笔记(十):Mecanim动画的资源加载相关
- cocos 加载csb文件和播放ui动画
- 网页资源加载动画
- 让TAnimate控件播放资源动画
- GFX::3d::engine-加载播放md5动画
- Delphi 自带GIF控件的动画图片加载和播放
- cocos2d-x JS 加载播放Studio帧动画的两种方法
- Android使用glide加载gif动画设置播放次数
- popcap sexyframework- Demo4 使用资源管理器加载资源 前导屏幕 播放声音 以及超连接 输入框 列表框 滚动条
- DuiLib中的GifAnim控件无法加载或者播放Gif动画的解决办法
- VC中借助内嵌资源实现Flash动画播放
- VC中借助内嵌资源实现Flash动画播放
- VC中借助内嵌资源实现Flash动画播放
- Unity3D之Mecanim动画系统学习笔记(十):Mecanim动画的资源加载相关
- 个性进度条--------菊花加载----Android 播放动画
- cocos2d-x JS 纯代码加载播放plist与png动画