I have been trying to find examples on how to draw shapes and lines using TweenMax, and haven't been able to find any.
So I thought I might not be the only one needing some expert advice on this subject.
I found my own way drawing a simple retangle, where each sideline get's animated using the onUpdate:Function, so you actually see the retangle being drawed.
My problem is though, that my method seems to be a little unstabil especially when I speed up the drawing.
Question:
Is there an easier/better way to draw lines and shapes with TweenMax than my example below?
// CODE ====================
import fl.motion.easing.*;
import flash.display.*;
import gs.TweenMax;
import gs.easing.*;
var line:Shape = new Shape();
line.graphics.lineStyle(10, 0xFFD700, 1, false, LineScaleMode.VERTICAL, CapsStyle.NONE, JointStyle.MITER, 10);
this.addChild(line); line.x = 50; line.y = 50;
var Drawer:Sprite = new Sprite(); this.addChild(Drawer);
TweenMax.to(Drawer, 0.1, { delay: 0, x:200, ease:Quadratic.easeOut, onUpdate:drawLine });
TweenMax.to(Drawer, 0.1, { delay: 0.1, y:100, ease:Quadratic.easeOut, onUpdate:drawLine });
TweenMax.to(Drawer, 0.1, { delay: 0.2, x:0, ease:Quadratic.easeOut, onUpdate:drawLine });
TweenMax.to(Drawer, 0.1, { delay: 0.3, y:0, ease:Quadratic.easeOut, onUpdate:drawLine });
function drawLine() {
var X:int = Drawer.x;
var Y:int = Drawer.y;
line.graphics.lineTo(X, Y);
}
// END CODE ====================