Skip to content

Commit

Permalink
Merge pull request #80702 from KoBeWi/lagging_animation
Browse files Browse the repository at this point in the history
Fix initial value with delay in PropertyTweener
  • Loading branch information
akien-mga committed Aug 17, 2023
2 parents c28cc5d + 1660575 commit c5a7462
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scene/animation/tween.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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);
Expand Down

0 comments on commit c5a7462

Please sign in to comment.