Skip to content

Commit c5a7462

Browse files
committed
Merge pull request #80702 from KoBeWi/lagging_animation
Fix initial value with delay in PropertyTweener
2 parents c28cc5d + 1660575 commit c5a7462

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

scene/animation/tween.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,8 +546,9 @@ void PropertyTweener::start() {
546546
return;
547547
}
548548

549-
if (do_continue) {
549+
if (do_continue && Math::is_zero_approx(delay)) {
550550
initial_val = target_instance->get_indexed(property);
551+
do_continue = false;
551552
}
552553

553554
if (relative) {
@@ -572,6 +573,10 @@ bool PropertyTweener::step(double &r_delta) {
572573
if (elapsed_time < delay) {
573574
r_delta = 0;
574575
return true;
576+
} else if (do_continue && !Math::is_zero_approx(delay)) {
577+
initial_val = target_instance->get_indexed(property);
578+
delta_val = Animation::subtract_variant(final_val, initial_val);
579+
do_continue = false;
575580
}
576581

577582
double time = MIN(elapsed_time - delay, duration);

0 commit comments

Comments
 (0)