|
1 | 1 | import React from 'react'; |
2 | 2 | import { Header } from "../components/header/header"; |
3 | | -import { Box } from "@mui/material" |
| 3 | +import { Box, Button } from "@mui/material" |
| 4 | +import "./about.css" |
| 5 | + |
4 | 6 |
|
5 | 7 | export const AboutPage = () => { |
| 8 | + const letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" |
| 9 | + |
| 10 | +document.addEventListener("DOMContentLoaded", function(){ |
| 11 | + observe('.description'); |
| 12 | + observe('.a'); |
| 13 | +}); |
| 14 | + |
| 15 | +function observe(selector){ |
| 16 | + const myElement = document.querySelector(selector); |
| 17 | + const observer = new IntersectionObserver(entries => { |
| 18 | + entries.forEach(entry => { |
| 19 | + if (entry.isIntersecting) { |
| 20 | + if(myElement.innerText.length < 20){ |
| 21 | + hackereffectslow(selector); |
| 22 | + setTimeout(() => { |
| 23 | + hackereffectslow('.b'); |
| 24 | + }, 750); |
| 25 | + setTimeout(() => { |
| 26 | + hackereffectslow('.c'); |
| 27 | + }, 1300); |
| 28 | + setTimeout(() => { |
| 29 | + hackereffectslow('.d'); |
| 30 | + }, 2300); |
| 31 | + setTimeout(() => { |
| 32 | + hackereffectslow('.e'); |
| 33 | + }, 3050); |
| 34 | + observer.disconnect(); |
| 35 | + } |
| 36 | + else{ |
| 37 | + hackereffectfast(selector); |
| 38 | + observer.disconnect(); |
| 39 | + } |
| 40 | + } |
| 41 | + }); |
| 42 | + }); |
| 43 | + observer.observe(myElement); |
| 44 | +} |
| 45 | + |
| 46 | +function hackereffectfast(selector){ |
| 47 | + const target = document.querySelector(selector); |
| 48 | + if(target){ |
| 49 | + let iterations = 0; |
| 50 | + |
| 51 | + const interval = setInterval(() => { |
| 52 | + target.innerText = target.innerText.split("") |
| 53 | + .map((letter, index) => { |
| 54 | + if(target.dataset.value[index] == " "){ |
| 55 | + return target.dataset.value[index]; |
| 56 | + } |
| 57 | + if(index < iterations){ |
| 58 | + return target.dataset.value[index]; |
| 59 | + } |
| 60 | + return letters[Math.floor(Math.random() * 26)]; |
| 61 | + }) |
| 62 | + .join("") |
| 63 | + |
| 64 | + if(iterations >= 550){ |
| 65 | + clearInterval(interval); |
| 66 | + iterations = 0; |
| 67 | + } |
| 68 | + |
| 69 | + iterations += 1; |
| 70 | + }, 10); |
| 71 | + } |
| 72 | +}; |
| 73 | + |
| 74 | +function hackereffectslow(selector){ |
| 75 | + const target = document.querySelector(selector); |
| 76 | + if(target){ |
| 77 | + let iterations = 0; |
| 78 | + |
| 79 | + const interval = setInterval(() => { |
| 80 | + target.innerText = target.innerText.split("") |
| 81 | + .map((letter, index) => { |
| 82 | + if(target.dataset.value[index] == " "){ |
| 83 | + return target.dataset.value[index]; |
| 84 | + } |
| 85 | + if(index < iterations){ |
| 86 | + return target.dataset.value[index]; |
| 87 | + } |
| 88 | + return letters[Math.floor(Math.random() * 26)]; |
| 89 | + }) |
| 90 | + .join("") |
| 91 | + |
| 92 | + if(iterations >= 550){ |
| 93 | + clearInterval(interval); |
| 94 | + iterations = 0; |
| 95 | + } |
| 96 | + |
| 97 | + iterations += 1; |
| 98 | + }, 50); |
| 99 | +} |
| 100 | +}; |
| 101 | + |
6 | 102 | return( |
7 | 103 | <Box sx={{marginLeft:"2.5%"}}> |
8 | 104 | <Header/> |
|
0 commit comments