Advertisement
Custom Mouse Cursor in Css, Html & Js Code Download
Advertisement

Custom Mouse Cursor Html Code

 <div id="cursor" class="cursor"></div>
Advertisement

Custom Mouse Cursor CSS Code

*{
    padding: 0px;
    margin: 0px;
}
body{
    background-color: rgb(75, 75, 75);
    height: 100vh;
    width: 100%;
}
.cursor{
    position: fixed;
    height: 0;
    width: 0;
    display: block;
    align-items: center;
    justify-content: center;
    pointer-events: none;   
}
.cursor:before{
    content: "";
    display: block;
    position: absolute;
    border-radius: 0;

}
.cursor:after{
    content: "";
    display: block;
    position: absolute;
    border-radius: 100%;
}
.cursor:before{
    height: 40px;
    width: 40px;
    border: 1px solid rgb(255, 251, 1);
    animation: shake 2s infinite;
    animation: shake2 linear .9s infinite;
}
.cursor:after{
    height: 4px;
    width: 4px;
    position: absolute;
    background-color: white;
    border: 0;
}
html{
    cursor:none
}
.html:hover .cursor{
    display: flex;
}
@keyframes shake{
    0%{
        transform: scale(1);
    }

    50%{
        transform: scale(1.5);
    }
    100%{
        transform: scale(1);
    }
}
@keyframes shake2{
    100%{
        transform: rotate(360deg);
    }
}

Custom Mouse Cursor Java Script Code

Advertisement
 <script>
        "use strict";
        var cursor = document.querySelector(".cursor");
        var cursorListener = function cursorListener (event){
            cursor.style.top = event.y + "px";
            cursor.style.left = event.x + "px";
        }
        window.addEventListener("mousemove", cursorListener);
    </script>
car game code

Game Source Code Download

Advertisement