mirror of
https://github.com/Unkn0wnCat/KevinK.dev.js.git
synced 2025-04-29 02:07:39 +02:00
Re-add particles to homepage
This commit is contained in:
parent
4688007416
commit
75f95fe96e
2 changed files with 22 additions and 0 deletions
|
@ -20,6 +20,7 @@ import {
|
|||
Phone,
|
||||
} from "lucide-react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import * as particleConfig from "./index.particles.json";
|
||||
|
||||
export const query = graphql`
|
||||
query GetMetaAndProjects($language: String) {
|
||||
|
@ -46,6 +47,19 @@ export const query = graphql`
|
|||
}
|
||||
`;
|
||||
|
||||
const loadTsParticles = async () => {
|
||||
import("tsparticles").then(({ tsParticles }) => {
|
||||
tsParticles.load("particle-container", particleConfig).then(() => {
|
||||
anime({
|
||||
targets: ["#particle-container > canvas"],
|
||||
opacity: [0, 1],
|
||||
duration: 10000,
|
||||
easing: "easeInOutCirc",
|
||||
});
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
const IndexPage = (props) => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
|
@ -77,6 +91,10 @@ const IndexPage = (props) => {
|
|||
duration: 250,
|
||||
easing: "easeInOutCirc",
|
||||
});
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
if (typeof window !== "undefined")
|
||||
window.setTimeout(loadTsParticles, 1000);
|
||||
}, []);
|
||||
|
||||
let meta = props.data.site.siteMetadata;
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
padding: 0;
|
||||
top: 0;
|
||||
left: 0;
|
||||
|
||||
> canvas {
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
.spacer {
|
||||
|
|
Loading…
Add table
Reference in a new issue