我在发送请求时试图为图像设置动画,然后在收到响应时停止旋转该图像,但我遇到了动画问题。
这是我到目前为止所做的:
<s:Sequence id="requestAnimation" repeatCount="0">
<s:Parallel>
<s:Fade alphaFrom="1" alphaTo="0" target="{busyLogo}" duration="250" />
<s:Fade alphaFrom="0" alphaTo="1" target="{cornerLogo}" duration="250" />
</s:Parallel>
<s:Sequence repeatCount="0">
<s:Rotate3D angleZFrom="0"
angleZTo="360"
autoCenterProjection="true"
autoCenterTransform="true"
duration="1000"
target="{busyLogo}" />
</s:Sequence>
</s:Sequence>
图像旋转,当它到达完整旋转结束时,减速停止然后再次启动。我希望它在一个连续循环中旋转。
答案 0 :(得分:1)
首先,我想知道您的busyLogo如何使用此代码完全旋转,因为在主序列中,您首先将busyLogo上的alpha淡出为0并在cornerLogo中淡出。它应该是另一种方式 - 你应该淡入busyLogo然后旋转它?
但主要问题似乎是主序列上的repeatCount =“0”将无限期地播放整个序列(淡出和旋转)。如果你删除主序列上的repeatCount =“0”,它会淡出然后停在第二个序列,它将使用它的repeatCount =“0”无限地旋转徽标
确保在完成后停止两个顺序以避免内存泄漏。
答案 1 :(得分:0)
设置Rotate3D效果使用的缓冲区。默认值为Sine,这会导致减速和加速。如果您想使其保持不变,请将其更改为spark.effects.easing.Linear
。
答案 2 :(得分:0)
我现在有以下内容。这似乎有效,但动画并不像我希望的那样顺畅。可能尝试进行发布构建,看看是否更好或为图像添加平滑。
<s:Parallel id="requestAnimation" >
<s:Fade alphaFrom="0" alphaTo="1" target="{busyLogo}" duration="250" />
<s:Sequence suspendBackgroundProcessing="true" repeatCount="0">
<s:Rotate3D angleZFrom="0"
angleZTo="360"
easer="{new Linear(0,0)}"
autoCenterProjection="true"
autoCenterTransform="true"
duration="1000"
target="{busyLogo}" />
</s:Sequence>
</s:Parallel>
<s:Sequence id="fadeOutRequest" effectEnd="requestAnimation.end()">
<mx:AnimateProperty property="alpha" fromValue="1" toValue="0" target="{busyLogo}" duration="1050" />
</s:Sequence>
<s:Image id="mainLogo" x="0" y="0" width="128" height="128" source="{logo256}"
rollOver="{requestAnimation.play()}" rollOut="{fadeOutRequest.play()}"
alpha="0"/>
<s:BitmapImage id="logo4" x="32" y="32" source="{logo64}"/>