GYChoi 2022. 4. 14. 17:28

https://garenchoi.github.io/webs_class/javascript/effect/mouseEffect06.html

 

마우스 이펙트

마우스 이펙트 - 텍스트 효과 1 2 3 4 5 6 7 8 소스보기 HTML CSS Javascript 닫기

garenchoi.github.io

 

6번째 마우스 이펙트는 거의 css로 만든 느낌이었다. (css소스는 위의 페이지에서 볼 수 있음.)

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);