# Penner Equation Need Help!

**URL:** https://forum.kirupa.com/t/penner-equation-need-help/22400
**Category:** Uncategorized
**Created:** [June 3, 2003, 6:36pm UTC](https://forum.kirupa.com/t/penner-equation-need-help/22400 "2003-06-03T18:36:20Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Obelisk](https://avatars.discourse-cdn.com/v4/letter/o/f475e1/32.png) [@Obelisk](https://forum.kirupa.com/u/Obelisk)
#### Post date: [June 3, 2003, 6:36pm UTC](https://forum.kirupa.com/t/penner-equation-need-help/22400/1 "2003-06-03T18:36:20Z")

</div>

I am trying to implement a penner equation. Want my menu to ease int its position. However I am having no luck.

Here is the Penner equation and my implementation try.

[AS]

// IMMEDIATELY BELOW IS MY IMPLEMENTATION  
MovieClip.prototype.linearTween2 = function(endx, endy, duration, startingx, startingy) {  
var t;  
this.onEnterFrame = function() {  
if (t++\<duration) {  
var x = Math.abs(endx-startingx) \* ((t = t/duration-1)_t_((s+1)\*t+s)+1)+ startingx, y = Math.abs(endy-startingy) \* ((t = t/duration-1)_t_((s+1)\*t+s)+1)+ startingy;

```
                    this._x += x;
                    //this._y += y;
            } else {
                    delete this.onEnterFrame;
            }
    }

```

}

// BELOW IS THE PENNER EQUATION

// back easing out - moving towards target, overshooting it slightly, then reversing and coming back to target  
// back easing in - backtracking slightly, then reversing direction and moving to target  
// t: current time, b: beginning value, c: change in value, d: duration, s: overshoot amount (optional)  
// t and d can be in frames or seconds/milliseconds  
// s controls the amount of overshoot: higher s means greater overshoot  
// s has a default value of 1.70158, which produces an overshoot of 10 percent  
// s==0 produces cubic easing with no overshoot  
Math.easeOutBack = function (t, b, c, d, s) {  
if (s == undefined) s = 1.70158;  
return c\*((t=t/d-1)_t_((s+1)\*t + s) + 1) + b;  
}

[/AS]

---

<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: [June 3, 2003, 8:45pm UTC](https://forum.kirupa.com/t/penner-equation-need-help/22400/2 "2003-06-03T20:45:20Z")

</div>

bump!

---

<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: [June 3, 2003, 9:23pm UTC](https://forum.kirupa.com/t/penner-equation-need-help/22400/3 "2003-06-03T21:23:27Z")

</div>

If you just want it to ease to a location why don’t you just use a basic easing equation?

[http://www.kirupa.com/developer/mx/followease.htm](http://www.kirupa.com/developer/mx/followease.htm)  
[http://www.kirupa.com/developer/mx/easing\_mouseclick.htm](http://www.kirupa.com/developer/mx/easing_mouseclick.htm)

---

<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: [June 3, 2003, 9:24pm UTC](https://forum.kirupa.com/t/penner-equation-need-help/22400/4 "2003-06-03T21:24:44Z")

</div>

Oh and…

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

---

<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: [June 3, 2003, 10:32pm UTC](https://forum.kirupa.com/t/penner-equation-need-help/22400/5 "2003-06-03T22:32:40Z")

</div>

Well trying to get the tweening to go past the target area and come back. this can be done with the Penner Equation. Since this is one of his more difficult ones, I think once i have mastered it i will be able to apply other equations.
