# Various ease in / ease out through functions

Get help using Construct 2

### » Sat Apr 13, 2013 8:31 pm

Easing Equations

or

Robert Penner Easing Equations

and was trying to get the quadratic ease out to work but couldn't figure out a certain section of code marked in bold :

// quadratic easing out - decelerating to zero velocity
Math.easeOutQuad = function (t, b, c, d) {
return -c *(t/=d)*(t-2) + b;
};

How do I translate 't/=d' to C2? I'm basically using trying to move a ball across the screen that eases out to zero velocity.

 I changed the title from 'Quadratic Easing' to 'Various ease in / ease out through functions'. While I was looking for a single form of ease out, the mighty Yann returned many types of ease ins/outs via functions with an excellent capx example file.
bon4ire2013-04-19 14:33:46
B
31
S
6
G
4
Posts: 160
Reputation: 6,003

### » Sat Apr 13, 2013 8:44 pm

t /= d means t = t / d. basically a shortcut for 'set t to t / d'.

It looks like you copied the function over wrong - the t /= d comes in a separate line on the linked website. I don't see why you put it into the algorithm.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,739

### » Sat Apr 13, 2013 8:59 pm

Check out easytween plugin too, has lots of easing functions in easy to use form!
B
24
S
9
G
7
Posts: 756
Reputation: 7,342

### » Sat Apr 13, 2013 9:49 pm

I copied the info from the second link which shows it as being part of the code.

Strange that it's separate in the first link.

B
31
S
6
G
4
Posts: 160
Reputation: 6,003

### » Sat Apr 13, 2013 9:51 pm

[QUOTE=vee41] Check out easytween plugin too, has lots of easing functions in easy to use form![/QUOTE]

Was trying to avoid using a plugin.
B
31
S
6
G
4
Posts: 160
Reputation: 6,003

### » Sat Apr 13, 2013 9:57 pm

A more 'traditional' way to do ease out is to use this formula:

set x to lerp(self.x,destinationx,dt * factor)

same for y.
B
92
S
31
G
24
Posts: 3,191
Reputation: 32,739

### » Sat Apr 13, 2013 10:38 pm

Thanks @sqiddster

I was hoping to create a function sheet collection of ease ins and outs based on Robert Penner's codes and to mimmic the sample screen on the first link.

B
31
S
6
G
4
Posts: 160
Reputation: 6,003

### » Sun Apr 14, 2013 1:58 am

demo
capx

(Though it wouldn't be hard to make a plugin for that)
B
69
S
22
G
14
Posts: 1,488
Reputation: 16,594

### » Sun Apr 14, 2013 2:03 am

Holy smokes @yann that's beautiful!bon4ire2013-04-18 17:56:48
B
31
S
6
G
4
Posts: 160
Reputation: 6,003

### » Sun Apr 14, 2013 2:06 am

Just rewrote the thing as in the first link o.o
B
69
S
22
G
14
Posts: 1,488
Reputation: 16,594

Next