[]Tween 缓动过程有触发回调函数么

Tween 缓动过程有触发回调函数么
已邀请:

Aar0n

赞同来自:

第二个参数:  props 变化的属性列表,比如{x:100,y:20,ease:Ease.backOut,complete:Handler.create(this,onComplete),update:new Handler(this,onComplete)}。   update这个 数值改变就会触发回调,也就是过程中的回调

kezhiyu

赞同来自:

let a = new Tween()
let data = {x:0}
let params = {x: 10}
params.update = new Handler(this, this.onUpdate)
// 直接赋值在变化的 params 。这个看起来很骚气有没有
a.to(data, params, 1000)

dear_H

赞同来自:

你好 我试了之后 好像没实时触发 倒是缓动完成了才触发 帮忙看看把 谢谢 @laya_Aaron

kezhiyu

赞同来自:

      props.update = ls.Handler.create(_this, _this.onUpdate, null, false)

Aar0n

赞同来自:

/**
* 缓动对象的props属性到目标值。
* @param target 目标对象(即将更改属性值的对象)。
* @param props 变化的属性列表,比如{x:100,y:20,ease:Ease.backOut,complete:Handler.create(this,onComplete),update:new Handler(this,onComplete)}。
* @param duration 花费的时间,单位毫秒。
* @param ease 缓动类型,默认为匀速运动。
* @param complete 结束回调函数。
* @param delay 延迟执行时间。
* @param coverBefore 是否覆盖之前的缓动。
* @param autoRecover 是否自动回收,默认为true,缓动结束之后自动回收到对象池。
* @return 返回Tween对象。
*/
public static function to(target:*, props:Object, duration:int, ease:Function = null, complete:Handler = null, delay:int = 0, coverBefore:Boolean = false, autoRecover:Boolean = true):Tween {
return Pool.getItemByClass("tween", Tween)._create(target, props, duration, ease, complete, delay, coverBefore, true, autoRecover, true);
}
 源码在这,官网有例子https://ldc.layabox.com/doc/?nav=zh-as-1-5-1
TIM截图20180109180913.png

dear_H

赞同来自:

估计就是这个问题 我没设置 所以才执行一次

Aar0n

赞同来自:

TIM截图20180109185808.png

源码都写着默认true 

dear_H

赞同来自:

嘿嘿 谢谢 已经解决了

Aar0n

赞同来自:

TIM截图20180109202039.png

@kezhiyu  这两个是有区别的,在对象池的默认true 一次就回收,  new的 那个 默认false

要回复问题请先

商务合作
商务合作