Skip to content

Commit

Permalink
Updated bg styles for app
Browse files Browse the repository at this point in the history
  • Loading branch information
Viktor Riabkov committed Sep 12, 2024
1 parent 1909c36 commit 898a2fd
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 12 deletions.
4 changes: 1 addition & 3 deletions src/app/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@ const router = createBrowserRouter([
},
]);

export const DEFAULT_BG_IMAGE = 'https://picsum.photos/id/327/1280/720';

function App() {
return (
<AppearanceBackground imageUrl={DEFAULT_BG_IMAGE}>
<AppearanceBackground>
<RouterProvider router={router} />
</AppearanceBackground>
);
Expand Down
37 changes: 28 additions & 9 deletions src/app/AppearanceBackground.tsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,36 @@
import './gradient-bg.styles.css';

import { PropsWithChildren } from 'react';

type Props = PropsWithChildren<{
imageUrl: string;
}>;
type Props = PropsWithChildren<unknown>;

export const AppearanceBackground = ({ children, imageUrl }: Props) => {
export const AppearanceBackground = ({ children }: Props) => {
return (
<div id="AppearanceBackground" className="relative flex flex-col m-0 p-0 w-screen h-svh">
<img
src={imageUrl}
alt="background"
className="absolute left-0 top-0 w-screen h-svh layout-filters"
/>
<div className="gradient-bg absolute left-0 top-0 w-screen h-svh">
<svg xmlns="http://www.w3.org/2000/svg">
<defs>
<filter id="goo">
<feGaussianBlur in="SourceGraphic" stdDeviation="10" result="blur" />
<feColorMatrix
in="blur"
mode="matrix"
values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 18 -8"
result="goo"
/>
<feBlend in="SourceGraphic" in2="goo" />
</filter>
</defs>
</svg>
<div className="gradients-container">
<div className="g1"></div>
<div className="g2"></div>
<div className="g3"></div>
<div className="g4"></div>
<div className="g5"></div>
<div className="interactive"></div>
</div>
</div>

<div className="absolute left-0 top-0 w-screen h-svh content base-app-filter-blur">
{children}
Expand Down
163 changes: 163 additions & 0 deletions src/app/gradient-bg.styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
:root {
--color-bg1: rgb(108, 0, 162);
--color-bg2: rgb(0, 17, 82);
--color1: 18, 113, 255;
--color2: 221, 74, 255;
--color3: 100, 220, 255;
--color4: 200, 50, 50;
--color5: 180, 180, 50;
--color-interactive: 140, 100, 255;
--circle-size: 80%;
--blending: hard-light;
}

@keyframes moveInCircle {
0% {
transform: rotate(0deg);
}
50% {
transform: rotate(180deg);
}
100% {
transform: rotate(360deg);
}
}

@keyframes moveVertical {
0% {
transform: translateY(-50%);
}
50% {
transform: translateY(50%);
}
100% {
transform: translateY(-50%);
}
}

@keyframes moveHorizontal {
0% {
transform: translateX(-50%) translateY(-10%);
}
50% {
transform: translateX(50%) translateY(10%);
}
100% {
transform: translateX(-50%) translateY(-10%);
}
}


.gradient-bg {
width: 100vw;
height: 100vh;
position: relative;
overflow: hidden;
background: linear-gradient(40deg, var(--color-bg1), var(--color-bg2));
top: 0;
left: 0;

svg {
display: none;
}


.gradients-container {
filter: url(#goo) blur(40px) ;
width: 100%;
height: 100%;
}

.g1 {
position: absolute;
background: radial-gradient(circle at center, rgba(var(--color1), 0.8) 0, rgba(var(--color1), 0) 50%) no-repeat;
mix-blend-mode: var(--blending);

width: var(--circle-size);
height: var(--circle-size);
top: calc(50% - var(--circle-size) / 2);
left: calc(50% - var(--circle-size) / 2);

transform-origin: center center;
animation: moveVertical 30s ease infinite;

opacity: 1;
}

.g2 {
position: absolute;
background: radial-gradient(circle at center, rgba(var(--color2), 0.8) 0, rgba(var(--color2), 0) 50%) no-repeat;
mix-blend-mode: var(--blending);

width: var(--circle-size);
height: var(--circle-size);
top: calc(50% - var(--circle-size) / 2);
left: calc(50% - var(--circle-size) / 2);

transform-origin: calc(50% - 400px);
animation: moveInCircle 20s reverse infinite;

opacity: 1;
}

.g3 {
position: absolute;
background: radial-gradient(circle at center, rgba(var(--color3), 0.8) 0, rgba(var(--color3), 0) 50%) no-repeat;
mix-blend-mode: var(--blending);

width: var(--circle-size);
height: var(--circle-size);
top: calc(50% - var(--circle-size) / 2 + 200px);
left: calc(50% - var(--circle-size) / 2 - 500px);

transform-origin: calc(50% + 400px);
animation: moveInCircle 40s linear infinite;

opacity: 1;
}

.g4 {
position: absolute;
background: radial-gradient(circle at center, rgba(var(--color4), 0.8) 0, rgba(var(--color4), 0) 50%) no-repeat;
mix-blend-mode: var(--blending);

width: var(--circle-size);
height: var(--circle-size);
top: calc(50% - var(--circle-size) / 2);
left: calc(50% - var(--circle-size) / 2);

transform-origin: calc(50% - 200px);
animation: moveHorizontal 40s ease infinite;

opacity: 0.7;
}

.g5 {
position: absolute;
background: radial-gradient(circle at center, rgba(var(--color5), 0.8) 0, rgba(var(--color5), 0) 50%) no-repeat;
mix-blend-mode: var(--blending);

width: calc(var(--circle-size) * 2);
height: calc(var(--circle-size) * 2);
top: calc(50% - var(--circle-size));
left: calc(50% - var(--circle-size));

transform-origin: calc(50% - 800px) calc(50% + 200px);
animation: moveInCircle 20s ease infinite;

opacity: 1;
}

.interactive {
position: absolute;
background: radial-gradient(circle at center, rgba(var(--color-interactive), 0.8) 0, rgba(var(--color-interactive), 0) 50%) no-repeat;
mix-blend-mode: var(--blending);

width: 100%;
height: 100%;
top: -50%;
left: -50%;

opacity: 0.7;
}
}

0 comments on commit 898a2fd

Please sign in to comment.