开发者

How to create Flex Wobble Effect for a component (VBox/HBox etc...)

Can anyone tell me how can we create a wobbling effect using flex 3? I need somet开发者_开发知识库hing like the effect which is show in ubuntu when we see an alert or move a folder.

Thank you.


Not sure if there is anything specifically built in Flex to handle the "wobble" effect specifically, but you can combine the Flex Move and bounce effects to create a kind of "wobble":

<?xml version="1.0"?>

<fx:Declarations>
    <s:Bounce id="bounceEasing"/>
    <s:Elastic id="elasticEasing"/>
    <s:Move id="moveRight" 
        target="{myImage}"
        xBy="500"
        duration="2000"
        easer="{elasticEasing}"/>
    <s:Move id="moveLeft" 
        target="{myImage}"
        xBy="-500"
        duration="2000"
        easer="{bounceEasing}"/>
</fx:Declarations>

<s:Image id="myImage" 
    source="@Embed(source='assets/logo.jpg')"/>
<s:Button label="Move Right"
     x="0" y="100" 
    click="moveRight.end();moveRight.play();"/>
<s:Button label="Move Left" 
     x="0" y="125"
    click="moveLeft.end();moveLeft.play();"/>

Customize the code above to make smaller movements and link the left and right moves, and you have a wobble. You might also decide to add an event listener for the MouseEvent.ROLL_OVER to play the wobble effect when the mouse rolls over the component.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜