hi Everyone,
I have a requirement in my flash which i am unable to solve.I have two points and i want to give a parabolic movement to a movieclip when the movieclip moves from one point to another point.I have to do this using actionscript.
I have tried out many things but no success.
Can anybody provide me with a simple example
Thanks in advance
With Regards
Deepthi
Is this close to what you’re looking for?
[COLOR=“Blue”]http://www.byrographics.com/AS3/parabolic/parabolic.html[/COLOR]
The blue dot is math authored by TheCanadian in a similar post.
The orange dot is a simple TweenMax bezier tween.
stop();
import gs.TweenMax;
import fl.motion.easing.*;
import flash.events.Event;
//Snick: parabolic-orange dot
function forward():void {
TweenMax.to(mc, 1.2, {x:550, y:0, bezierThrough:[{x:275, y:200}], onComplete:backward, ease:Quadratic.easeInOut});
}
function backward():void {
TweenMax.to(mc, 1.2, {x:0, y:0, bezierThrough:[{x:275, y:200}], onComplete:forward, ease:Quadratic.easeInOut});
}
forward();
//TheCanadian: parabolic-blue dot
mc2.x = 0;
function move(evt:Event):void {
//parabola with zeros at 0 and 550 and stretching to 200
//negative because Flash's y axis is reversed
mc2.y = -0.002644 * Math.pow(((mc2.x += 3) - 275), 2) + 200;
}
mc2.addEventListener(Event.ENTER_FRAME, move);