From fc8d81753ea43facc90b2c2512b65f6a793cd409 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Sun, 28 Aug 2022 16:02:28 +0300 Subject: [PATCH] improve conditional animations --- frontend/src/animations.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/frontend/src/animations.js b/frontend/src/animations.js index a282c38..cf15aae 100644 --- a/frontend/src/animations.js +++ b/frontend/src/animations.js @@ -13,9 +13,27 @@ export function maybeModalFly(node) { export function maybeFly(...e) { if (getItem("ui:doAnimations")) return fly(...e); + else + return fly(e[0], { duration: 0 }); } export function maybeFade(...e) { if (getItem("ui:doAnimations")) return fade(...e); + else + return fade(e[0], { duration: 0 }); +} + +export function maybeFlyIf(...e) { + if (getItem("ui:doAnimations") && e[1] && e[1]._condition) + return fly(...e); + else + return fly(e[0], { duration: 0 }); +} + +export function maybeFadeIf(...e) { + if (getItem("ui:doAnimations") && e[1] && e[1]._condition) + return fade(...e); + else + return fade(e[0], { duration: 0 }); }