PDA

View Full Version : easing rotation to stop at zero MX2004



exographicanhon
May 3rd, 2005, 11:35 PM
I have an MC which is rotating constantly controlled by an onEnterFrame action. Every frame, the MC rotates by the value of outerspinerate.

onClipEvent(enterFrame) {
curr_outer_rot = this._rotation;
this._rotation = curr_outer_rot + _root.dynamo.outerspinrate;
trace(curr_outer_rot);
}

I noticed in the trace that the rotation values in flash are translated into the range of -180 to +180.

I want the MC rotation to slow to a stop at zero _rotation value when certain events become true (it's for a preloader).
I want this to happen gradually over at least half a rotation, so i'm using something like
if (allbytesloaded && theMC._rotation == -174) {
decrease the variable 'outerspinrate' so that 'theMC' slows down gradually to stop at or very near zero _rotation;


I'm rather scatterbrained at devising logic so can someone help me with this? I'm going to be doing this with 3 clips at once, and one of them will be spinning the opposite way, but explaining it once should enable me to finish the rest. thank you!
-andy

freeskier89
May 4th, 2005, 12:11 AM
Hmm... :puzzle: Is there any chance you could post the source? (in MX format) I have some ideas, but the way you have them rotate based on each other kind of puzzles me without actually seeing it. Then hopefully I could be of some assistance.
-freeskier89

Lindquist
May 4th, 2005, 12:09 PM
width=150 height=100
Click on the circles to make them slow down and speed up.

Any questions?

-L

exographicanhon
May 6th, 2005, 10:55 AM
width=150 height=100
Click on the circles to make them slow down and speed up.

Any questions?

-L

thanks for the replies so far.
This code makes the MC slow down to a stop, but

(1)I need the clip to slow down to stop at exactly zero rotation, so that it arrives at the same orientation as it was originally placed on the stage.

(2) I also need the code to work for clockwise (positive) and counterclockwise (negative) rotation directions.

(3) Furthermore, I want the MC to check the remaining amount of rotation left before it arrives at the value zero, and, if it is too close to zero already, to continue past zero and then apply the slowdown.

my current code is far from complete, but it stops only the positive rotation clips, and the negative rotating one goes super fast instead of stopping. and this code slows clips to zero immediately, without attempting my what i want in step (3)

here's my fla
I'm over my head here, but hope soon not to be.
thanks a ton

-andy