鼠标拖影特性2edit icon

Fork(复制)
下载
嵌入
BUG反馈
index.html
现在支持上传本地图片了!
index.html
            
            <!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>鼠标拖尾特效</title>
    <style>
        body {
            margin: 0;
            overflow: hidden;
            background-color: #000;
            height: 100vh;
        }
        .tail {
            position: absolute;
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: #fff;
            opacity: 0.6;
            pointer-events: none;
            animation: fadeOut 2s linear forwards;
        }
        @keyframes fadeOut {
            to {
                opacity: 0;
                transform: scale(0);
            }
        }
    </style>
</head>
<body>
<script>
    document.addEventListener("mousemove", function(event) {
        const tail = document.createElement("div");
        tail.classList.add("tail");
        tail.style.left = event.clientX + "px";
        tail.style.top = event.clientY + "px";
        document.body.appendChild(tail);

        setTimeout(() => {
            tail.remove();
        }, 2000);
    });
</script>
</body>
</html>
        
编辑器加载中
预览
控制台