Flash rotation Q
- Started
- Last post
- 33 Responses
- gabe0
try doing the math as you ordinarily do, by just adding to the _rotation.
say newRotation is the variable that handles the _rotation of the object. put this in your loop...
if( newRotation 360 )
{
newRotation -= 360;
}
- jkosoy0
a small note on performance, 4cY:
instead of just getting the rotation as you're doing, round it off to the nearest tenth. this is two or three more lines of code and your users will never see the difference.
right now when i input an angle, the onEnterFrame never stops because we never exactly equal to newangle.
this doesn't resolve your issue, but it will make this project of yours world's less processor intensive.
- jkosoy0
I posted on flashcoders about this. I'm certain we'll have an answer sooner or later. :)
- ********0
gabe, the trouble is at 180.. not 360 and i don't think that'll give me the desired effect...
i'll await the other forums result here!!
THX a bunch y'all so far.
(on a side note: i hardly ever do AS so be nice to my AS-n00bness.. :) )
- gabe0
here you go... did this test for you
www.wrecked.nu/rotationTest.fla
www.wrecked.nu/rotationTest.swf
- ********0
THX, Gabe!
i'll need to relink so i can rightclick and save..:
http://www.wrecked.nu/rotationTe…
http://www.wrecked.nu/rotationTe…will try now!
- ********0
hmm.. not good still. :/
for some reason i cannot kill the loop & the addition of a new rotation, as in the first rotation was 0 and the next is 40 and the next is 20 equals to 04020 instead of 60..
i tried to change a few things but came to the harsh and infinitly sad conlcusion that i suck at AS. :(
thx tho!
any other takers?
- gabe0
i'm not sure what you mean?
in my FLA, all you have to do is add to newRotation. so if you want the needle to spin clockwise to 9:00, say:
newRotation = newRotation + 270
newRotation starts off at 0, then you just add to it. i'm putting up a new FLA with a slower intertia so you can see what i mean...
- gabe0
- ********0
cool.. might use it!
have to run now, will dive into your code when I am back!
thx a bunch, Gabe!!
- gabe0
ok, set it all up for you per your original request...
http://www.wrecked.nu/NT/rotatio…
http://www.wrecked.nu/NT/rotatio…
- ********0
THX, gabe! that seems to be what i was looking for!
i'll let you know when the final piece is up!
gotta go out for some serious daily cycling now.. later!
- gabe0
no prob