How do I know when Lerp has ended

Get help using Construct 2

Post » Sat Nov 19, 2016 7:22 am

Hi all!

I have a tween using Lerp (over a 0.5 sec.) and I need it to deactivate when Lerp is finnished. Is there a way to detect when Lerp has ended?

I am currently using a timer, but its not really good practice, I think.

Image


Thanks,
Jan
B
20
S
5
G
1
Posts: 23
Reputation: 1,715

Post » Sat Nov 19, 2016 9:00 am

Actually no because it always dividing the number endlessly before it can reach 1 in factor. But we can put instance variable to iterate the lerp factor an reach value 1: https://dl.dropboxusercontent.com/u/659 ... _lerp.capx
ImageImage
B
105
S
46
G
23
Posts: 778
Reputation: 22,226

Post » Sat Nov 19, 2016 11:07 am

Thanks for the swift reply alextro. I was not able to open the capx though, its made with the 240 beta and I'm running the stable version - but I get the idea.
B
20
S
5
G
1
Posts: 23
Reputation: 1,715

Post » Sat Nov 19, 2016 9:55 pm

Another good reading about lerp by @tulamide.
viewtopic.php?f=162&t=62764&p=538414&hilit=perfect+lerp#p538414

Oh just found the old example that should compatible with your C2 version:
https://dl.dropboxusercontent.com/u/659 ... _lerp.capx

It does easing in & easing out.
ImageImage
B
105
S
46
G
23
Posts: 778
Reputation: 22,226

Post » Sun Nov 20, 2016 5:10 am

Fine example showing a clever use of the Clamp exp. in Lerp. Thanks for showing me that - and the reed about Lerp :-)
B
20
S
5
G
1
Posts: 23
Reputation: 1,715


Return to How do I....?

Who is online

Users browsing this forum: Bootfit, grigrizljac, korbaach and 21 guests