void RoundButton::Numbers::realSetText(QString text, int value) { _delayedText = QString(); _delayedValue = 0; _growing = (value > _value); _value = value; auto newSize = text.size(); while (_digits.size() < newSize) { _digits.push_front(Digit()); } while (_digits.size() > newSize && !_digits.front().to.unicode()) { _digits.pop_front(); } auto oldSize = _digits.size(); auto animating = false; for (auto i = 0, size = _digits.size(); i != size; ++i) { auto &digit = _digits[i]; digit.from = digit.to; digit.fromWidth = digit.toWidth; digit.to = (newSize + i < size) ? QChar(0) : text[newSize + i - size]; digit.toWidth = digit.to.unicode() ? _st.font->m.width(digit.to) : 0; if (digit.from != digit.to) { animating = true; } if (!digit.from.unicode()) { --oldSize; } } _fromWidth = oldSize * _digitWidth; _toWidth = newSize * _digitWidth; if (animating) { _a_ready.start([this] { animationCallback(); }, 0., 1., _st.numbersDuration); } }
void PasscodeWidget::showAnimated(const QPixmap &bgAnimCache, bool back) { _showBack = back; (_showBack ? _cacheOver : _cacheUnder) = bgAnimCache; _a_show.finish(); showAll(); setInnerFocus(); _passcode->finishAnimations(); (_showBack ? _cacheUnder : _cacheOver) = myGrab(this); hideAll(); _a_show.start([this] { animationCallback(); }, 0., 1., st::slideDuration, Window::SlideAnimation::transition()); show(); }
void PlayButtonLayout::startTransform(float64 from, float64 to) { _transformProgress.start([this] { animationCallback(); }, from, to, st::mediaPlayerButtonTransformDuration); }
void CrossButton::startAnimation(bool shown) { if (_shown == shown) return; _shown = shown; if (isHidden()) show(); _a_show.start([this] { animationCallback(); }, _shown ? 0. : 1., _shown ? 1. : 0., _st.duration); }