This project is in a trial period, be cautious while contributing. Setup can still change before being approved as a libre project.
Loading…
None
String added in the repository |
Loading…
None
String added in the repository |
If the [code]from[/code] and [code]to[/code] arguments are of type [int] or [float], the return value is a [float].
If both are of the same vector type ([Vector2], [Vector3] or [Color]), the return value will be of the same type ([code]lerp[/code] then calls the vector type's [code]linear_interpolate[/code] method).
[codeblock]
lerp(0, 4, 0.75) # Returns 3.0
lerp(Vector2(1, 5), Vector2(3, 2), 0.5) # Returns Vector2(2, 3.5)
[/codeblock]
See also [method inverse_lerp] which performs the reverse of this operation. To perform eased interpolation with [method lerp], combine it with [method ease] or [method smoothstep].
Se os argumentos [code]from[/code] e [code]to[/code] forem do tipo [int] ou [float], o retorno é um valor do tipo [float].
Se ambos são vetores de mesmo tipo ([Vector2], [Vector3] ou [Color]), o valor retornado será do mesmo tipo ([code]lerp[/code] então chamará o método [code]lerp[/code] do tipo de vetor em questão).
[codeblock]
lerp(0, 4, 0.75) # Retorna 3.0
lerp(Vector2(1, 5), Vector2(3, 2), 0.5) # Retorna Vector2(2, 3.5)
[/codeblock]