Example #1
0
void PlayerWidget::step_state(uint64 ms, bool timer) {
	for (StateAnimations::iterator i = _stateAnimations.begin(); i != _stateAnimations.cend();) {
		int32 over = qAbs(i.key());
		updateOverRect(OverState(over));

		float64 dt = float64(ms - i.value()) / st::playerDuration;
		if (dt >= 1) {
			_stateHovers[over] = (i.key() > 0) ? 1 : 0;
			i = _stateAnimations.erase(i);
		} else {
			_stateHovers[over] = (i.key() > 0) ? dt : (1 - dt);
			++i;
		}
	}
	if (_stateAnimations.isEmpty()) {
		_a_state.stop();
	}
}
Example #2
0
bool PlayerWidget::stateStep(float64 msc) {
	bool result = false;
	uint64 ms = getms();
	for (StateAnimations::iterator i = _stateAnimations.begin(); i != _stateAnimations.cend();) {
		int32 over = qAbs(i.key());
		updateOverRect(OverState(over));

		float64 dt = float64(ms - i.value()) / st::playerDuration;
		if (dt >= 1) {
			_stateHovers[over] = (i.key() > 0) ? 1 : 0;
			i = _stateAnimations.erase(i);
		} else {
			_stateHovers[over] = (i.key() > 0) ? dt : (1 - dt);
			++i;
		}
	}
	return !_stateAnimations.isEmpty();
}