summaryrefslogtreecommitdiffstats
path: root/scene/animation/tween.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-08-17 11:28:15 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-08-17 11:28:15 +0200
commitc5a7462a00a665a72c7c1a746c105e3c1c475c96 (patch)
treece818373ca2d7c186298ccc7d58f057fb4ad6a3a /scene/animation/tween.cpp
parentc28cc5d5ebf1be0b7d22eeaa008942b2e97e9ec0 (diff)
parent1660575bd8dbcd6a73ddc361506471e16d8bda11 (diff)
downloadredot-engine-c5a7462a00a665a72c7c1a746c105e3c1c475c96.tar.gz
Merge pull request #80702 from KoBeWi/lagging_animation
Fix initial value with delay in PropertyTweener
Diffstat (limited to 'scene/animation/tween.cpp')
-rw-r--r--scene/animation/tween.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/animation/tween.cpp b/scene/animation/tween.cpp
index b32b04655d..bf01898402 100644
--- a/scene/animation/tween.cpp
+++ b/scene/animation/tween.cpp
@@ -546,8 +546,9 @@ void PropertyTweener::start() {
return;
}
- if (do_continue) {
+ if (do_continue && Math::is_zero_approx(delay)) {
initial_val = target_instance->get_indexed(property);
+ do_continue = false;
}
if (relative) {
@@ -572,6 +573,10 @@ bool PropertyTweener::step(double &r_delta) {
if (elapsed_time < delay) {
r_delta = 0;
return true;
+ } else if (do_continue && !Math::is_zero_approx(delay)) {
+ initial_val = target_instance->get_indexed(property);
+ delta_val = Animation::subtract_variant(final_val, initial_val);
+ do_continue = false;
}
double time = MIN(elapsed_time - delay, duration);