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
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

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
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Sat Jan 09, 2010 9:12 pm

Wow - what a nice solution! I thought it would be some crazy math. Thanks!
Moderator
B
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

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,155

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
88
S
32
G
33
Posts: 3,005
Reputation: 27,432

Post » Sun Jan 10, 2010 2:26 am

cosp()
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sun Jan 10, 2010 9:57 am

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

?

Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 1 guest