quick flash rotate ??
- Started
- Last post
- 10 Responses
- unknown
what code do I put on a MC to make it rotate constantly, I want to have control over speed and direction. (I dont want to tween)
cheers :)
- autonoma0
_rotate += 1;
- unfittoprint0
this.onEnterFrame(){
this.movieAng += (this.targetAng-this.movieAng)/n...
this._rotation = this.movieAng;
}change n for the desired rotation velocity (2 to 10 advisable)
just tell the movie the targetAng for the desired rotation...
- unknown0
cheers!
- autonoma0
Rasko -
I would never recommend using an onEnterFrame loop unless it's contained in an if statement. You really don't want an onEnterFrame loop constantly looping.
- unknown0
so please expand on your technique.. bear in mind I'm a code leper heheh
- autonoma0
Well, do you want your clip to be rotating non-stop, or only at certain times?
- unknown0
yeah, rotating constantly, I want to make a kind of kaleidescope thing with many instances of the same clip.
- autonoma0
Well then you'll probably have to do it with an onEnterFrame loop if you want it going constantly. Macromedia actually suggests using a three-frame loop instead, but you won't get it too smooth that way.
Just place this on the clip:
onClipEvent (enterFrame) {
this._rotation += 18;
}Change the + to a - if you want it to go in the opposite direction, and change the '18' to alter the speed.
With a number of clips looping like that, you shouldn't have too much else going on in the file or it will bog it down drastically. Also, you may not want to make the "kaleidescope thing" too terribly large, or the same will happen.
Good luck.
- unknown0
cheers, that'll do fine - its just for a small file I need - nothing else going on so I think it'll be fine :)
- unfittoprint0
changing _x,_y and ang parameters on an enterFrame are not processor heavy tasks ( changing mc's _alpha is).
three frame loop and ClipEvent are 'oldschool' actionscript... why not write the stuff in a nice single frame.
and the AS I posted allows you to give whatever ang and velocity you want ...