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 {
|
||||
|
||||
rpl::variable<bool> AnimationsDisabled = false;
|
||||
int SlowMultiplierMinusOne/* = 0*/;
|
||||
|
||||
} // namespace
|
||||
|
||||
|
|
@ -76,6 +77,16 @@ void SetDisabled(bool disabled) {
|
|||
AnimationsDisabled = disabled;
|
||||
}
|
||||
|
||||
int SlowMultiplier() {
|
||||
return (SlowMultiplierMinusOne + 1);
|
||||
}
|
||||
|
||||
void SetSlowMultiplier(int multiplier) {
|
||||
Expects(multiplier > 0);
|
||||
|
||||
SlowMultiplierMinusOne = multiplier - 1;
|
||||
}
|
||||
|
||||
void DrawStaticLoading(
|
||||
QPainter &p,
|
||||
QRectF rect,
|
||||
|
|
|
|||
|
|
@ -351,6 +351,8 @@ QPainterPath path(QPointF (&from)[N]) {
|
|||
rpl::producer<bool> Disables();
|
||||
bool Disabled();
|
||||
void SetDisabled(bool disabled);
|
||||
int SlowMultiplier();
|
||||
void SetSlowMultiplier(int multiplier); // 1 - default, 10 - slow x10.
|
||||
|
||||
void DrawStaticLoading(
|
||||
QPainter &p,
|
||||
|
|
|
|||
|
|
@ -410,7 +410,7 @@ inline void Simple::startPrepared(
|
|||
anim::transition transition) {
|
||||
_data->from = _data->value;
|
||||
_data->delta = to - _data->from;
|
||||
_data->duration = duration;
|
||||
_data->duration = duration * anim::SlowMultiplier();
|
||||
_data->transition = transition;
|
||||
_data->animation.start();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue