├── public ├── robots.txt ├── favicon.ico ├── logo192.png ├── logo512.png ├── manifest.json └── index.html ├── src ├── parallax │ ├── parallax-1 │ │ ├── bg.png │ │ ├── bg.jpeg │ │ ├── styles.css │ │ └── Parallax.js │ ├── parallax-3 │ │ ├── 1.jpg │ │ ├── 2.jpg │ │ ├── 3.jpg │ │ ├── 4.jpg │ │ ├── 5.jpg │ │ ├── 6.jpg │ │ ├── styles.css │ │ └── Parallax.js │ ├── parallax-4 │ │ ├── 1.jpg │ │ ├── 2.jpg │ │ ├── 3.jpg │ │ ├── styles.css │ │ └── Parallax.js │ └── parallax-2 │ │ ├── bg.jpeg │ │ ├── css.png │ │ ├── es6.png │ │ ├── html.png │ │ ├── banner.jpg │ │ ├── react.png │ │ ├── logo.svg │ │ ├── styles.css │ │ └── Parallax.js ├── App.js ├── index.js ├── index.css └── logo.svg ├── .gitignore ├── package.json └── README.md /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/public/logo512.png -------------------------------------------------------------------------------- /src/parallax/parallax-1/bg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-1/bg.png -------------------------------------------------------------------------------- /src/parallax/parallax-3/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-3/1.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-3/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-3/2.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-3/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-3/3.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-3/4.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-3/4.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-3/5.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-3/5.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-3/6.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-3/6.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-4/1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-4/1.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-4/2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-4/2.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-4/3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-4/3.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-1/bg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-1/bg.jpeg -------------------------------------------------------------------------------- /src/parallax/parallax-2/bg.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-2/bg.jpeg -------------------------------------------------------------------------------- /src/parallax/parallax-2/css.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-2/css.png -------------------------------------------------------------------------------- /src/parallax/parallax-2/es6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-2/es6.png -------------------------------------------------------------------------------- /src/parallax/parallax-2/html.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-2/html.png -------------------------------------------------------------------------------- /src/parallax/parallax-2/banner.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-2/banner.jpg -------------------------------------------------------------------------------- /src/parallax/parallax-2/react.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/frontend-joe/react-parallax/HEAD/src/parallax/parallax-2/react.png -------------------------------------------------------------------------------- /src/App.js: -------------------------------------------------------------------------------- 1 | import { Parallax } from "./parallax/parallax-4/Parallax"; 2 | 3 | function App() { 4 | return ; 5 | } 6 | 7 | export default App; 8 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom/client"; 3 | import "./index.css"; 4 | import App from "./App"; 5 | 6 | const root = ReactDOM.createRoot(document.getElementById("root")); 7 | root.render(); 8 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', 5 | sans-serif; 6 | -webkit-font-smoothing: antialiased; 7 | -moz-osx-font-smoothing: grayscale; 8 | } 9 | 10 | code { 11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New', 12 | monospace; 13 | } 14 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /src/parallax/parallax-2/logo.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-parallax", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "gsap": "^3.11.5", 7 | "react": "^18.2.0", 8 | "react-dom": "^18.2.0", 9 | "react-scripts": "5.0.1" 10 | }, 11 | "scripts": { 12 | "start": "react-scripts start", 13 | "build": "react-scripts build" 14 | }, 15 | "eslintConfig": { 16 | "extends": [ 17 | "react-app" 18 | ] 19 | }, 20 | "browserslist": { 21 | "production": [ 22 | ">0.2%", 23 | "not dead", 24 | "not op_mini all" 25 | ], 26 | "development": [ 27 | "last 1 chrome version", 28 | "last 1 firefox version", 29 | "last 1 safari version" 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/parallax/parallax-3/styles.css: -------------------------------------------------------------------------------- 1 | html { 2 | overflow-y: scroll; 3 | height: 100%; 4 | -webkit-overflow-scrolling: touch; 5 | overflow-scrolling: touch; 6 | } 7 | 8 | body { 9 | margin: 0; 10 | background: #3b4151; 11 | font-family: "Euclid Circular A", "Poppins"; 12 | } 13 | 14 | section { 15 | position: relative; 16 | height: 100vh; 17 | display: flex; 18 | align-items: center; 19 | justify-content: center; 20 | } 21 | 22 | .bg { 23 | position: absolute; 24 | top: 0; 25 | left: 0; 26 | width: 100%; 27 | height: 100%; 28 | z-index: -1; 29 | background-size: cover; 30 | background-position: center; 31 | background-repeat: no-repeat; 32 | filter: brightness(0.68); 33 | } 34 | 35 | h1 { 36 | color: white; 37 | text-shadow: 1px 1px 3px black; 38 | z-index: 1; 39 | font-size: 3em; 40 | font-weight: 400; 41 | } 42 | -------------------------------------------------------------------------------- /src/parallax/parallax-4/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | margin: 0; 3 | padding: 0; 4 | height: 100vh; 5 | color: #ffffff; 6 | background: black; 7 | font-family: "Euclid Circular A", "Poppins"; 8 | } 9 | 10 | h2 { 11 | font-size: 5vw; 12 | font-weight: 500; 13 | text-align: center; 14 | text-transform: uppercase; 15 | letter-spacing: 32px; 16 | text-shadow: 0 0 20px rgb(0 0 0 / 90%); 17 | } 18 | 19 | section { 20 | height: 100%; 21 | width: 100%; 22 | top: 0; 23 | position: fixed; 24 | visibility: hidden; 25 | } 26 | section .outer, 27 | section .inner { 28 | width: 100%; 29 | height: 100%; 30 | overflow-y: hidden; 31 | } 32 | section .bg { 33 | display: grid; 34 | place-items: center; 35 | position: absolute; 36 | height: 100%; 37 | width: 100%; 38 | top: 0; 39 | background-size: cover; 40 | background-position: center; 41 | } 42 | section .bg h2 { 43 | z-index: 2; 44 | } 45 | section .bg .clip-text { 46 | overflow: hidden; 47 | } 48 | -------------------------------------------------------------------------------- /src/parallax/parallax-1/styles.css: -------------------------------------------------------------------------------- 1 | body { 2 | background: #3e303f; 3 | font-family: "Euclid Circular A", "Poppins"; 4 | } 5 | 6 | * { 7 | box-sizing: border-box; 8 | } 9 | 10 | .banner { 11 | display: flex; 12 | justify-content: center; 13 | align-items: center; 14 | flex-direction: column; 15 | background-image: url("./bg.png"); 16 | background-size: cover; 17 | background-repeat: no-repeat; 18 | background-position: 50% 70%; 19 | height: 600px; 20 | transition: 0.1s linear; 21 | } 22 | 23 | .banner h2 { 24 | font-size: 48px; 25 | color: #f8f8f8; 26 | padding-top: 0; 27 | margin-top: 0; 28 | margin-bottom: 10px; 29 | } 30 | 31 | .banner button { 32 | border: 0; 33 | background: #ffffff; 34 | color: #222222; 35 | padding: 10px 24px; 36 | border-radius: 30px; 37 | font-family: inherit; 38 | font-size: 16px; 39 | font-weight: 600; 40 | } 41 | 42 | .container { 43 | padding: 0 10%; 44 | } 45 | 46 | section { 47 | background: #ffffff; 48 | } 49 | 50 | section h2 { 51 | margin-top: 0; 52 | padding-top: 60px; 53 | } 54 | 55 | section p:last-child { 56 | padding-bottom: 60px; 57 | } 58 | -------------------------------------------------------------------------------- /src/parallax/parallax-3/Parallax.js: -------------------------------------------------------------------------------- 1 | import { useEffect } from "react"; 2 | import gsap from "gsap"; 3 | import { ScrollTrigger } from "gsap/all"; 4 | import "./styles.css"; 5 | 6 | import image1 from "./1.jpg"; 7 | import image2 from "./2.jpg"; 8 | import image3 from "./3.jpg"; 9 | 10 | export const Parallax = () => { 11 | const { innerHeight } = window; 12 | 13 | const getRatio = (el) => innerHeight / (innerHeight + el.offsetHeight); 14 | 15 | useEffect(() => { 16 | gsap.registerPlugin(ScrollTrigger); 17 | gsap.utils.toArray("section").forEach((section, i) => { 18 | section.bg = section.querySelector(".bg"); 19 | 20 | gsap.fromTo( 21 | section.bg, 22 | { 23 | backgroundPosition: () => 24 | i ? `50% ${-innerHeight * getRatio(section)}px` : "50% 0px", 25 | }, 26 | { 27 | backgroundPosition: () => 28 | `50% ${innerHeight * (1 - getRatio(section))}px`, 29 | ease: "none", 30 | scrollTrigger: { 31 | trigger: section, 32 | start: () => (i ? "top bottom" : "top top"), 33 | end: "bottom top", 34 | scrub: true, 35 | }, 36 | } 37 | ); 38 | }); 39 | }, []); 40 | 41 | return ( 42 | <> 43 |
44 |
45 |

Parallax

46 |
47 |
48 |
49 |

So smooth

50 |
51 |
52 |
53 |

Nice, right?

54 |
55 | 56 | ); 57 | }; 58 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 19 | 20 | 24 | 33 | React App 34 | 35 | 36 | 37 |
38 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /src/logo.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/parallax/parallax-4/Parallax.js: -------------------------------------------------------------------------------- 1 | import { useEffect } from "react"; 2 | import gsap from "gsap"; 3 | import { Observer } from "gsap/all"; 4 | import "./styles.css"; 5 | 6 | import image1 from "./1.jpg"; 7 | import image2 from "./2.jpg"; 8 | import image3 from "./3.jpg"; 9 | 10 | const gsapInit = () => { 11 | gsap.registerPlugin(Observer); 12 | 13 | let sections = document.querySelectorAll("section"), 14 | images = document.querySelectorAll(".bg"), 15 | outerWrappers = gsap.utils.toArray(".outer"), 16 | innerWrappers = gsap.utils.toArray(".inner"), 17 | currentIndex = -1, 18 | wrap = gsap.utils.wrap(0, sections.length), 19 | animating; 20 | 21 | gsap.set(outerWrappers, { yPercent: 100 }); 22 | gsap.set(innerWrappers, { yPercent: -100 }); 23 | 24 | const gotoSection = (index, direction) => { 25 | index = wrap(index); 26 | animating = true; 27 | let fromTop = direction === -1, 28 | dFactor = fromTop ? -1 : 1, 29 | tl = gsap.timeline({ 30 | defaults: { duration: 1.25, ease: "power1.inOut" }, 31 | onComplete: () => (animating = false), 32 | }); 33 | if (currentIndex >= 0) { 34 | gsap.set(sections[currentIndex], { zIndex: 0 }); 35 | tl.to(images[currentIndex], { yPercent: -15 * dFactor }).set( 36 | sections[currentIndex], 37 | { autoAlpha: 0 } 38 | ); 39 | } 40 | gsap.set(sections[index], { autoAlpha: 1, zIndex: 1 }); 41 | tl.fromTo( 42 | [outerWrappers[index], innerWrappers[index]], 43 | { yPercent: (i) => (i ? -100 * dFactor : 100 * dFactor) }, 44 | { yPercent: 0 }, 45 | 0 46 | ).fromTo(images[index], { yPercent: 15 * dFactor }, { yPercent: 0 }, 0); 47 | 48 | currentIndex = index; 49 | }; 50 | 51 | Observer.create({ 52 | type: "wheel,touch,pointer", 53 | wheelSpeed: -1, 54 | onDown: () => !animating && gotoSection(currentIndex - 1, -1), 55 | onUp: () => !animating && gotoSection(currentIndex + 1, 1), 56 | tolerance: 10, 57 | preventDefault: true, 58 | }); 59 | 60 | gotoSection(0, 1); 61 | }; 62 | 63 | const sections = [ 64 | { title: "Infinite", image: image1 }, 65 | { title: "Scrolling", image: image2 }, 66 | { title: "Website", image: image3 }, 67 | ]; 68 | 69 | export const Parallax = () => { 70 | useEffect(() => { 71 | gsapInit(); 72 | }, []); 73 | 74 | return sections.map((section) => ( 75 |
76 |
77 |
78 |
82 |

{section.title}

83 |
84 |
85 |
86 |
87 | )); 88 | }; 89 | -------------------------------------------------------------------------------- /src/parallax/parallax-2/styles.css: -------------------------------------------------------------------------------- 1 | html { 2 | overflow-y: scroll; 3 | height: 100%; 4 | -webkit-overflow-scrolling: touch; 5 | overflow-scrolling: touch; 6 | } 7 | 8 | * { 9 | box-sizing: border-box; 10 | } 11 | 12 | body { 13 | overflow-y: visible; 14 | position: relative; 15 | height: unset; 16 | font-family: "Euclid Circular A", "Poppins"; 17 | color: #222222; 18 | text-align: center; 19 | } 20 | html, 21 | body { 22 | overflow-x: hidden; 23 | margin: 0; 24 | } 25 | 26 | .container { 27 | width: 400%; 28 | height: 100vh; 29 | display: flex; 30 | flex-wrap: nowrap; 31 | background: #f7f7f7; 32 | } 33 | 34 | img { 35 | width: 170px; 36 | height: 170px; 37 | object-fit: contain; 38 | } 39 | 40 | .banner h2, 41 | .footer h2 { 42 | margin: 20px 0; 43 | } 44 | 45 | nav { 46 | position: fixed; 47 | z-index: 1; 48 | top: 0; 49 | left: 0; 50 | width: 100%; 51 | height: 60px; 52 | display: flex; 53 | gap: 20px; 54 | align-items: center; 55 | padding: 0 24px 0 16px; 56 | background: #ffffff; 57 | box-shadow: 0 0 20px rgb(0 0 0 / 8%); 58 | } 59 | 60 | nav a { 61 | text-decoration: none; 62 | color: inherit; 63 | font-size: 14px; 64 | font-weight: 600; 65 | } 66 | 67 | nav img { 68 | width: 32px; 69 | height: 32px; 70 | } 71 | 72 | section { 73 | display: flex; 74 | flex-direction: column; 75 | justify-content: center; 76 | align-items: center; 77 | height: 100vh; 78 | padding: 0 80px; 79 | } 80 | 81 | h2 { 82 | margin: 50px 0 20px; 83 | } 84 | 85 | p { 86 | opacity: 0.66; 87 | font-size: 16px; 88 | } 89 | 90 | .banner { 91 | flex-direction: row; 92 | text-align: left; 93 | gap: 30px; 94 | background: url("./bg.jpeg"); 95 | background-size: cover; 96 | background-position: center; 97 | color: #f7f7f7; 98 | } 99 | 100 | .banner-content { 101 | position: absolute; 102 | top: 0; 103 | left: 0; 104 | width: 100%; 105 | height: 100vh; 106 | display: flex; 107 | flex-direction: column; 108 | align-items: center; 109 | justify-content: center; 110 | background: linear-gradient(rgb(57 53 86 / 0%), rgb(57 53 86 / 100%) 90%); 111 | } 112 | 113 | .banner h2 { 114 | font-size: 40px; 115 | } 116 | 117 | .banner h3 { 118 | margin: 0; 119 | opacity: 0.7; 120 | } 121 | 122 | .footer { 123 | background: #ffffff; 124 | } 125 | 126 | .panel { 127 | width: 100%; 128 | height: 100%; 129 | } 130 | 131 | .container .panel:nth-child(odd) { 132 | background: #f1f0f7; 133 | } 134 | 135 | form { 136 | padding: 0; 137 | margin: 0; 138 | display: grid; 139 | gap: 10px; 140 | padding-top: 20px; 141 | } 142 | 143 | input, 144 | textarea, 145 | button { 146 | font-family: inherit; 147 | border-radius: 6px; 148 | border: 0; 149 | background: #f1f0f7; 150 | padding: 16px; 151 | width: 340px; 152 | font-size: 16px; 153 | } 154 | 155 | button { 156 | background: #7b66fd; 157 | color: #f7f7f7; 158 | font-weight: 600; 159 | letter-spacing: 2px; 160 | } 161 | -------------------------------------------------------------------------------- /src/parallax/parallax-1/Parallax.js: -------------------------------------------------------------------------------- 1 | import { useState, useEffect } from "react"; 2 | import "./styles.css"; 3 | 4 | export const Parallax = () => { 5 | const [scrollPosition, setScrollPosition] = useState(0); 6 | 7 | const handleScroll = () => setScrollPosition(window.pageYOffset); 8 | 9 | useEffect(() => { 10 | window.addEventListener("scroll", handleScroll, { passive: true }); 11 | 12 | return () => { 13 | window.removeEventListener("scroll", handleScroll); 14 | }; 15 | }, []); 16 | 17 | return ( 18 | <> 19 |
25 |

Parallax

26 | 27 |
28 |
29 |

What is parallax?

30 |

31 | Parallax is a displacement or difference in the apparent position of 32 | an object viewed along two different lines of sight and is measured by 33 | the angle or half-angle of inclination between those two lines. Due to 34 | foreshortening, nearby objects show a larger parallax than farther 35 | objects, so parallax can be used to determine distances. 36 |

37 |

38 | Parallax also affects optical instruments such as rifle scopes, 39 | binoculars, microscopes, and twin-lens reflex cameras that view 40 | objects from slightly different angles. Many animals, along with 41 | humans, have two eyes with overlapping visual fields that use parallax 42 | to gain depth perception; this process is known as stereopsis. In 43 | computer vision the effect is used for computer stereo vision, and 44 | there is a device called a parallax rangefinder that uses it to find 45 | the range, and in some variations also altitude to a target. 46 |

47 |

48 | Parallax is a displacement or difference in the apparent position of 49 | an object viewed along two different lines of sight and is measured by 50 | the angle or half-angle of inclination between those two lines. Due to 51 | foreshortening, nearby objects show a larger parallax than farther 52 | objects, so parallax can be used to determine distances. 53 |

54 |

55 | Parallax also affects optical instruments such as rifle scopes, 56 | binoculars, microscopes, and twin-lens reflex cameras that view 57 | objects from slightly different angles. Many animals, along with 58 | humans, have two eyes with overlapping visual fields that use parallax 59 | to gain depth perception; this process is known as stereopsis. In 60 | computer vision the effect is used for computer stereo vision, and 61 | there is a device called a parallax rangefinder that uses it to find 62 | the range, and in some variations also altitude to a target. 63 |

64 |
65 | 66 | ); 67 | }; 68 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app). 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser. 13 | 14 | The page will reload when you make changes.\ 15 | You may also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!** 35 | 36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own. 39 | 40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | 48 | ### Code Splitting 49 | 50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting) 51 | 52 | ### Analyzing the Bundle Size 53 | 54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size) 55 | 56 | ### Making a Progressive Web App 57 | 58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app) 59 | 60 | ### Advanced Configuration 61 | 62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration) 63 | 64 | ### Deployment 65 | 66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment) 67 | 68 | ### `npm run build` fails to minify 69 | 70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify) 71 | -------------------------------------------------------------------------------- /src/parallax/parallax-2/Parallax.js: -------------------------------------------------------------------------------- 1 | import "./styles.css"; 2 | 3 | import html from "./html.png"; 4 | import css from "./css.png"; 5 | import es6 from "./es6.png"; 6 | import react from "./react.png"; 7 | 8 | import gsap from "gsap"; 9 | import { ScrollTrigger } from "gsap/all"; 10 | 11 | import logo from "./logo.svg"; 12 | import { useEffect, useRef } from "react"; 13 | 14 | export const Parallax = () => { 15 | const containerRef = useRef(); 16 | 17 | useEffect(() => { 18 | gsap.registerPlugin(ScrollTrigger); 19 | const sections = gsap.utils.toArray(".panel"); 20 | gsap.to(sections, { 21 | xPercent: -100 * (sections.length - 1), 22 | ease: "none", 23 | scrollTrigger: { 24 | trigger: ".container", 25 | pin: true, 26 | scrub: 1, 27 | snap: 1 / (sections.length - 1), 28 | end: () => "+=" + containerRef.current.offsetWidth, 29 | }, 30 | }); 31 | }, []); 32 | 33 | return ( 34 | <> 35 | 41 |
42 |
43 |

Hi, I'm Peter

44 |

Frontend Developer

45 |
46 |
47 |
48 |
49 | 50 |

HTML

51 |

52 | Lorem ipsum dolor sit, amet consectetur adipisicing elit. Animi 53 | labore eius cum perferendis consectetur culpa laboriosam quam, sed 54 | ea nihil, suscipit, quidem est expedita. Nihil enim obcaecati 55 | deleniti eaque sed. 56 |

57 |
58 |
59 | 60 |

CSS

61 |

62 | Lorem ipsum dolor sit, amet consectetur adipisicing elit. Animi 63 | labore eius cum perferendis consectetur culpa laboriosam quam, sed 64 | ea nihil, suscipit, quidem est expedita. Nihil enim obcaecati 65 | deleniti eaque sed. 66 |

67 |
68 |
69 | 70 |

ES6

71 |

72 | Lorem ipsum dolor sit, amet consectetur adipisicing elit. Animi 73 | labore eius cum perferendis consectetur culpa laboriosam quam, sed 74 | ea nihil, suscipit, quidem est expedita. Nihil enim obcaecati 75 | deleniti eaque sed. 76 |

77 |
78 |
79 | 80 |

React JS

81 |

82 | Lorem ipsum dolor sit, amet consectetur adipisicing elit. Animi 83 | labore eius cum perferendis consectetur culpa laboriosam quam, sed 84 | ea nihil, suscipit, quidem est expedita. Nihil enim obcaecati 85 | deleniti eaque sed. 86 |

87 |
88 |
89 |
90 |

Contact

91 |
92 | 93 | 94 |