From 6694c119d069d8ff8dc5290d38d2d33625f07807 Mon Sep 17 00:00:00 2001 From: Chaosus Date: Sun, 14 Jul 2019 07:30:45 +0300 Subject: Added lerp_angles built-in function Co-authored-by: Xrayez Co-authored-by: DleanJeans --- modules/gdscript/doc_classes/@GDScript.xml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'modules/gdscript/doc_classes') diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index a21b6a2907..2a26df4714 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -604,6 +604,29 @@ [/codeblock] + + + + + + + + + + + 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]. + [codeblock] + extends Sprite + var elapsed = 0.0 + func _process(delta): + var min_angle = deg2rad(0.0) + var max_angle = deg2rad(90.0) + rotation = lerp_angle(min_angle, max_angle, elapsed) + elapsed += delta + [/codeblock] + + -- cgit v1.2.3