egret学习日记4
来源:互联网 发布:阿里云域名证书 编辑:程序博客网 时间:2024/06/07 01:12
缓动动画:
基本的缓动:egret提供缓动库,使用Tween.get()方法来获得缓动目标。然后可以对其任意可写的属性进行缓动控制。
egret.Tween.get( this._bird ).to( {x:loc.x,y:loc.y}, 300, egret.Ease.sineIn );
缓动产生的事件:缓动是由一系列中间状态按顺序变化形成的,每一个中间状态可以产生一个更新事
件,便于完成更丰富的功能,在Tween.get()的第二个参数,即属性集
合参数中可以定义更新事件。属性集合是一个键值对集合,将更新事件分配给on
Change键即可,如事件有其作用域要求,可以同时将作用域引用分配给on
ChangeObj键。
var funcChange = ():void=>{
this._bird.rotation += 6 * iDirection;
}
var iDirection:number = Math.random() > .5 ? -1 : 1; /// 随机方向
egret.Tween.get( this._bird, { onChange:funcChange, onChangeObj:this } )
.to( {x:loc.x,y:loc.y}, 300, egret.Ease.sineIn );
缓动过程方程:egret提供的缓动方程在egret.Ease中
var params:EaseFunc = this._vcEaseFunc[ ++this._idxEase % this._vcEaseFunc.length ];
egret.Tween.get( this._bird )
.to( {x:loc.x,y:loc.y}, 600, params.func );
复合缓动:复合动画是Tween的重要特色。
不同的动画可以按照顺序通过链式调用依次连接循环调用。
每次缓动调用结束时可以通过Tween.call()来进行该阶段的完成事件
处理。
不同的缓动之间可以通过Tween.wait()来控制延迟时间。
按照本示例所示,开发者可以使用egret.Tween创建各种丰富而灵活的
动画组合。
egret.Tween.get( this._bird, { loop:true} )
.to( {x:this._vcLocation[0].x, y:this._vcLocation[0].y}, 500 )
.call( ()=>{ this._bird.rotation = 180 - this._rotCommon; } ).wait( 200 )
.to( {x:this._vcLocation[1].x, y:this._vcLocation[1].y}, 500 )
.call( ()=>{ this._bird.rotation = - 90; } ).wait( 200 )
.to( {x:this._vcLocation[2].x, y:this._vcLocation[2].y}, 500 )
.call( ()=>{ this._bird.rotation = this._rotCommon; } ).wait( 200 )
.to( {x:this._vcLocation[3].x, y:this._vcLocation[3].y}, 500 )
.call( ()=>{ this._bird.rotation = - 90; } ).wait( 200 );
- egret学习日记4
- egret学习日记1
- egret学习日记3
- egret学习日记2图像绘制及高级图像
- Egret学习
- [Egret学习笔记 一]Egret HelloWorld!!!
- [Egret 学习笔记 九]关于egret命令
- Egret学习入门
- egret学习之基础知识
- Egret学习笔记一
- 初步学习Egret心得
- egret学习笔记
- Egret
- Egret
- H5游戏引擎为什么选择egret和怎么学习egret
- JSP学习日记 - 4
- 学习日记(4)
- 黑马学习日记4
- caffe移植到arm平台
- Objective-C static libraries with categories
- CocoaPods 第三方库管理工作
- Codeblocks中文乱码-C语言中文乱码-控制台中文乱码
- UIAppearance 协议自定义视图
- egret学习日记4
- window.onload事件的作用是什么
- AFNetworking2.0 NSHipster翻译
- React Native 之ScrollView轮播图实现
- xcode5 arm64
- (译)Objective-C的动态特性
- 移动学习 AndroidStudio内存优化分析—hprof文件分析
- Objective C运行时(runtime)技术的几个要点总结
- Associated Objects