我应该如何在 flex/flashbuilder 中平滑这两种状态之间的过渡

发布于 2024-10-15 07:48:34 字数 1260 浏览 1 评论 0 原文

我有一个项目有两种状态,最好描述为打开和关闭,它们看起来像这样:

< img src="https://i.sstatic.net/HvtxC.png" alt="open">

我想做的是通过在两种状态之间进行插值来平滑一种状态和另一种状态之间的过渡以平滑的方式(正弦)移动页脚/按钮块,然后在饼图中淡入淡出。

然而,这显然超出了我的能力范围,在与我无法做到这一点搏斗了一个小时之后,我将其发布在这里:D

因此,我的转换块如下所示

<s:transitions>
    <s:Transition id="TrayTrans" fromState="*" toState="*">
        <s:Sequence>
            <s:Move duration="400" target="{footer}" interpolator="{Sine}"/>
            <s:Fade duration="300" targets="{body}"/>   
        </s:Sequence>       
    </s:Transition>

    <s:Transition>
        <s:Rotate duration="3000" />
    </s:Transition>
</s:transitions> 

,其中 {body} 指的是饼图, {footer} 指页脚/按钮块。

然而,这不起作用,所以我真的不知道该怎么做...

可能有益的附加信息:

主体块始终具有固定高度(也许在某些效果中用于 Xby 变量?)。

它需要在两个方向上发挥作用。

哦,Sine 块在上面的声明中定义为

此外!我将如何使用这些转换块将饼图设置为连续旋转? (这会在没有标签的情况下发生)或者这是错误的处理方式,因为它本身不是一个过渡?

我想要的效果是,在选择下面的按钮之前,饼图在没有标签的情况下缓慢旋转,但在选择时旋转停止并出现标签...

提前非常感谢!

对灰度表示歉意,但我无法真正决定配色方案。欢迎任何建议。

I have an item in which has two states, best described as open and closed, and they look like this:

closed

and

open

And what I'd like to do is is smooth the transition between one state and the other, effectively by interpolating between the two points in a smooth manner (sine) to move the footer/button-block and then fade in the pie chart.

However this is apparently beyond me and after wrestling with my inability to do so for an hour+ I'm posting it here :D

So my transition block looks as follows

<s:transitions>
    <s:Transition id="TrayTrans" fromState="*" toState="*">
        <s:Sequence>
            <s:Move duration="400" target="{footer}" interpolator="{Sine}"/>
            <s:Fade duration="300" targets="{body}"/>   
        </s:Sequence>       
    </s:Transition>

    <s:Transition>
        <s:Rotate duration="3000" />
    </s:Transition>
</s:transitions> 

where {body} refers to the pie chart and {footer} refers to the footer/button-block.

However this doesn't work so I don't really know what to do...

Additional information which may be beneficial:

The body block is always of fixed height (perhaps of use for the Xby variables in some effects?).

It needs to work in both directions.

Oh and the Sine block is defined above in declarations just as <s:Sine id="Sine">.

Additionally! How would I go about setting the pie chart to rotate continually using these transition blocks? (this would occur without the labels on) Or is that the wrong way to go about it as it's not a transition as such?

The effect I'm after is one where the pie chart rotates slowly without labels prior to a selection of a button below, but on selection the rotation stops and labels appear...

Thanks a lot in advance!

And apologies on greyscale, but I can't really decide on a colour scheme. Any suggestions welcome.

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

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

发布评论

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

评论(2

杀手六號 2024-10-22 07:48:35

如果您不介意进行一些动作脚本编码,那么使用 as3 函数这将变得非常容易。

您需要执行以下操作:

public function doTransition():void
        {
            var move:Move= new Move();
            move.target=footer;
            move.yFrom = 0;//current position
            move.yTo = 400;//or whatever is the final position of the footer
            move.duration=500;//duration in milliseconds

            var resize:Resize=new Resize();
            resize.target=body;
            resize.heightFrom=0;//or whatever is initial height
            resize.heightTo=400;//or whatver is the final height
            resize.duration=500;

            var fadeIn:Fade =new Fade();
            fadeIn.target = pieChart;//the id of the piechart
            fadeIn.alphaFrom =0;
            fadeIn.alphaTo = 1;
            fadeIn.duration =500;

            move.play();
            resize.play();
            fadeIn.play();
        }

完成此操作后,您将需要代码来旋转饼图。
为此,您可以使用计时器和旋转变换。

If you dont mind doing some actionscript coding, this becomes pretty easy with an as3 function.

You would need to do the following:

public function doTransition():void
        {
            var move:Move= new Move();
            move.target=footer;
            move.yFrom = 0;//current position
            move.yTo = 400;//or whatever is the final position of the footer
            move.duration=500;//duration in milliseconds

            var resize:Resize=new Resize();
            resize.target=body;
            resize.heightFrom=0;//or whatever is initial height
            resize.heightTo=400;//or whatver is the final height
            resize.duration=500;

            var fadeIn:Fade =new Fade();
            fadeIn.target = pieChart;//the id of the piechart
            fadeIn.alphaFrom =0;
            fadeIn.alphaTo = 1;
            fadeIn.duration =500;

            move.play();
            resize.play();
            fadeIn.play();
        }

This done, you would need code to rotate the pie chart.
For that you can use timers and rotation transformations.

温折酒 2024-10-22 07:48:35

为了使补间更容易,我建议使用 TweenLite 来完成这项工作。您最终会编写更少的动作脚本。

To make your tweening easier, I'd recommend using TweenLite to get the job done. You'll end up writing less actionscript.

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