Allow slowing down Animations::Simple globally.
This commit is contained in:
parent
ba27a017f8
commit
d7b3a68351
3 changed files with 14 additions and 1 deletions
|
|
@ -14,6 +14,7 @@ namespace anim {
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
rpl::variable<bool> AnimationsDisabled = false;
|
rpl::variable<bool> AnimationsDisabled = false;
|
||||||
|
int SlowMultiplierMinusOne/* = 0*/;
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
|
@ -76,6 +77,16 @@ void SetDisabled(bool disabled) {
|
||||||
AnimationsDisabled = disabled;
|
AnimationsDisabled = disabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SlowMultiplier() {
|
||||||
|
return (SlowMultiplierMinusOne + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SetSlowMultiplier(int multiplier) {
|
||||||
|
Expects(multiplier > 0);
|
||||||
|
|
||||||
|
SlowMultiplierMinusOne = multiplier - 1;
|
||||||
|
}
|
||||||
|
|
||||||
void DrawStaticLoading(
|
void DrawStaticLoading(
|
||||||
QPainter &p,
|
QPainter &p,
|
||||||
QRectF rect,
|
QRectF rect,
|
||||||
|
|
|
||||||
|
|
@ -351,6 +351,8 @@ QPainterPath path(QPointF (&from)[N]) {
|
||||||
rpl::producer<bool> Disables();
|
rpl::producer<bool> Disables();
|
||||||
bool Disabled();
|
bool Disabled();
|
||||||
void SetDisabled(bool disabled);
|
void SetDisabled(bool disabled);
|
||||||
|
int SlowMultiplier();
|
||||||
|
void SetSlowMultiplier(int multiplier); // 1 - default, 10 - slow x10.
|
||||||
|
|
||||||
void DrawStaticLoading(
|
void DrawStaticLoading(
|
||||||
QPainter &p,
|
QPainter &p,
|
||||||
|
|
|
||||||
|
|
@ -410,7 +410,7 @@ inline void Simple::startPrepared(
|
||||||
anim::transition transition) {
|
anim::transition transition) {
|
||||||
_data->from = _data->value;
|
_data->from = _data->value;
|
||||||
_data->delta = to - _data->from;
|
_data->delta = to - _data->from;
|
||||||
_data->duration = duration;
|
_data->duration = duration * anim::SlowMultiplier();
|
||||||
_data->transition = transition;
|
_data->transition = transition;
|
||||||
_data->animation.start();
|
_data->animation.start();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue