svgl/animations/loader.js

83 lines
1.4 KiB
JavaScript
Raw Normal View History

2022-01-22 06:30:32 +08:00
import { motion } from "framer-motion";
import React from "react";
const LoadingDot = {
display: "block",
2022-02-12 20:36:54 +08:00
width: "1rem",
height: "1rem",
2022-01-22 06:30:32 +08:00
backgroundColor: "#50cdc5",
borderRadius: "50%",
};
const LoadingContainer = {
2022-02-12 20:36:54 +08:00
width: "5rem",
2022-01-22 06:30:32 +08:00
height: "5rem",
display: "flex",
justifyContent: "space-around",
};
const ContainerVariants = {
initial: {
transition: {
staggerChildren: 0.2,
},
},
animate: {
transition: {
staggerChildren: 0.2,
},
},
};
const DotVariants = {
initial: {
y: "0%",
},
animate: {
y: "100%",
},
};
const DotTransition = {
duration: 0.5,
yoyo: Infinity,
ease: "easeInOut",
};
export default function Loader() {
return (
<div
style={{
paddingTop: "5rem",
width: "100%",
display: "flex",
alignItems: "center",
justifyContent: "center",
}}
>
<motion.div
style={LoadingContainer}
variants={ContainerVariants}
initial="initial"
animate="animate"
>
<motion.span
style={LoadingDot}
variants={DotVariants}
transition={DotTransition}
/>
<motion.span
style={LoadingDot}
variants={DotVariants}
transition={DotTransition}
/>
<motion.span
style={LoadingDot}
variants={DotVariants}
transition={DotTransition}
/>
</motion.div>
</div>
);
}