summaryrefslogtreecommitdiff
path: root/doc/classes/@GlobalScope.xml
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2022-08-05 09:54:46 +0200
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-08-05 12:23:23 +0200
commitbd19c9a95cacb3a5ff3ed0f14e3290313c78f9a0 (patch)
tree4d1b3c70e40f715fa561908d906da3ce1625811c /doc/classes/@GlobalScope.xml
parent1afc83d0a7e3bae666a102e634ea2c8e5a4beb46 (diff)
Improve `range_lerp()` and related methods documentation
Diffstat (limited to 'doc/classes/@GlobalScope.xml')
-rw-r--r--doc/classes/@GlobalScope.xml11
1 files changed, 6 insertions, 5 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml
index d647621362..4a16244235 100644
--- a/doc/classes/@GlobalScope.xml
+++ b/doc/classes/@GlobalScope.xml
@@ -380,7 +380,7 @@
<argument index="1" name="to" type="float" />
<argument index="2" name="weight" type="float" />
<description>
- Returns an interpolation or extrapolation factor considering the range specified in [code]from[/code] and [code]to[/code], and the interpolated value specified in [code]weight[/code]. The returned value will be between [code]0.0[/code] and [code]1.0[/code] if [code]weight[/code] is between [code]from[/code] and [code]to[/code] (inclusive). If [code]weight[/code] is located outside this range, then an extrapolation factor will be returned (return value lower than [code]0.0[/code] or greater than [code]1.0[/code]).
+ Returns an interpolation or extrapolation factor considering the range specified in [code]from[/code] and [code]to[/code], and the interpolated value specified in [code]weight[/code]. The returned value will be between [code]0.0[/code] and [code]1.0[/code] if [code]weight[/code] is between [code]from[/code] and [code]to[/code] (inclusive). If [code]weight[/code] is located outside this range, then an extrapolation factor will be returned (return value lower than [code]0.0[/code] or greater than [code]1.0[/code]). Use [method clamp] on the result of [method inverse_lerp] if this is not desired.
[codeblock]
# The interpolation ratio in the `lerp()` call below is 0.75.
var middle = lerp(20, 30, 0.75)
@@ -389,7 +389,7 @@
var ratio = inverse_lerp(20, 30, 27.5)
# `ratio` is now 0.75.
[/codeblock]
- See also [method lerp] which performs the reverse of this operation.
+ See also [method lerp] which performs the reverse of this operation, and [method range_lerp] to map a continuous series of values to another.
</description>
</method>
<method name="is_equal_approx">
@@ -444,11 +444,11 @@
<argument index="1" name="to" type="float" />
<argument index="2" name="weight" type="float" />
<description>
- Linearly interpolates between two values by the factor defined in [code]weight[/code]. To perform interpolation, [code]weight[/code] should be between [code]0.0[/code] and [code]1.0[/code] (inclusive). However, values outside this range are allowed and can be used to perform [i]extrapolation[/i].
+ Linearly interpolates between two values by the factor defined in [code]weight[/code]. To perform interpolation, [code]weight[/code] should be between [code]0.0[/code] and [code]1.0[/code] (inclusive). However, values outside this range are allowed and can be used to perform [i]extrapolation[/i]. Use [method clamp] on the result of [method lerp] if this is not desired.
[codeblock]
lerp(0, 4, 0.75) # Returns 3.0
[/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].
+ 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]. See also [method range_lerp] to map a continuous series of values to another.
</description>
</method>
<method name="lerp_angle">
@@ -807,10 +807,11 @@
<argument index="3" name="ostart" type="float" />
<argument index="4" name="ostop" type="float" />
<description>
- Maps a [code]value[/code] from range [code][istart, istop][/code] to [code][ostart, ostop][/code].
+ Maps a [code]value[/code] from range [code][istart, istop][/code] to [code][ostart, ostop][/code]. See also [method lerp] and [method inverse_lerp]. If [code]value[/code] is outside [code][istart, istop][/code], then the resulting value will also be outside [code][ostart, ostop][/code]. Use [method clamp] on the result of [method range_lerp] if this is not desired.
[codeblock]
range_lerp(75, 0, 100, -1, 1) # Returns 0.5
[/codeblock]
+ For complex use cases where you need multiple ranges, consider using [Curve] or [Gradient] instead.
</description>
</method>
<method name="rid_allocate_id">