PDA

View Full Version : Animating, not knowing where?!?!?!


BraBo
11-20-2006, 07:35 PM
Hi,
I need your help in something I need sorting.
How can I make an animation with an object, if I don't know where it's going to be in the start of the animation, or where it's going to be at it's end?!?!

The beginning it's quite straight forward, just alter the X and Y from the object, and then animate it. But what about the ending point?!

Cheers for the help.

Noct
11-20-2006, 09:03 PM
This might be one of the oddest posts I have ever seen.

Exactly how can you animate something without knowing where it starts or ends?

Unless, are you asking about coding something dynamically?
Like the user inputs the start/end point and your app does the tween?

Or is this one of those philosophical conversations, like the galaxy being just a molecule in some larger particle mass...

peter5
11-21-2006, 10:08 AM
if you are not sure of the start position you could (I am assuming you are trying to do this in AS) move the object relative to its own position.


startPosX = object._x;
startPosY = object._y;

//move the object 100 pixels
object._x = startPosX + 100;

BraBo
11-24-2006, 03:38 PM
Not exactly... That wouldn't do an animation, would just re-position the object.

BraBo
11-24-2006, 03:46 PM
Exactly how can you animate something without knowing where it starts or ends?
But you will know where it will start, and where it will end, you'll just don't know it at "design time".

Unless, are you asking about coding something dynamically?
Like the user inputs the start/end point and your app does the tween?
That is exactly what I mean.
You have a specific object, in which you do an animation, for example.
Object._x=0;
Object._y=0;
Then, the Object moves 100 x units (ex. pixels) forward, being at position:
Object._x=100;
Object._y=0;
You add an animation to the object. "light" out, and "heavy" in, with a motion tween in the middle.

Now, the problem is, I want to do several animations in the same object, in which I will not know the actual position at a certain period of the application, and not know the endind point either.
This meaning that, I want to supply the X and Y vars for the ending position object, and let it animate according to it's current position, using it's predefined animation.