# Tweening?

**URL:** <https://forum.kirupa.com/t/tweening/38705>\
**Category:** Uncategorized\
**Created:** [December 28, 2003, 5:24pm UTC](https://forum.kirupa.com/t/tweening/38705 "2003-12-28T17:24:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![iceman](https://avatars.discourse-cdn.com/v4/letter/i/46a35a/32.png) [@iceman](https://forum.kirupa.com/u/iceman)\
**Post date:** [December 28, 2003, 5:24pm UTC](https://forum.kirupa.com/t/tweening/38705/1 "2003-12-28T17:24:28Z")

</div>

Hi everyone,

I was wondering if anyone could aid me in understanding how to apply this code to an actual movieclip and have it move.  
[AS]Math.linearTween = function (t, b, c, d) {  
return c\*t/d + b;  
};[/AS]

Thanks A Lot

Kyle:thumb:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 28, 2003, 11:07pm UTC](https://forum.kirupa.com/t/tweening/38705/2 "2003-12-28T23:07:38Z")

</div>

[http://www.kirupaforum.com/forums/showthread.php?s=&threadid=23766&highlight=robert+penner](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=23766&highlight=robert+penner)

Robert Penner’s easing equations can be tricky 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 29, 2003, 5:23am UTC](https://forum.kirupa.com/t/tweening/38705/3 "2003-12-29T05:23:23Z")

</div>

Thanks A Lot Ilyas, I have another question concerning the code form that post.  
[AS] MovieClip.prototype.linearTween = function(endx, endy, duration) {  
var x = (endx-this.\_x)/duration, y = (endy-this.\_y)/duration, t;  
this.onEnterFrame = function() {  
if (t++ \<duration) {  
this.\_x += x;  
this.\_y += y;  
} else {  
delete this.onEnterFrame;  
}  
};  
};  
ball\_mc.linearTween(400, 0, 50);[/AS]  
In the line:  
[AS]if (t++ \<duration) {[/AS]  
If I remove ++ the tweening continues and doesn’t stop and even if I [AS]trace(t)[/AS] it is outputed as [AS]undefined[/AS] so I was wondering why the significant difference.

Thanks again

Kyle:p:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [December 30, 2003, 4:15pm UTC](https://forum.kirupa.com/t/tweening/38705/4 "2003-12-30T16:15:05Z")

</div>

anyone?
