带 Sprite 图形的 Tweenlight 淡入淡出

发布于 08-09 01:44 字数 409 浏览 12 评论 0原文

我有一个精灵,我在上面画了一个白色矩形(如下),并想使用 TweenLite 使精灵淡入和淡出,但它要么显示或隐藏精灵。对尺寸进行动画处理(例如 scaleX)仅适用于 alpha。有什么想法吗?

private function Draw():void {          
   panel.graphics.beginFill(0xFFFFFF);
   panel.graphics.drawRect(0,0,367,135);
   panel.graphics.endFill();
}

public function FadeIn():void {
   trace("fadeIn");
   panel.alpha=0;
   TweenLite.to(panel, 2, {alpha:100});
}

I have a sprite which I draw a white rectangle on (below) and want to use TweenLite to fade the sprite in and out but it either shows or hides the the sprite. Animating the sizing such as scaleX works fine just the alpha. Any ideas?

private function Draw():void {          
   panel.graphics.beginFill(0xFFFFFF);
   panel.graphics.drawRect(0,0,367,135);
   panel.graphics.endFill();
}

public function FadeIn():void {
   trace("fadeIn");
   panel.alpha=0;
   TweenLite.to(panel, 2, {alpha:100});
}

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

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

发布评论

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

评论(1

秋凉2024-08-16 01:44:26

发现问题,alpha 是 100 而不是 1,因此 tweenlite 尝试在每次更新时将 alpha 设置为 100,导致 hte 闪烁

found the issue, alpha was 100 not 1 therefore tweenlite was trying to set the alpha to 100 on each update causing hte flickering

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文