Flex 4:两个 VideoDisplay 的交叉淡入淡出过渡不起作用

发布于 2025-01-05 09:27:08 字数 1136 浏览 4 评论 0原文

我正在尝试在 Flex 中在两个状态之间进行交叉淡入淡出转换,这两个状态都包含 VideoDisplay 对象。问题在于默认的 CrossFade 效果会获取两种状态的位图快照并在两者之间进行混合。这意味着电影在过渡期间似乎被冻结。

有人知道使用 PixelBender(GPU 加速)方法在两部电影之间进行淡入淡出的解决方案吗?我的另一种选择是手动重新排序视频对象并更改顶部视频对象的 alpha,但这会占用大量 CPU(在我的情况下为 ±300%)...

状态:

转换:

<s:transitions>
    <s:Transition >
        <s:CrossFade id="crossfader" target="{this}" duration="{fadeTime}"  />  
    </s:Transition>
</s:transitions>

对象:

<components1:VideoDisplay 
                    id="movie_attract" 
                    width="640" x="0" height="480" y="0"

                    source="{configuration.movieAttract.source}"

                    includeIn="attract" 

                    />
<components1:VideoDisplay 
                    id="movie_engage" 
                    left="0" right="0" top="0" bottom="0"

                    source="{configuration.movieEngage.source}"
                    includeIn="engage" 

                    />

I'm trying to do a cross-fade transition in Flex between two states, both containing a VideoDisplay object. The problem is that the default CrossFade effect takes a bitmap snapshot of both states and blends between the two. This means that the movies appear to be frozen for the time of the transition.

Does anybody know of a solution that uses a PixelBender (GPU-accelerated) method of fading between two movies? My other option is to manually re-order the video objects and change the alpha of the top one, but this uses a lot of CPU (in my case ±300%)...

States:

Transition:

<s:transitions>
    <s:Transition >
        <s:CrossFade id="crossfader" target="{this}" duration="{fadeTime}"  />  
    </s:Transition>
</s:transitions>

Objects:

<components1:VideoDisplay 
                    id="movie_attract" 
                    width="640" x="0" height="480" y="0"

                    source="{configuration.movieAttract.source}"

                    includeIn="attract" 

                    />
<components1:VideoDisplay 
                    id="movie_engage" 
                    left="0" right="0" top="0" bottom="0"

                    source="{configuration.movieEngage.source}"
                    includeIn="engage" 

                    />

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

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

发布评论

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

评论(1

濫情▎り 2025-01-12 09:27:08

我发现使用 Spark Fade(而不是 CrossFade)对我来说效果(和执行)更好。

将 CrossFade 线替换为以下内容应该可行。

<s:Fade id="crossfader" targets="{[ movie_attract, movie_engage ]}" duration="{fadeTime}"  />

免责声明:我尚未使用当前正在播放视频的 VideoDisplay 对此进行测试。但即使对于暂停的视频,Fade 效果的表现也比 CrossFade 好得多。与 CrossFade 不同,淡入淡出很平滑,不生涩。我知道这并不能严格回答您的问题,但您可能想尝试一下。

I have found that using the Spark Fade (not CrossFade) works (and performs) better for me.

Replacing your CrossFade line with the following should work.

<s:Fade id="crossfader" targets="{[ movie_attract, movie_engage ]}" duration="{fadeTime}"  />

Disclaimer: I have not tested this with VideoDisplays that are currently playing a video. But even with paused videos, the Fade effect performed much better than CrossFade. Fade was smooth and not jerky, unlike CrossFade. I know this is not strictly answering your question, but you may want to try it out.

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