Garry's Mod Wiki

Revision Difference

Global.Lerp#524935

<function name="Lerp" parent="Global" type="libraryfunc"> <description> Performs a linear interpolation from the start number to the end number. This function provides a very efficient and easy way to smooth out movements. <note>This function is not meant to be used with constant value in the first argument, if you're dealing with animation! Use a value that changes over time</note> </description> <realm>Shared and Menu</realm> <file line="236-L243">lua/includes/util.lua</file> <args> <arg name="t" type="number">The fraction for finding the result. This number is clamped between 0 and 1. Sholdn't be a constant.</a rg>⤶ <arg name="t" type="number">The fraction for finding the result. This number is clamped between 0 and 1. Sholdn't be a constant.</arg>⤶ <arg name="from" type="number">The starting number. The result will be equal to this if delta is 0.</arg> <arg name="to" type="number">The ending number. The result will be equal to this if delta is 1.</arg> </args> <rets> <ret name="" type="number">The result of the linear interpolation, (1 - t) * from + t * to.</ret> </rets> </function>