Improve backdrop change animation

This commit is contained in:
Prayag Prajapati committed 2023-08-14 23:35:52 +05:30
1 parent 94e7ea95c1
commit b2e0ed01a3
2 files changed
+18 -16

No files matched your search

+10 -16
View File
@@ -272,6 +272,8 @@ function App() {
state.backdropId, state.backdropId,
]); ]);
const [backdropLoading, setBackdropLoading] = useState(true);
const [easterEgg, setEasterEgg] = useState(false); const [easterEgg, setEasterEgg] = useState(false);
const sixtyNine = () => { const sixtyNine = () => {
setEasterEgg(true); setEasterEgg(true);
@@ -359,8 +361,8 @@ function App() {
</Button> </Button>
</DialogActions> </DialogActions>
</Dialog> </Dialog>
<AnimatePresence wait>
<Box className="app-backdrop-container"> <Box className="app-backdrop-container">
<AnimatePresence>
<motion.img <motion.img
key={backdropId} key={backdropId}
src={backdropUrl} src={backdropUrl}
@@ -370,16 +372,18 @@ function App() {
opacity: 0, opacity: 0,
}} }}
animate={{ animate={{
opacity: 0.5, opacity: backdropLoading ? 0 : 0.5,
}} }}
exit={{ exit={{
opacity: 0, opacity: 0,
}} }}
transition={{ transition={{
duration: 1, duration: 1.25,
}} }}
onLoad={() => setBackdropLoading(false)}
loading="eager" loading="eager"
/> />
</AnimatePresence>
</Box> </Box>
<div <div
style={{ style={{
@@ -390,20 +394,14 @@ function App() {
<CssBaseline /> <CssBaseline />
<SideMenu /> <SideMenu />
<AppBar /> <AppBar />
<Routes <Routes key={location.pathname} location={location}>
key={location.pathname}
location={location}
>
<Route element={<AnimationWrapper />}> <Route element={<AnimationWrapper />}>
<Route <Route
path="/" path="/"
element={<LogicalRoutes />} element={<LogicalRoutes />}
/> />
<Route <Route path="/home" element={<Home />} />
path="/home"
element={<Home />}
/>
<Route <Route
path="/setup/server" path="/setup/server"
element={<ServerSetup />} element={<ServerSetup />}
@@ -442,10 +440,7 @@ function App() {
path="/settings" path="/settings"
element={<Settings />} element={<Settings />}
/> />
<Route <Route path="/about" element={<About />} />
path="/about"
element={<About />}
/>
<Route <Route
path="/player" path="/player"
element={<VideoPlayer />} element={<VideoPlayer />}
@@ -458,7 +453,6 @@ function App() {
</Route> </Route>
</Routes> </Routes>
</div> </div>
</AnimatePresence>
<ReactQueryDevtools /> <ReactQueryDevtools />
</ThemeProvider> </ThemeProvider>
</SnackbarProvider> </SnackbarProvider>
+8
View File
@@ -63,6 +63,7 @@ import "./library.module.scss";
import { MdiMusic } from "../../components/icons/mdiMusic"; import { MdiMusic } from "../../components/icons/mdiMusic";
import { MdiHeart } from "../../components/icons/mdiHeart"; import { MdiHeart } from "../../components/icons/mdiHeart";
import { MdiHeartOutline } from "../../components/icons/mdiHeartOutline"; import { MdiHeartOutline } from "../../components/icons/mdiHeartOutline";
import { useBackdropStore } from "../../utils/store/backdrop";
const LibraryView = () => { const LibraryView = () => {
const navigate = useNavigate(); const navigate = useNavigate();
@@ -448,6 +449,13 @@ const LibraryView = () => {
"Studio", "Studio",
]; ];
const [setAppBackdrop] = useBackdropStore((state) => [state.setBackdrop]);
useState(() => {
// Remove App backdrop in library page
setAppBackdrop("", "");
}, []);
return ( return (
<Box <Box
sx={{ sx={{