【问题标题】:Adding onComplete handler after TweenMax object created?创建 TweenMax 对象后添加 onComplete 处理程序?
【发布时间】:2016-06-15 17:01:08
【问题描述】:

我想在创建 TweenMax 对象后添加一个 onComplete 处理程序,但找不到方法。我该怎么办?

澄清一下,我不想这样做:

TweenMax.to(obj, 0.5, { x: 100, onComplete: myFunc });

但我想做这样的事情:

var tween = TweenMax.to(obj, 0.5, { x: 100 });
tween.onComplete = myFunc; //  Or however you do this...

使用TweenMax.set(obj, { onComplete: myFunc }); 会立即触发事件。 我想我必须深入 TweenMax 对象才能找到 onComplete 引用,但我找不到它。

有什么想法吗?

【问题讨论】:

    标签: javascript gsap


    【解决方案1】:

    使用eventCallback,就像这样

    var tween = TweenMax.to(obj, 0.5, { x: 100 });
    tween.eventCallback("onComplete", myFunc, ["param1","param2"]);
    

    我从这里得到它http://greensock.com/docs/#/HTML5/GSAP/TweenLite/eventCallback/

    【讨论】:

      猜你喜欢
      • 2012-04-29
      • 1970-01-01
      • 2012-08-17
      • 2017-02-04
      • 2015-09-08
      • 2014-04-26
      • 2023-03-19
      • 2014-10-30
      • 1970-01-01
      相关资源
      最近更新 更多