mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-08-03 13:41:59 -07:00
@@ -7,10 +7,10 @@ CAnimatedVariable::CAnimatedVariable() {
|
||||
}
|
||||
|
||||
void CAnimatedVariable::create(ANIMATEDVARTYPE type, SAnimationPropertyConfig* pAnimConfig, void* pWindow, AVARDAMAGEPOLICY policy) {
|
||||
m_eVarType = type;
|
||||
m_eVarType = type;
|
||||
m_eDamagePolicy = policy;
|
||||
m_pConfig = pAnimConfig;
|
||||
m_pWindow = pWindow;
|
||||
m_pConfig = pAnimConfig;
|
||||
m_pWindow = pWindow;
|
||||
|
||||
m_bDummy = false;
|
||||
}
|
||||
@@ -22,25 +22,23 @@ void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, SAnimationPro
|
||||
switch (type) {
|
||||
case AVARTYPE_FLOAT: {
|
||||
const auto V = std::any_cast<float>(val);
|
||||
m_fValue = V;
|
||||
m_fGoal = V;
|
||||
m_fValue = V;
|
||||
m_fGoal = V;
|
||||
break;
|
||||
}
|
||||
case AVARTYPE_VECTOR: {
|
||||
const auto V = std::any_cast<Vector2D>(val);
|
||||
m_vValue = V;
|
||||
m_vGoal = V;
|
||||
m_vValue = V;
|
||||
m_vGoal = V;
|
||||
break;
|
||||
}
|
||||
case AVARTYPE_COLOR: {
|
||||
const auto V = std::any_cast<CColor>(val);
|
||||
m_cValue = V;
|
||||
m_cGoal = V;
|
||||
m_cValue = V;
|
||||
m_cGoal = V;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ASSERT(false);
|
||||
break;
|
||||
default: ASSERT(false); break;
|
||||
}
|
||||
} catch (std::exception& e) {
|
||||
Debug::log(ERR, "CAnimatedVariable create error: %s", e.what());
|
||||
@@ -64,7 +62,8 @@ void CAnimatedVariable::registerVar() {
|
||||
}
|
||||
|
||||
int CAnimatedVariable::getDurationLeftMs() {
|
||||
return std::max((int)(m_pConfig->pValues->internalSpeed * 100) - (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count(), 0);
|
||||
return std::max(
|
||||
(int)(m_pConfig->pValues->internalSpeed * 100) - (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count(), 0);
|
||||
}
|
||||
|
||||
float CAnimatedVariable::getPercent() {
|
||||
|
Reference in New Issue
Block a user