Skip to content

Commit

Permalink
added about section
Browse files Browse the repository at this point in the history
  • Loading branch information
SadmanYasar committed Jul 27, 2023
1 parent 5c43873 commit 835fbbf
Show file tree
Hide file tree
Showing 10 changed files with 436 additions and 6 deletions.
3 changes: 3 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
content="Metal Gear Solid Scrollable Environment made with React Three Fiber and Theatre.js by Sadman Yasar Sayem, freelancer on Upwork" />
<meta name="keywords" content="theatre.js, fly-through, 3d, react three fiber, Upwork" />
<meta name="author" content="Sadman Yasar Sayem" />
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@300&display=swap" rel="stylesheet">
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="css/base.css" />
<script>
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,23 @@
"preview": "vite preview"
},
"dependencies": {
"@motionone/utils": "^10.15.1",
"@react-three/drei": "^9.56.20",
"@react-three/fiber": "^8.11.0",
"@theatre/core": "^0.6.0",
"@theatre/r3f": "^0.6.0",
"@theatre/studio": "^0.6.0",
"@types/lodash": "^4.14.195",
"framer-motion": "^10.13.1",
"gsap": "^3.12.2",
"lodash": "^4.17.21",
"prop-types": "^15.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-intersection-observer": "^9.5.2",
"react-lottie": "^1.2.3",
"react-type-animation": "^3.1.0",
"react-typed": "^1.2.0",
"three": "^0.149.0"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import Cubes from "./components/Cubes";
import Lights from "./components/Lights";
import Environment from "./components/Environment";
import Stars from "./components/Cubes/Stars"
import Hero from "./components/Sections/Hero";
import About from "./components/Sections/About";
import TechStacks from "./components/Sections/TechStacks";

function Scene() {
const sheet = useCurrentSheet();
Expand Down Expand Up @@ -87,12 +90,9 @@ export default function App() {
<Scene />
</SheetProvider>
<Scroll html>
<section className="w-screen min-h-screen opacity-50">
Menu
</section>
<section className="w-screen min-h-screen opacity-50">
About
</section>
<Hero />
<About />
<TechStacks />
<section className="w-screen min-h-screen opacity-50">
Projects
</section>
Expand Down
20 changes: 20 additions & 0 deletions src/components/Sections/About.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
const img = 'https://media.licdn.com/dms/image/D5603AQEjwJTzxoowUg/profile-displayphoto-shrink_800_800/0/1683264970160?e=2147483647&v=beta&t=80g7pjhga2ytWSd020WK9sjNTvZKNeUh3nDkfZGC0YY'

export default function About() {
return (
<section className="w-full min-h-screen max-w-5xl mx-auto px-4 font-fira">
<div className="flex flex-col">
<div className="p-1 rounded-full animate-text bg-gradient-to-r from-teal-300 via-purple-500 to-orange-500 self-center">
<img src={img} className="w-64 h-64 object-cover rounded-full" />
</div>
<div className="text-3xl md:text-4xl text-center pt-12">
Full Stack Web Developer
</div>
<div className="text-xl md:text-2xl text-center pt-4">
Hello! I am a freelancer from Johor Bahru and in the process of making robust web and mobile apps.
</div>
</div>
</section>

);
}
29 changes: 29 additions & 0 deletions src/components/Sections/Hero.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { motion } from "framer-motion";
import { slideIn } from "../../../utils/motion";
import { TypeAnimation } from 'react-type-animation';

export default function Hero() {
return (
<section
className="w-screen max-w-5xl min-h-screen mx-auto px-4 flex flex-col justify-center items-center flex-wrap">
<h1 className="font-normal text-3xl md:text-4xl inline-block font-fira">I am <span className="animate-text font-bold bg-clip-text text-transparent bg-gradient-to-r from-teal-300 via-purple-500 to-orange-500">
<TypeAnimation
sequence={[
'Sadman Yasar Sayem',
1000, // Waits 1s
'a Full Stack Developer',
2000, // Waits 2s
'building scalable systems 🚀',
2000,
() => {
console.log('Sequence completed');
},
]}
wrapper="span"
cursor={true}
repeat={Infinity}
/>
</span></h1>
</section>
);
}
83 changes: 83 additions & 0 deletions src/components/Sections/TechStacks.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import { useEffect, useRef, useState } from "react";
import { motion, useScroll, wrap, useSpring, useVelocity, useTransform } from "framer-motion";
import { gsap } from "gsap";
import { ScrollSmoother } from "gsap/ScrollSmoother";

gsap.registerPlugin(ScrollSmoother);

const techIcons = ['🚀', '🚗', '⚛', '🏀', '🥎', '🚀', '🚗', '⚛', '🏀', '🥎'];

function ParallaxText({ children, baseVelocity = 100 }) {
const [numOfChildren, setNumOfChildren] = useState(4); // Default number of children
const scrollerRef = useRef(null);

useEffect(() => {
// Calculate the number of times to repeat the child text dynamically
const scrollerWidth = scrollerRef.current.offsetWidth;
const textWidth = scrollerWidth / techIcons.length;
const newNumOfChildren = Math.ceil(textWidth / children.length);
setNumOfChildren(newNumOfChildren);

// Initialize ScrollSmoother with the provided options
const smoother = ScrollSmoother.create({
content: scrollerRef.current,
wrapper: scrollerRef.current.parentNode,
smooth: 1,
effects: true,
normalizeScroll: true,
ignoreMobileResize: true,
});

return () => {
smoother.kill(); // Cleanup ScrollSmoother when the component unmounts
};
}, [children.length]);

const baseX = useMotionValue(0);
const { scrollY } = useScroll();
const scrollVelocity = useVelocity(scrollY);
const smoothVelocity = useSpring(scrollVelocity, {
damping: 50,
stiffness: 400,
});
const velocityFactor = useTransform(smoothVelocity, [0, 1000], [0, 5], {
clamp: false,
});

const totalWidth = (-100 / techIcons.length) * numOfChildren;

const x = useTransform(baseX, (v) => `${wrap(0, totalWidth, v)}%`);

const directionFactor = useRef(1);
useAnimationFrame((t, delta) => {
let moveBy = directionFactor.current * baseVelocity * (delta / 1000);

if (velocityFactor.get() < 0) {
directionFactor.current = -1;
} else if (velocityFactor.get() > 0) {
directionFactor.current = 1;
}

moveBy += directionFactor.current * moveBy * velocityFactor.get();

baseX.set(baseX.get() + moveBy);
});

return (
<div className="parallax">
<motion.div className="scroller" ref={scrollerRef} style={{ x }}>
{Array.from({ length: numOfChildren }).map((_, index) => (
<span key={index}>{children}</span>
))}
</motion.div>
</div>
);
}

export default function TechStacks() {
return (
<section className="w-screen min-h-screen font-fira">
<ParallaxText baseVelocity={20}>R</ParallaxText>
</section>
);
}
34 changes: 34 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,37 @@
height: 100vh;
overflow: hidden;
}

.progress {
position: fixed;
left: 0;
right: 0;
height: 5px;
background: red;
bottom: 100px;
}

.parallax {
overflow: hidden;
letter-spacing: -2px;
line-height: 0.8;
margin: 0;
white-space: nowrap;
display: flex;
flex-wrap: nowrap;
}

.parallax .scroller {
font-weight: 600;
text-transform: uppercase;
font-size: 64px;
display: flex;
white-space: nowrap;
display: flex;
flex-wrap: nowrap;
}

.parallax span {
display: block;
margin-right: 30px;
}
21 changes: 21 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,27 @@ export default {
'gradient-radial': 'radial-gradient(ellipse at bottom, var(--bgColor) 0%, var(--bgColor2) 100%)',
}),
},
transitionTimingFunction: {
'out-flex': 'cubic-bezier(0.05, 0.6, 0.4, 0.9)',
},
animation: {
text: 'text 5s ease infinite',
},
keyframes: {
text: {
'0%, 100%': {
'background-size': '200% 200%',
'background-position': 'left center',
},
'50%': {
'background-size': '200% 200%',
'background-position': 'right center',
},
},
},
fontFamily: {
'fira': ['Fira Code', 'monospace'],
},
},
plugins: [],
}
Loading

0 comments on commit 835fbbf

Please sign in to comment.