PDA

View Full Version : tweening points



werehunt
August 27th, 2009, 02:50 AM
is this a good approach?

I mean it works as far as I have tested it, but I wonder if its the right approach...
maybe I should do something with this points like making an object out of it, or I dont know, before tweening them :D


var point:Point = new Point(100, 100);

TweenLite.to(point, 1, { x: newWidth, y: newHeight });now before anyone asks why would I do this because there is obviously no visual feedback, I need them for reference...

lewi-p
August 27th, 2009, 07:08 AM
I suppose it's down to personal preference, there are pros & cons to both approaches.



// This method allows you to easily manage your x/y coordinates
// If you were to put all your Point objects into an Array, they'll be easily accessible.
// This method would be best if you had alot of coordinates

import gs.*;

var myPoint:Point = new Point(100, 100);

TweenLite.to(circle_mc, 2, {x:myPoint.x, y:myPoint.y});




// This method would be best if you had 1 or 2 tweens to execute as there is less code

import gs.*;

TweenLite.to(circle_mc, 2, {x:100, y:100});

lewi-p

werehunt
August 27th, 2009, 07:27 AM
I am tweeing the point itself, not some display object.

lewi-p
August 27th, 2009, 07:35 AM
Ah I see, my bad!

Well TweenLite is capable of tweening any numeric property of any object, so no...if I can't see a problem with doing that :)

lewi-p