tweenlite:一次补间多个对象

发布于 2024-12-18 06:43:38 字数 262 浏览 2 评论 0原文

我想知道当我尝试像这样补间多个对象并使用 onComplete 属性时是否会出现错误或其他问题:

TweenLite.to(restartBtn, .5, {alpha:0});
TweenLite.to(mainMenuBtn, .5, {alpha:0, onComplete:quitFadeIn});

我想要做的是一次淡出多个对象以及当它们完成特殊功能时被叫。使用 tweenlite 时是否还有其他可能性,或者我是否必须使用时间线?

I would like to know if I can get an error or some other problems when I try to tween several objects like this and using an onComplete-property:

TweenLite.to(restartBtn, .5, {alpha:0});
TweenLite.to(mainMenuBtn, .5, {alpha:0, onComplete:quitFadeIn});

What I want to do is fade out several objects at once and when they finished a special function gets called. Are there other possibilities when using tweenlite available or do I have to use timelinelite?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦归所梦 2024-12-25 06:43:38

您的示例代码应该可以正常运行,没有任何错误,如果您仅限于 TweenLite,那么这是一个非常好的使用方法。

如果您可以使用与 TweenLite 相同的 TweenMax,只是具有更多功能,您可以使用类似的方法来补间多个项目:

TweenMax.allTo([restartBtn, mainMenuBtn], .5, {alpha:0, onComplete:quitFadeIn});

这将使淡入淡出 0.2 秒

TweenMax.allTo([restartBtn, mainMenuBtn], .5, {alpha:0, onComplete:quitFadeIn}, -.2);

Your sample code should work without any errors and if you're limited to TweenLite, this is a perfectly good method to use.

If you can use TweenMax which is the same as TweenLite, just with more features, you can use something like this to tween multiple items:

TweenMax.allTo([restartBtn, mainMenuBtn], .5, {alpha:0, onComplete:quitFadeIn});

and this would stagger the fades by .2 seconds

TweenMax.allTo([restartBtn, mainMenuBtn], .5, {alpha:0, onComplete:quitFadeIn}, -.2);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文