summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-02-28 07:02:03 +0100
committerGitHub <noreply@github.com>2020-02-28 07:02:03 +0100
commitec74664af19faf37fbf6bfabdd6d0ff252fa8e0d (patch)
tree19af93850e126486ff379f90634b20f4ff6ddac4 /modules
parentbfd40ba46f3122aeb72609d4896c5399ccad71a1 (diff)
parent6b5573700bdce09fcbe8b64ed6357af560efcd8d (diff)
Merge pull request #36619 from Calinou/doc-improve-inverse-lerp
Improve the `@GDScript.inverse_lerp()` documentation
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/doc_classes/@GDScript.xml12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml
index cf76c09294..d3957c682e 100644
--- a/modules/gdscript/doc_classes/@GDScript.xml
+++ b/modules/gdscript/doc_classes/@GDScript.xml
@@ -481,9 +481,13 @@
<argument index="2" name="weight" type="float">
</argument>
<description>
- Returns a normalized value considering the given range.
+ Returns a normalized value considering the given range. This is the opposite of [method lerp].
[codeblock]
- inverse_lerp(3, 5, 4) # Returns 0.5
+ var middle = lerp(20, 30, 0.75)
+ # `middle` is now 27.5.
+ # Now, we pretend to have forgotten the original ratio and want to get it back.
+ var ratio = inverse_lerp(20, 30, 27.5)
+ # `ratio` is now 0.75.
[/codeblock]
</description>
</method>
@@ -558,7 +562,7 @@
<argument index="2" name="weight" type="float">
</argument>
<description>
- Linearly interpolates between two values by a normalized value.
+ Linearly interpolates between two values by a normalized value. This is the opposite of [method inverse_lerp].
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]
@@ -578,7 +582,7 @@
</argument>
<description>
Linearly interpolates between two angles (in radians) by a normalized value.
- Similar to [method lerp] but interpolate correctly when the angles wrap around [constant @GDScript.TAU].
+ Similar to [method lerp], but interpolates correctly when the angles wrap around [constant @GDScript.TAU].
[codeblock]
extends Sprite
var elapsed = 0.0