본문 바로가기
Js

gsap, hue-rotate, mousemove

by 영감은어디에 2025. 3. 15.

.cursor{position: relative; pointer-events: none;}
.cursor .box { position: absolute; width: 10px; height: 5px; top:-50px; 
background-color: aqua;box-shadow: 0 0 15px aqua, 0 0 50px aqua ;
transform-origin: center 50px;}
<div class="cursor"></div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js" integrity="sha512-7eHRwcbYkK4d9g/6tD/mhkf++eoTHwpNM9woBxtPUBWm67zeAfFC+HrdoE2GanKeocly/VxeLvIqwvCdk7qScg==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
<script>
    document.addEventListener("DOMContentLoaded", () =>{
        let cursor = document.querySelector('.cursor');
        for (let i = 0; i<36; i++){
            let span = document.createElement('span');
            span.classList.add('box');
            span.style.setProperty('--i', i+1);
            span.style.filter = `hue-rotate(${i * 10}deg)`;
            cursor.appendChild(span);
        }
    });
    document.addEventListener("mousemove", e =>{
        gsap.to(".box", {
            x:e.clientX,
            y:e.clientY,
            rotate:(index) => (index) * 10,
            stagger:0.05,
        })
    })
</script>

'Js' 카테고리의 다른 글

smoothwheel, 부드러운 마우스 스크롤  (0) 2025.03.11
wow.js animate  (0) 2025.03.09
rotate, mouse move, delay  (0) 2025.03.07
circle, strokeDashoffset, scrollTop, 그래프  (0) 2025.03.06
gsap, mouse move  (0) 2025.03.05
원페이지 스크롤  (0) 2025.03.03
menu bar mouse move  (0) 2025.02.25
폴리곤. 컬러 로테이션 hue-rotate  (0) 2025.02.24