From 4b0ddb9e239e39d5e2dbb711ff53445e8471ccd4 Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Tue, 20 Sep 2022 23:59:17 +0300 Subject: [PATCH] improve modal animations --- frontend/src/animations.js | 15 +++++++++++---- .../src/components/overlays/CreateAccount.svelte | 4 ++-- .../src/components/overlays/CreateChannel.svelte | 4 ++-- .../src/components/overlays/EditChannel.svelte | 4 ++-- .../src/components/overlays/EditMessage.svelte | 4 ++-- frontend/src/components/overlays/Login.svelte | 4 ++-- frontend/src/components/overlays/Prompt.svelte | 4 ++-- frontend/src/components/overlays/Settings.svelte | 4 ++-- frontend/src/components/overlays/Toast.svelte | 4 ++-- 9 files changed, 27 insertions(+), 20 deletions(-) diff --git a/frontend/src/animations.js b/frontend/src/animations.js index cf15aae..c7356bd 100644 --- a/frontend/src/animations.js +++ b/frontend/src/animations.js @@ -1,13 +1,20 @@ -import { fade, fly } from "svelte/transition"; +import { fade, fly, scale } from "svelte/transition"; import { cubicInOut } from "svelte/easing"; import { getItem } from "./storage"; export function maybeModalFade(node) { - return maybeFade(node, { duration: 160, easing: cubicInOut }); + return maybeFade(node, { duration: 175, easing: cubicInOut }); } -export function maybeModalFly(node) { - return maybeFly(node, { duration: 210, easing: cubicInOut, y: 15 }); +export function maybeModalScale(node) { + return maybeScale(node, { duration: 175, easing: cubicInOut, start: 0.93 }); +} + +export function maybeScale(...e) { + if (getItem("ui:doAnimations")) + return scale(...e); + else + return scale(e[0], { duration: 0 }); } export function maybeFly(...e) { diff --git a/frontend/src/components/overlays/CreateAccount.svelte b/frontend/src/components/overlays/CreateAccount.svelte index 963d3d8..7d46a29 100644 --- a/frontend/src/components/overlays/CreateAccount.svelte +++ b/frontend/src/components/overlays/CreateAccount.svelte @@ -2,7 +2,7 @@ import { overlayStore, OverlayType } from "../../stores"; import request from "../../request"; import { apiRoute } from "../../storage"; - import { maybeModalFly } from "../../animations"; + import { maybeModalScale } from "../../animations"; let username = ""; let password = ""; @@ -53,7 +53,7 @@