父 Sprite 及其子 DisplayObject 不会同时淡入/淡出...?

发布于 2024-10-06 23:25:35 字数 292 浏览 2 评论 0原文

我试图以编程方式模拟 Action Script 3 中的一些淡入/淡出效果,使用 Timer 类并及时控制指定 DisplayObject 的 alpha 属性。总的来说,它的工作原理和外观都很棒。正如我所期待的那样。但是当我向父 Sprite 添加更多子 DisplayObject 后,它的行为开始变得奇怪。子对象的褪色速度似乎与父对象的褪色速度不同,并且在视觉上很明显且丑陋。在父母已经开始淡出之后和孩子们真正跟随之前似乎有一个短暂的滞后。我还应该采取任何其他措施来避免这种情况吗?

我只对父对象进行 alpha 操作。我以为这是合乎逻辑的...

I'm trying to simulate some fade in/out effects in Action Script 3 programmatically, using Timer class and controlling alpha property of the specified DisplayObject in time. In general it works and looks great. As I was expecting. But after I add some more child DisplayObjects to the parent Sprite it starts to behave weirdly. Children seem to not fade at the same rate as parent object and it visually noticeable, and ugly. There seems to be a short lag after parent already started to fade out and before children actually follow. Are there any additional measures I should take to avoid that?

I do alpha manipulation only on parent object. I thought that'd be logical...

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

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

发布评论

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

评论(2

夜声 2024-10-13 23:25:35

将混合模式设置为图层:

blendMode = BlendMode.LAYER;

set the blendmode to LAYER:

blendMode = BlendMode.LAYER;
独﹏钓一江月 2024-10-13 23:25:35

它可以有简单的答案。假设您的父级是灰色矩形,子级是较小的灰色矩形。现在 Flash 的行为很有趣。它在某种程度上设置了子级(内部?)和父级的 alpha。因此,如果您有 parent_.alpha = 0.5,想象一下父级的 RECTANGLE(灰色的)是 0.5 透明的,然后在其顶部绘制其子级,该子级也具有 alpha(内部为 alpha)属性不变)设置为 0.5;如果将一个 0.5 矩形放置在另一个 0.5 矩形之上,则相交的区域将比其余区域更明显。

我希望这些胡言乱语至少有一半是可以理解的,它有点时髦,我不知道如何解释得好。

It can have simple answer. Assume your parent is gray rectangle, and the child is smaller grey rectangle. Now Flash behaves funny. It, kind of, sets the alpha of both the child (internally?) and parent. so if you have parent_.alpha = 0.5, imagine that the parent's RECTANGLE (the gray one) is 0.5 transparent, and THEN on TOP of it is drawn its child, which ALSO has alpha (internally, alpha property doesn't change) set to 0.5; if you place one 0.5 rectangle on top of another 0.5 rectangle, the intersecting field will be more visible than the rest.

I hope this gibberish is at least half understandable, it's kind of funky and I am not sure how to explain that well.

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