Skip to content

Commit

Permalink
fix: Page transition speed on non-webkitgtk
Browse files Browse the repository at this point in the history
  • Loading branch information
LynithDev committed Dec 14, 2024
1 parent da54c6a commit 769bcec
Show file tree
Hide file tree
Showing 3 changed files with 950 additions and 826 deletions.
15 changes: 12 additions & 3 deletions apps/frontend/src/ui/components/AnimatedRoutes.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { getProgramInfo } from '@onelauncher/client';
import useSettings from '~ui/hooks/useSettings';
import { type ParentProps, Show } from 'solid-js';
import { createMemo, type ParentProps, Show } from 'solid-js';
import { Transition, type TransitionProps } from 'solid-transition-group';

type AnimationTypes = 'default' | 'fade';
Expand Down Expand Up @@ -33,6 +34,14 @@ function AnimatedRoutes(props: AnimatedProps & TransitionProps & ParentProps) {

const animation = () => animations[props.animation ?? 'default'];

const durationMultiplier = createMemo(() => {
// I LOVE WEBKITGTK I LOVE WEBKTIGTKI LOVE WEBKITGTK I LOVE WEBKTIGTKI LOVE WEBKITGTK I LOVE WEBKTIGTK
if (getProgramInfo().platform === 'linux')
return 0.36;

return 1;
});

return (
<Show
children={(
Expand All @@ -48,7 +57,7 @@ function AnimatedRoutes(props: AnimatedProps & TransitionProps & ParentProps) {
animation().before,
animation().after,
], {
duration: 90,
duration: 250 * durationMultiplier(),
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
}).onfinish = () => {
done();
Expand All @@ -64,7 +73,7 @@ function AnimatedRoutes(props: AnimatedProps & TransitionProps & ParentProps) {
animation().after,
animation().before,
], {
duration: 95,
duration: 255 * durationMultiplier(),
easing: 'cubic-bezier(0.16, 1, 0.3, 1)',
}).onfinish = () => {
done();
Expand Down
Loading

0 comments on commit 769bcec

Please sign in to comment.