-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.3686a2e43fa8a2425f62.js
1 lines (1 loc) · 5.27 KB
/
main.3686a2e43fa8a2425f62.js
1
(()=>{"use strict";const t=function(){const e=document.querySelector("canvas"),i=e.getContext("2d"),n=["rgb(51, 41, 64)","rgb(187, 134, 252)","rgb(3, 218, 197)","rgb(250, 250, 250)"];e.width=document.body.scrollWidth,e.height=window.innerHeight,e.style.display="block";let s={x:30*e.width/100,y:30*e.height/100};const a=window.innerWidth;let r;function o(t){s.x-t.x<100&&s.x-t.x>-100&&s.y-t.y<100&&s.y-t.y>-100&&t.radius<10?t.radius+=Math.random():t.radius>1&&(t.radius=t.radius-1)}function d(t){this.x=Math.random()*e.width,this.y=Math.random()*e.height,this.vx=-.5+Math.random(),this.vy=-.5+Math.random(),this.radius=2.5*Math.random(),this.colour=n[Math.floor(Math.random()*n.length)]}r=a>1600?{nb:600,distance:70,d_radius:300,array:[]}:a>1300?{nb:575,distance:60,d_radius:280,array:[]}:a>1100?{nb:500,distance:55,d_radius:250,array:[]}:a>800?{nb:300,distance:0,d_radius:0,array:[]}:a>600?{nb:200,distance:0,d_radius:0,array:[]}:{nb:100,distance:0,d_radius:0,array:[]},d.prototype={create:function(){i.beginPath(),i.arc(this.x,this.y,this.radius,0,2*Math.PI,!1);const t=((this.x-s.x)**2+(this.y-s.y)**2)**.5/(a/1.7);i.fillStyle=this.colour.slice(0,-1)+`,${1-t})`,i.fill()},animate:function(){for(let t=0;t<r.nb;t++){const i=r.array[t];i.y<0||i.y>e.height?(i.vx=i.vx,i.vy=-i.vy):(i.x<0||i.x>e.width)&&(i.vx=-i.vx,i.vy=i.vy),i.x+=i.vx,i.y+=i.vy,o(i)}}},window.onmousemove=function(t){s.x=t.pageX,s.y=t.pageY},s.x=window.innerWidth/2,s.y=window.innerHeight/2;const c=setInterval((function(){i.clearRect(0,0,e.width,e.height);for(let e=0;e<r.nb;e++){r.array.push(new d);var t=r.array[e];t.create()}t.animate()}),1e3/30);window.onresize=function(){clearInterval(c),t()}},e=t,i=function(){const t=document.querySelector(".canvas-2"),e=t.getContext("2d"),n=["rgb(51, 41, 64)","rgb(187, 134, 252)","rgb(3, 218, 197)","rgb(250, 250, 250)"];t.width=document.body.scrollWidth,t.height=window.innerHeight,t.style.display="block";let s={x:30*t.width/100,y:30*t.height/100};const a=window.innerWidth;let r;function o(){this.x=Math.random()*t.width,this.y=Math.random()*t.height,this.vx=-.5+Math.random(),this.vy=-.5+Math.random(),this.radius=1.5*Math.random(),this.colour=n[Math.floor(Math.random()*n.length)]}a>1600?r={nb:100,distance:0,d_radius:0,array:[]}:a>1300?r={nb:75,distance:0,d_radius:0,array:[]}:a>1100?r={nb:50,distance:0,d_radius:0,array:[]}:(r={nb:1,distance:0,d_radius:0,array:[]},e.globalAlpha=0),o.prototype={create:function(){e.beginPath(),e.arc(this.x,this.y,this.radius,0,2*Math.PI,!1);const t=(window.pageYOffset||document.scrollTop)-(document.clientTop||0),i=((this.x-s.x)**2+(this.y-s.y+t)**2)**.5/(a/2);e.fillStyle=this.colour.slice(0,-1)+`,${1-i})`,e.fill()},animate:function(){for(let e=0;e<r.nb;e++){const i=r.array[e];i.y<0||i.y>t.height?(i.vx=i.vx,i.vy=-i.vy):(i.x<0||i.x>t.width)&&(i.vx=-i.vx,i.vy=i.vy),i.x+=i.vx,i.y+=i.vy}}},window.onscroll=function(t){s.x=window.innerWidth/2,s.y=window.innerHeight/2;const e=(window.pageYOffset||document.scrollTop)-(document.clientTop||0);s.y+=e};const d=setInterval((function(){e.clearRect(0,0,t.width,t.height);for(let t=0;t<r.nb;t++){r.array.push(new o);var i=r.array[t];i.create()}i.animate()}),1e3/30);window.onresize=function(){clearInterval(d),i()}},n=i;window.onload=function(){n(),e()};let s={root:null,rootMargin:"0px",threshold:.5};new IntersectionObserver((function(t,e){t.forEach((t=>{if(t.isIntersecting&&document.body.scrollWidth>1300){document.querySelector(".profile").classList.add("profile__fade-in");const t=t=>new Promise((e=>setTimeout(e,t)));t(1e3).then((()=>{document.querySelector(".skills__item--html").classList.add("skills__item-fade-in")})),t(1100).then((()=>{document.querySelector(".skills__item--webpack").classList.add("skills__item-fade-in")})),t(1200).then((()=>{document.querySelector(".skills__item--js").classList.add("skills__item-fade-in")})),t(1300).then((()=>{document.querySelector(".skills__item--git").classList.add("skills__item-fade-in")})),t(1400).then((()=>{document.querySelector(".skills__item--sass").classList.add("skills__item-fade-in")})),t(1500).then((()=>{document.querySelector(".skills__item--npm").classList.add("skills__item-fade-in")})),t(1600).then((()=>{document.querySelector(".skills__item--python").classList.add("skills__item-fade-in")})),t(1700).then((()=>{document.querySelector(".skills__item--react").classList.add("skills__item-fade-in")})),t(1800).then((()=>{document.querySelector(".skills__item--r").classList.add("skills__item-fade-in")})),t(1900).then((()=>{document.querySelector(".skills__item--css").classList.add("skills__item-fade-in")}))}}))}),s).observe(document.querySelector(".about__content"));const a=document.querySelectorAll(".navigation__item");let r=new IntersectionObserver((function(t,e){t.forEach((t=>{t.isIntersecting&&(a.forEach((t=>{t.classList.remove("navigation__item--active")})),document.querySelector(`#nav-${t.target.id}`).classList.add("navigation__item--active"))}))}),s);r.observe(document.querySelector("#hero")),r.observe(document.querySelector("#about")),r.observe(document.querySelector("#contact")),new IntersectionObserver((function(t,e){t.forEach((t=>{t.isIntersecting&&(a.forEach((t=>{t.classList.remove("navigation__item--active")})),document.querySelector(`#nav-${t.target.id}`).classList.add("navigation__item--active"))}))}),{root:null,rootMargin:"0px",threshold:.2}).observe(document.querySelector("#projects"))})();