fix: 添加过渡动画
This commit is contained in:
8
src/components/ComponentLoading/index.tsx
Normal file
8
src/components/ComponentLoading/index.tsx
Normal file
@@ -0,0 +1,8 @@
|
||||
import Loading from '@/components/Loading'
|
||||
import { Suspense } from 'react'
|
||||
const ComponentLoading = (Component: any, props: any) => (
|
||||
<Suspense fallback={<Loading />}>
|
||||
<Component {...props} />
|
||||
</Suspense>
|
||||
)
|
||||
export default ComponentLoading
|
||||
@@ -31,15 +31,15 @@ html {
|
||||
height: 100vh;
|
||||
width: 100vw;
|
||||
position: fixed;
|
||||
//background: linear-gradient(
|
||||
// 90deg,
|
||||
// var(--line) 1px,
|
||||
// transparent 1px var(--size)
|
||||
//)
|
||||
//50% 50% / var(--size) var(--size),
|
||||
//linear-gradient(var(--line) 1px, transparent 1px var(--size)) 50% 50% /
|
||||
// var(--size) var(--size);
|
||||
background-image: url("@/assets/images/background.png");
|
||||
background: linear-gradient(
|
||||
90deg,
|
||||
var(--line) 1px,
|
||||
transparent 1px var(--size)
|
||||
)
|
||||
50% 50% / var(--size) var(--size),
|
||||
linear-gradient(var(--line) 1px, transparent 1px var(--size)) 50% 50% /
|
||||
var(--size) var(--size);
|
||||
//background-image: url("@/assets/images/background.png");
|
||||
-webkit-mask: linear-gradient(-15deg, transparent 30%, white);
|
||||
mask: linear-gradient(-15deg, transparent 30%, white);
|
||||
top: 0;
|
||||
|
||||
@@ -575,9 +575,9 @@ const HomeIndex: React.FC = () => {
|
||||
</div>
|
||||
</header>
|
||||
<main>
|
||||
<section className={'section'}>
|
||||
<h2 className={'h2'}>Pretty rad.</h2>
|
||||
</section>
|
||||
{/*<section className={'section'}>*/}
|
||||
{/* <h2 className={'h2'}>Pretty rad.</h2>*/}
|
||||
{/*</section>*/}
|
||||
</main>
|
||||
<footer className={'footer'}>ʕ•ᴥ•ʔ schisandra © 2024</footer>
|
||||
</>
|
||||
|
||||
50
src/components/Loading/index.less
Normal file
50
src/components/Loading/index.less
Normal file
@@ -0,0 +1,50 @@
|
||||
.loading-body {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background-image: url("@/assets/images/background.png");
|
||||
}
|
||||
.gegga {
|
||||
width: 0;
|
||||
}
|
||||
.snurra {
|
||||
filter: url(#gegga);
|
||||
}
|
||||
.stopp1 {
|
||||
stop-color: #f700a8;
|
||||
}
|
||||
.stopp2 {
|
||||
stop-color: #ff8000;
|
||||
}
|
||||
.halvan {
|
||||
animation: Snurra1 10s infinite linear;
|
||||
stroke-dasharray: 180 800;
|
||||
fill: none;
|
||||
stroke: url(#gradient);
|
||||
stroke-width: 23;
|
||||
stroke-linecap: round;
|
||||
}
|
||||
.strecken {
|
||||
animation: Snurra1 3s infinite linear;
|
||||
stroke-dasharray: 26 54;
|
||||
fill: none;
|
||||
stroke: url(#gradient);
|
||||
stroke-width: 23;
|
||||
stroke-linecap: round;
|
||||
}
|
||||
.skugga {
|
||||
filter: blur(5px);
|
||||
opacity: 0.3;
|
||||
position: absolute;
|
||||
transform: translate(3px, 3px);
|
||||
}
|
||||
@keyframes Snurra1 {
|
||||
0% {
|
||||
stroke-dashoffset: 0;
|
||||
}
|
||||
100% {
|
||||
stroke-dashoffset: -403px;
|
||||
}
|
||||
}
|
||||
60
src/components/Loading/index.tsx
Normal file
60
src/components/Loading/index.tsx
Normal file
@@ -0,0 +1,60 @@
|
||||
import React, { useEffect } from 'react'
|
||||
import './index.less'
|
||||
const Loading: React.FC = () => {
|
||||
useEffect(() => {
|
||||
document.body.classList.add('loading-body')
|
||||
return () => {
|
||||
document.body.classList.remove('loading-body')
|
||||
}
|
||||
}, [])
|
||||
return (
|
||||
<>
|
||||
<svg className='gegga'>
|
||||
<defs>
|
||||
<filter id='gegga'>
|
||||
<feGaussianBlur
|
||||
in='SourceGraphic'
|
||||
stdDeviation='7'
|
||||
result='blur'></feGaussianBlur>
|
||||
<feColorMatrix
|
||||
in='blur'
|
||||
mode='matrix'
|
||||
values='1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 20 -10'
|
||||
result='inreGegga'></feColorMatrix>
|
||||
<feComposite
|
||||
in='SourceGraphic'
|
||||
in2='inreGegga'
|
||||
operator='atop'></feComposite>
|
||||
</filter>
|
||||
</defs>
|
||||
</svg>
|
||||
<svg className='snurra' width='200' height='200' viewBox='0 0 200 200'>
|
||||
<defs>
|
||||
<linearGradient id='linjärGradient'>
|
||||
<stop className='stopp1' offset='0'></stop>
|
||||
<stop className='stopp2' offset='1'></stop>
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
y2='160'
|
||||
x2='160'
|
||||
y1='40'
|
||||
x1='40'
|
||||
gradientUnits='userSpaceOnUse'
|
||||
id='gradient'
|
||||
xlinkHref='#linjärGradient'></linearGradient>
|
||||
</defs>
|
||||
<path
|
||||
className='halvan'
|
||||
d='m 164,100 c 0,-35.346224 -28.65378,-64 -64,-64 -35.346224,0 -64,28.653776 -64,64 0,35.34622 28.653776,64 64,64 35.34622,0 64,-26.21502 64,-64 0,-37.784981 -26.92058,-64 -64,-64 -37.079421,0 -65.267479,26.922736 -64,64 1.267479,37.07726 26.703171,65.05317 64,64 37.29683,-1.05317 64,-64 64,-64'></path>
|
||||
<circle className='strecken' cx='100' cy='100' r='64'></circle>
|
||||
</svg>
|
||||
{/*<svg className='skugga' width='200' height='200' viewBox='0 0 200 200'>*/}
|
||||
{/* <path*/}
|
||||
{/* className='halvan'*/}
|
||||
{/* d='m 164,100 c 0,-35.346224 -28.65378,-64 -64,-64 -35.346224,0 -64,28.653776 -64,64 0,35.34622 28.653776,64 64,64 35.34622,0 64,-26.21502 64,-64 0,-37.784981 -26.92058,-64 -64,-64 -37.079421,0 -65.267479,26.922736 -64,64 1.267479,37.07726 26.703171,65.05317 64,64 37.29683,-1.05317 64,-64 64,-64'></path>*/}
|
||||
{/* <circle className='strecken' cx='100' cy='100' r='64'></circle>*/}
|
||||
{/*</svg>*/}
|
||||
</>
|
||||
)
|
||||
}
|
||||
export default React.memo(Loading)
|
||||
Reference in New Issue
Block a user