开发者

Can I set an effect's duration as a percentage of its parent's?

开发者 https://www.devze.com 2023-01-16 16:35 出处:网络
When I\'m building an composite animation, I\'d like to specify the components as fractions of the parent, like so:

When I'm building an composite animation, I'd like to specify the components as fractions of the parent, like so:

<s:Sequence id="example" duration="2000">
    <s:Fade alphaFrom="0" alphaTo="1" duration="10%"/>  <!-- not legal -->开发者_开发百科;
    <s:Scale scaleXTo="2" scaleYTo="2"/>
    <s:Fade alphaFrom="1" alphaTo="0" duration="10%"/>
</s:Sequence>

Failing that, I use an expression like so:

<s:Sequence id="example" duration="{slideTime}">
    <s:Fade alphaFrom="0" alphaTo="1"  duration="{slideTime * .1}"/>
    <s:Scale scaleXTo="2" scaleYTo="2" duration="{slideTime * .9}"/>
    <s:Fade alphaFrom="1" alphaTo="0"  duration="{slideTime * .1}"/>
</s:Sequence>

Is there a more declarative way to accomplish this? In the latter case, for instance, can I at least replace the variable slideTime with a direct reference to the parent's duration?

Thanks.


In the latter case, for instance, can I at least replace the variable slideTime with a direct reference to the parent's duration?

Does this work / solve it?:

<s:Sequence id="example" duration="500">
    <s:Fade alphaFrom="0" alphaTo="1"  duration="{example.duration * .1}"/>
    <s:Scale scaleXTo="2" scaleYTo="2" duration="{example.duration * .9}"/>
    <s:Fade alphaFrom="1" alphaTo="0"  duration="{example.duration * .1}"/>
</s:Sequence>
0

精彩评论

暂无评论...
验证码 换一张
取 消