Math for ease in/out?

For questions about using Classic.

Post » 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
95
S
34
G
33
Posts: 3,006
Reputation: 27,874

Post » 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. :P
Moderator
B
113
S
41
G
20
Posts: 1,586
Reputation: 19,116

Post » Sat Jan 09, 2010 9:12 pm

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

Post » Sat Jan 09, 2010 9:42 pm

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

Post » 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
95
S
34
G
33
Posts: 3,006
Reputation: 27,874

Post » Sun Jan 10, 2010 2:26 am

cosp()
B
48
S
10
G
9
Posts: 1,224
Reputation: 8,449

Post » Sun Jan 10, 2010 9:57 am

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

?

Spriter Dev
B
99
S
21
G
12
Posts: 3,259
Reputation: 16,894


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests