Math for ease in/out?

For questions about using Classic.

» Sat Jan 09, 2010 8:55 pm

I want to use lerp to move from point a to b - but it results in instant accelleration/deceleration. I want to have something accellerated smoothly until 50% of larp and decellerate smoothly to 100%. Anyone know the math for this?
Moderator
B
96
S
34
G
33
Posts: 3,007
Reputation: 27,911

» Sat Jan 09, 2010 9:04 pm

The way I achieve this is by using Cubic(a, b, c, d, x) instead of Lerp(a, b, x). Just set "a" and "b" in Cubic to what you set "a" to in Lerp and "c" and "d" to what you set "b" to and you should get the smooth movement you want. So basically:

Cubic(a, a, b, b, x).

I hope I explained that well enough.
Moderator
B
114
S
41
G
20
Posts: 1,586
Reputation: 19,161

» Sat Jan 09, 2010 9:12 pm

Wow - what a nice solution! I thought it would be some crazy math. Thanks!
Moderator
B
96
S
34
G
33
Posts: 3,007
Reputation: 27,911

» Sat Jan 09, 2010 9:42 pm

Or Cosine. It only needs two points.
B
62
S
21
G
13
Posts: 1,910
Reputation: 13,685

» Sat Jan 09, 2010 10:40 pm

...

I really shouldn't be surprised anymore when I find out construct already has something built in. Yet it keeps surprising me. Awesome!
Moderator
B
96
S
34
G
33
Posts: 3,007
Reputation: 27,911

» Sun Jan 10, 2010 2:26 am

cosp()
B
49
S
10
G
9
Posts: 1,224
Reputation: 8,480

» Sun Jan 10, 2010 9:57 am

[quote="Davioware":3da4l6re]cosp()[/quote:3da4l6re]

?

Spriter Dev
B
103
S
22
G
12
Posts: 3,283
Reputation: 17,147

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest