Skip to content

Commit

Permalink
feat: create motion animations for router transitions
Browse files Browse the repository at this point in the history
  • Loading branch information
sanriodev committed May 1, 2024
1 parent d097576 commit 02908e4
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 7 deletions.
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"dependencies": {
"@heroicons/react": "2.0.18",
"@material-tailwind/react": "2.1.2",
"framer-motion": "^11.1.7",
"next": "14.1.4",
"react": "18",
"react-dom": "18"
Expand Down
10 changes: 8 additions & 2 deletions src/app/landing-page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
import { motion } from 'framer-motion';
import Link from 'next/link';

export default function LandingPage() {
return (
<div className="flex flex-col justify-center items-center h-screen" style={{ backgroundImage: `url('./image/backgr.jpg')`, backgroundSize: 'cover' }}>
<motion.div initial={{ y: 25, opacity: 0 }}
animate={{ y: 0, opacity: 1 }}
transition={{
duration: 0.75,
}}
className="flex flex-col justify-center items-center h-screen" style={{ backgroundImage: `url('./image/backgr.jpg')`, backgroundSize: 'cover' }}>
<h1 className="text-4xl font-bold mb-8">blvckleg.dev</h1>
<Link href="/portfolio" className='text-2xl enter-button'>
enter
</Link>
</div>
</motion.div>
);
}
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const roboto = Roboto({
export const metadata: Metadata = {
title: "Blvckleg",
description:
"Blvckleg Portfolio.",
"blvckleg.dev",
};

export default function RootLayout({
Expand Down
20 changes: 18 additions & 2 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
'use client';
import { AnimatePresence, motion } from 'framer-motion';
import LandingPage from './landing-page';

export default function Portfolio() {
return (
<>
<AnimatePresence mode='wait'>
<motion.div initial="initialState" animate="animateState" exit="exitState" transition={{ duration: 0.75 }}
variants={{
initialState: {
opacity: 0,
},
animateState: {
opacity: 1,
},
exitState: {
opacity: 0,
},
}} className="base-page-size"
>
<LandingPage />
</>
</motion.div>
</AnimatePresence>

);
}
22 changes: 20 additions & 2 deletions src/app/portfolio/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import { motion } from "framer-motion";
import { Footer, Navbar } from "../../components";
import Hero from "./hero";
import Projects from "./projects";
Expand All @@ -8,13 +9,30 @@ import Skills from "./skills";

export default function Portfolio() {
return (
<>
<motion.div initial="initialState" animate="animateState" exit="exitState" transition={{ duration: 0.75 }}
variants={{
initialState: {
y: 25,
opacity: 0,
clipPath: "polygon(50% 0, 50% 0, 50% 100%, 50% 100%)"
},
animateState: {
y: 0,
opacity: 1,
clipPath: "polygon(0 0, 100% 0, 100% 100%, 0% 100%)"
},
exitState: {
opacity: 0,
clipPath: "polygon(50% 0, 50% 0, 50% 100%, 50% 100%)"
},
}} className="base-page-size"
>
<Navbar />
<Hero />
<Skills />
<Projects />
<Resume />
<Footer />
</>
</motion.div>
);
}

0 comments on commit 02908e4

Please sign in to comment.