PDA

View Full Version : _rotation



pete_zahut
September 15th, 2003, 05:00 AM
hi,

i know how to use the _rotation on a mc, but how can i let it rotate slowly

onClipEvent(enterFrame) {
rnd = parseInt(Math.random() * 2);
if(rnd == 0) {
this._rotation -= Math.random() * 50;
}
else {
this._rotation += Math.random() * 50;
}
}


this way it only flips to another degree, but you can't see it go round... if you know what i mean ... plz help

APDesign
September 15th, 2003, 05:23 AM
Here is a start, try switching around some variables until you get it to the settings of your choice.

onClipEvent(enterFrame) {
count++;
if(count>10){
rnd = random(2);
count=0;
}
if(rnd == 0) {
this._rotation -= random(10);

}
else {
this._rotation += random(10);

}
}


And here is (what I feel) a better one, it is a lot more smooth..

onClipEvent(load){
rander=3+random(15);
}
onClipEvent(enterFrame) {

count++;
if(count>10){
rander=3+random(15);
rnd = random(2);
count=0;
}
if(rnd == 0) {
this._rotation -= rander;
}
else {
this._rotation += rander;

}
}


I boosted the framerate to 25 FPS, it doesn't add any file size or anything when you export to .swf, so don't worry about it. I've attached a comparison between your way and my way.

pete_zahut
September 15th, 2003, 01:46 PM
Thx, it works just the way i wanted!