Fix Tween loop initial value
This commit is contained in:
parent
d76c1d0e51
commit
20aecefd9b
2 changed files with 9 additions and 5 deletions
|
@ -549,9 +549,12 @@ void PropertyTweener::start() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (do_continue && Math::is_zero_approx(delay)) {
|
if (do_continue) {
|
||||||
initial_val = target_instance->get_indexed(property);
|
if (Math::is_zero_approx(delay)) {
|
||||||
do_continue = false;
|
initial_val = target_instance->get_indexed(property);
|
||||||
|
} else {
|
||||||
|
do_continue_delayed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (relative) {
|
if (relative) {
|
||||||
|
@ -576,10 +579,10 @@ bool PropertyTweener::step(double &r_delta) {
|
||||||
if (elapsed_time < delay) {
|
if (elapsed_time < delay) {
|
||||||
r_delta = 0;
|
r_delta = 0;
|
||||||
return true;
|
return true;
|
||||||
} else if (do_continue && !Math::is_zero_approx(delay)) {
|
} else if (do_continue_delayed && !Math::is_zero_approx(delay)) {
|
||||||
initial_val = target_instance->get_indexed(property);
|
initial_val = target_instance->get_indexed(property);
|
||||||
delta_val = Animation::subtract_variant(final_val, initial_val);
|
delta_val = Animation::subtract_variant(final_val, initial_val);
|
||||||
do_continue = false;
|
do_continue_delayed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
double time = MIN(elapsed_time - delay, duration);
|
double time = MIN(elapsed_time - delay, duration);
|
||||||
|
|
|
@ -225,6 +225,7 @@ private:
|
||||||
|
|
||||||
double delay = 0;
|
double delay = 0;
|
||||||
bool do_continue = true;
|
bool do_continue = true;
|
||||||
|
bool do_continue_delayed = false;
|
||||||
bool relative = false;
|
bool relative = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue