Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How do I reverse a lerp like I reverse one in tween?

Asked by
Auxigin 47
4 years ago

So I've made a for loop after the lerp was finished, one for the opening animation for a door, and one for the closing. But the animation that closes it doesn't go as smooth as the first, I've made the two loops have the exact same properties, still doesn't work though...

0
Post your code aquathorn321 858 — 4y

1 answer

Log in to vote
0
Answered by
Fifkee 2017 Community Moderator Moderation Voter
4 years ago

Reverse the for loop incrementors.

for i = 0, 1, 0.1 do
X:Lerp(Y, i)
end

will interpolate forwards.

for i = 1, 0, -0.1 do
X:Lerp(Y, i)
end

will interpolate backwards. Notice how I did -0.1 instead of 0.1.

Ad

Answer this question