LERP: Difference between revisions

From Fancade Wiki
(Updated the page. TODO: update the explanation.)
(Removed the TODO)
 
Line 13: Line 13:


See also: [[Linear Interpolation]]
See also: [[Linear Interpolation]]
<!--
TODO: Move the entire sectiont to the Linear Interpolation script page
== Example ==
The most common use case is to smoothly transition from one rotation to another.
[[File:Screenshot_2023_0708_202522.png]]
Every frame, the block rotates 5% (0.05) of the way from its initial rotation (0°) towards its goal (90°). Note that it doesn't rotate on a constant speed, but it eases out/slows down until it comes to a stop at its goal, it's because by every frame, the From input changes itself to be the block's current rotation, which means the distance between From and To gets smaller, therefore 5% of the way towards its goal is smaller than what it was in the previous frames.
Currently, there is only a LERP for rotation values, but if you want make one for numbers or vectors:
[[File:Screenshot_2023_0708_202730.png]]
-->


[[Category:Blocks]]
[[Category:Blocks]]

Latest revision as of 20:43, 30 May 2024

LERP
LERP.png
TypeScript block
ColliderNone
FolderMath
Ports
Inputs From
To
Amount
Outputs Rotation

Linear Interpolation (LERP) returns a rotation between From and To at a point of linear scale specified by the Amount.

Rotation = From + (To - From) × Amount

See also: Linear Interpolation