Mar/24
2010

Do you know that you can create cool and realistic effects using the open source Flex SDK? Here is the one that I created to simulate a heart beat with minimal MXML and ActionScript.

A little bit of elasticity and rotation along with the correct timing will bring the heart to life!  Here is the code:

<mx:Script>
<![CDATA[
import mx.effects.easing.*;

private var beatSync:Boolean = true;

private function beatHeart():void {
beatEffect.end();
rotateEffect.end();

//Init the beat effect
beatEffect.xFrom = heart.x;
beatEffect.yFrom = heart.y;

if(beatSync){
//beat it
beatEffect.xTo=beatEffect.xBy=heart.x+1;
beatSync = false;
}
else{
beatEffect.xTo=beatEffect.xBy=heart.x-1;
beatSync = true;
}

beatEffect.play();
rotateEffect.play();
}
]]>
</mx:Script>

<mx:Move id="beatEffect" duration="600" target="{heart}"
easingFunction="Elastic.easeOut" repeatCount="0"/>
<mx:Rotate id="rotateEffect" target="{heart}" duration="700"
angleTo="1" repeatCount="0"/>

Isn't Flex too easy to learn? Get the open source Adobe Flex SDK today!

3 comments
Comment from: nds roms [Visitor] · http://www.nds9.com/
nds romsgood things!
06/02/10 @ 10:57
Comment from: best replica watches [Visitor] · http://www.replica-watchshop.com
best replica watchesI like it .
07/05/10 @ 14:37
Comment from: xdhdf [Visitor] · http://www.topSwissreplica.com
xdhdfdg dfg
08/18/10 @ 07:08
Leave a comment

Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)