Motion Easing with AS

Hi,
how do i can i adjust the Easing property of moving MC when im moving the MC with AS (not with motion tween) ?!

i got an MC and im increasing it’s _x by 1 till the _x got to 100.
how can i adjust the easing, so that when it become close to 100 it will slowly stopped?

anyone?

Voetsjoeba,

Your golden formula is so beautiful that when I looked upon it, sparrows began landing around me and singing while plum trees blossomed.

Nice work!

lrhb :hat:

Thanks :slight_smile:

Oh, one question…

I used this prototype applied to some object moving along the X axis, and later in the movie I try to move them along the Y axis using tweening, but they don’t go…

Does this somehow hijack the mobility of the object its used on? Or should I make another prototype for the Y axis along these same lines?

Thanks!

lrhb :hat:

That prototype was modified for use with the X axis only. Here’s the prototype that can ease both. You can actually ease any property with this code.


 MovieClip.prototype.ease = function(x,y){
         this.onEnterFrame = function(){
                 this._x = x-(x-this._x)/1.1;
 this._y = y-(y-this._y)/1.1
                 if(this._x > x-1 && this._x < x+1 && this._y > y-1 && this._y < y+1){
 this._x = x;
 this._y = y;
                         delete this.onEnterFrame
                         //do other stuff here, this is the point at which the object reaches its target
                 }
         }
 }
 MC.ease(100,100);
 

Sweet weepin’ Jesus on the cross!

You win!! :slight_smile:

lrhb

Cool, what do I win ? … :stuck_out_tongue:

You’re welcome, mate :wink:

Good sample Industriality Thank you! but someone can tell me how to move an object not on x or y but on [FONT=Arial Black][COLOR=Red]diagonal[/COLOR][/FONT]?

Lobo

:tb: anyone ? help plz

?

MAn… I typed a whole paragraph and then my isp wasn’t working, it got whiped.

I’m going to keep it to main points, so excuse me.

  1. I’m used to mIRC’s scripting language where variables are %variable and identifiers are $identifier, the whole system is a bit different… so I’m not the greatest with action script anymore
  2. I was never good with AS to begin with, all I could really do is work with the basic functions they give you… :sigh:
  3. I want to understand Voetsjoeba’s script better, the MovieClip… is that pertaining to movieclip features by defining so, he put MovieClip. in the beginning? Also… what about the MC.easex at the end, is that “MC” changeable? And where am I putting this code, keyframe? I don’t see any onclipevent’s :confused:

Hey thanks for the reading

to move it on a diagonal you should use x and y, just have both increase proportionately (sp?). Like have x and y both 100 if you’re starting on 0 and it’ll move diagonally

Thank you I will try that ! :beer:

var easeInKnob =
var easeOutKnob =
Was it wrong for me to laugh like a 10-year old schoolboy when I read this?

Maybe it’s just my British sense of humour.