PDA

View Full Version : easing in AND out??



Flashmatazz
April 12th, 2003, 06:51 AM
Just wondering,

can anyone point me in a direction as of how to use AS to create movement with easing in AND out?

I was trying to get an mc spin according to the speed of the mouse. So when I move my mouse quickly, the object starts spinning faster and faster, but after reaching it's maximum speed, it slows down again.

Maybe LiB, if your bored again?? :)

Cheers.

ahmed
April 12th, 2003, 07:47 AM
something like this (http://its-just-a-test.i8.com/spinny_thingie.html)?

im not sure if that's what youre looking for, but i attached the source file anyways :)

Flashmatazz
April 12th, 2003, 08:10 AM
That's really great!

I have to dive into it for a while to try and understand what all the AS is doing.
If I have any further questions, can I come back to you about this?

Thanks a lot!

ahmed
April 12th, 2003, 08:17 AM
sure.. only thing is, i came up with it very co-incidentially, i didnt know what was i doing :beam:.. i'll still be able to help ya though :)

Flashmatazz
April 12th, 2003, 08:50 AM
I actually seem to understand the code which makes me happy :)

However, one question: this only uses easing out, right?

I mean, the rotation and moving speed start high and gradually slow down.
But would it be possible to have the speed increase gradually at first as well? (do I make any sense?)

Thanks.

Flashmatazz
April 13th, 2003, 05:28 AM
so...does this mean it isn't possible??

ahmed
April 13th, 2003, 05:31 AM
oh.. sorry.. i didnt notice your previous post, i'll look into it =)

Flashmatazz
April 13th, 2003, 05:33 AM
thanks! :)

ahmed
April 13th, 2003, 05:56 AM
i did it :beam:

Flashmatazz
April 13th, 2003, 06:51 AM
:cool: Thanks a lot Ahmed!

One more thing I'm trying to do now:

if the wheel is speeding up because it's getting to it's target and you move the mouse just a little, the movement is slowed down completely again because of the:



onMouseMove = function() {
num = 100;
}


Still breaking my head on it....

p.s. I hope I'm not being too much of a pain in the b*tt

ahmed
April 13th, 2003, 09:27 PM
use this code instead
num = 100;
onMouseMove = function () {
if (myvariable) {
num = 100;
}
};
// easing factor
/* |||||||||||||||||||||||||||||||||||||||||||||| */
onEnterFrame = function () {
if (num<5) {
num = 4;
myvariable = true;
} else {
num -= 4;
myvariable = false;
}
trace(num);
difference = _xmouse-circle._x;
circle._x += difference/num;
circle._rotation += difference/num;
myText = "Slipperiness: "+(num-4);
pointer._x = _xmouse;
mc = this.createEmptyMovieClip("lines", 1);
with (lines) {
lineStyle(0, 0xFF6600);
moveTo(_root.circle._x, _root.circle._y);
lineTo(_root.pointer._x, _root.pointer._y);
lineStyle(0, 0xFF6600);
moveTo(_root.circle._x, _root.circle._y+4);
lineTo(_root.pointer._x, _root.pointer._y+4);
}
}; It's kind of buggy though :(

Flashmatazz
April 14th, 2003, 07:31 AM
Thanks again. I will try it out when I get back home.