PDA

View Full Version : scripting tweens with...



jondj24
October 10th, 2003, 04:51 PM
i realize how to script a tween:



onClipEvent (enterFrame) {
speed = 80;
this._x += speed;
}


but how do you add, eases and stops?

help me please,
jonathan

mlk
October 10th, 2003, 05:48 PM
well you've got to add a variable that will incremment, dcrement:


onClipEvent(enterFrame){
// the increment variable was declared before)
_root.incrementvariable *= 1.05
this._x += speed*80*_root.incrementvariable
}

would create a movement to the right with more and more speed...
YOu could do it wiht *=0.95 and then set a if...incrementvariable <= 0.3 then this.stop() or sometihng like that...

kode
October 10th, 2003, 06:41 PM
http://www.robertpenner.com/easing/

Voetsjoeba
October 11th, 2003, 03:13 AM
MovieClip.prototype.easeX = function(tX){
this.onEnterFrame = function(){
this._x >= tX-1 && this._x <= tX+1 ? delete this.onEnterFrame : this._x = tX-(tX-this._x)/1.2;
}
}
// To call the ease to an X position of 500 for example.
yourmc.easeX(500);