Skip to content

Commit 3d956a6

Browse files
committed
removed parallax
1 parent d758020 commit 3d956a6

File tree

1 file changed

+3
-76
lines changed

1 file changed

+3
-76
lines changed
Lines changed: 3 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,5 @@
1-
import { useRef } from "react";
2-
import {
3-
motion,
4-
useScroll,
5-
useSpring,
6-
useTransform,
7-
useMotionValue,
8-
useVelocity,
9-
useAnimationFrame
10-
} from "framer-motion";
11-
import { wrap } from "@motionone/utils";
121
import Marquee from "react-fast-marquee";
132

14-
function ParallaxText({ children, baseVelocity = 100 }) {
15-
const baseX = useMotionValue(0);
16-
const { scrollY } = useScroll();
17-
const scrollVelocity = useVelocity(scrollY);
18-
const smoothVelocity = useSpring(scrollVelocity, {
19-
damping: 50,
20-
stiffness: 400
21-
});
22-
const velocityFactor = useTransform(smoothVelocity, [0, 1000], [0, 5], {
23-
clamp: false
24-
});
25-
26-
/**
27-
* This is a magic wrapping for the length of the text - you
28-
* have to replace for wrapping that works for you or dynamically
29-
* calculate
30-
*/
31-
const x = useTransform(baseX, (v) => `${wrap(-20, -45, v)}%`);
32-
33-
const directionFactor = useRef(1);
34-
useAnimationFrame((t, delta) => {
35-
let moveBy = directionFactor.current * baseVelocity * (delta / 1000);
36-
37-
/**
38-
* This is what changes the direction of the scroll once we
39-
* switch scrolling directions.
40-
*/
41-
if (velocityFactor.get() < 0) {
42-
directionFactor.current = -1;
43-
} else if (velocityFactor.get() > 0) {
44-
directionFactor.current = 1;
45-
}
46-
47-
moveBy += directionFactor.current * moveBy * velocityFactor.get();
48-
49-
baseX.set(baseX.get() + moveBy);
50-
});
51-
52-
/**
53-
* The number of times to repeat the child text should be dynamically calculated
54-
* based on the size of the text and viewport. Likewise, the x motion value is
55-
* currently wrapped between -20 and -45% - this 25% is derived from the fact
56-
* we have four children (100% / 4). This would also want deriving from the
57-
* dynamically generated number of children.
58-
*/
59-
return (
60-
<div className="parallax">
61-
<motion.div className="scroller animate-text font-bold bg-clip-text text-transparent bg-gradient-to-r from-teal-300 via-purple-500 to-orange-500" style={{ x }}>
62-
<span>{children}</span>
63-
<span>{children}</span>
64-
<span>{children}</span>
65-
<span>{children}</span>
66-
</motion.div>
67-
</div>
68-
);
69-
}
70-
713
const logoUrls = [
724
'/react-native.svg',
735
'/graphql.svg',
@@ -86,17 +18,12 @@ export default function TechStacks() {
8618
<>
8719
<div className="w-screen pt-12">
8820
<Marquee autoFill gradient gradientColor={[0, 0, 0]} speed={60}>
89-
{logoUrls.map((logoUrl) => <img src={logoUrl} className="w-32 h-32 px-4 filter grayscale hover:filter-none" />)}
21+
{logoUrls.map((logoUrl) => <img src={logoUrl} className="w-32 h-32 px-4 filter hover:grayscale" />)}
9022
</Marquee>
9123
<Marquee autoFill direction="right" gradient gradientColor={[0, 0, 0]}>
92-
{logoUrls.map((logoUrl) => <img src={logoUrl} className="w-24 h-24 px-4 filter grayscale hover:filter-none" />)}
24+
{logoUrls.map((logoUrl) => <img src={logoUrl} className="w-24 h-24 px-4 filter hover:grayscale" />)}
9325
</Marquee>
9426
</div>
9527
</>
9628
);
97-
}
98-
99-
/* <section className="w-screen flex flex-col space-y-4 text-6xl uppercase font-bold">
100-
<ParallaxText baseVelocity={-1}>React Express GraphQL AWS AliCloud MongoDB Nodejs Selenium Cypress Docker Strapi</ParallaxText>
101-
<ParallaxText baseVelocity={1}>Next.js Three.js Astro Framer Motion Tailwind Linux SQL NoSQL Git React Native Ionic</ParallaxText>
102-
</section> */
29+
}

0 commit comments

Comments
 (0)