목록Script Sample/mouse effect (8)
초짜코딩의 잡동사니

const circle = document.querySelector(".cursor").getBoundingClientRect(); function mouseMove(e){ //마우스 좌표 값 let mousePageX = e.pageX; let mousePageY = e.pageY; //마우스 좌표 기준점을 가운데로 변경 let centerPageX = window.innerWidth/2 - mousePageX let centerPageY = window.innerHeight/2 - mousePageY //최솟값은 -50 최댓값은 50 let maxPageX = Math.max(-800, Math.min(800, centerPageX)); let maxPageY = Math.max(-300, Math...

const circle3 = document.querySelector(".cursor").getBoundingClientRect(); //bottom: 200, height: 200, left: 0, right: 200, top: 0, width: 200, x: 0, y: 0 document.querySelector(".mouse__img").addEventListener("mousemove", (e) =>{ //커서 gsap.to(".cursor", {duration: .2, left: e.pageX - circle3.width/2, top: e.pageY - circle3.height/2}) //마우스 좌표 let mousePageX = e.pageX; let mousePageY = e.pageY; ..

const cursor = document.querySelector(".cursor"); // const circle1 = document.querySelector(".cursor").clientWidth; //190 : border값이 빠진 상태 // const circle2 = document.querySelector(".cursor").offsetWidth; //200 : border값 포함 상태 const circle3 = document.querySelector(".cursor").getBoundingClientRect(); //bottom: 200, height: 200, left: 0, right: 200, top: 0, width: 200, x: 0, y: 0 function follow(..