
function getTwoDecimal(num) { return parseFloat(num.toFixed(2) + 0.5); } const mouse = { decimal(coord) { return getTwoDecimal(coord / 1000); }, x(e) { return Math.abs(e.clientX - window.innerWidth / 2); }, y(e) { return Math.abs(e.clientY - window.innerHeight / 2); } }; const changeTextAlphaVal = (txt, e) => { const root = document.querySelector(":root"); const cssVar = "--alpha"; const current..

const mouseImg = document.querySelectorAll(".mouse__img"); mouseImg.forEach((item) => { const imageWrap = item.querySelector(".img"); const imageWrapBounds = imageWrap.getBoundingClientRect(); let itemBounds = item.getBoundingClientRect(); console.log(imageWrapBounds); // console.log(itemBounds); const onMouseEnter = ()=>{ gsap.set(imageWrap, {xPercent: -50, yPercent: 50, rotation: -15, scale: 0..

function mousemove(e){ let positionSlow = (e.pageX - (window.innerWidth/2)) * 0.1 let positionFast = (e.pageX - (window.innerWidth/2)) * 0.2; gsap.to(".spanSlow",{duration: 0.4, x: positionSlow}) gsap.to(".spanFast",{duration: 0.4, x: positionFast}) gsap.to(".cursor", {duration: 0.3, left: e.pageX, top: e.pageY}); } document.addEventListener("mousemove", mousemove); 이번 효과는 CSS적인 부분에서 처리해야 될 게 많다..

function scroll(){ let scrollTop = window.screenY || window.pageYOffset || document.documentElement.scrollTop; const reveal = document.querySelectorAll(".reveal"); reveal.forEach(el => { let revealOffset = el.offsetTop + el.parentElement.offsetTop; let revealDelay = el.dataset.delay; if (scrollTop > revealOffset - window.innerHeight/2){ if(revealDelay == undefined){ el.classList.add("show") } el..