Pikachu Animation
Home
Snippets
Pikachu Animation
HTML
CSS
JS
<body> <div class="loading"> <img src="http://a.top4top.net/p_1990j031.gif" alt="Loading"> </div> <div class="mouse original"></div> </body>
* { cursor: none } body { overflow: hidden; display: flex; justify-content: center; align-items: center; } .loading { background-color: #ffffff; display: fixed } .loading img { display: block; min-width: 200px; min-height: 209px; } .mouse { height: 25px; width: 25px; border-radius: 100%; background-color: #fff782; position: absolute; animation: mouseAnimation .5s infinite ease-in-out alternate; left: 0; top: 0 } @keyframes mouseAnimation { from { width: 25px; height: 25px } to { width: 15px; height: 15px } }
$(".loading").height($(window).height()); $(".loading").width($(window).width()); $(".loading img").css({ paddingTop: ($(".loading").height() - $(".loading img").height()) / 2, paddingLeft: ($(".loading").width() - $(".loading img").width()) / 2 }); $(window).resize(function () { "use strict"; $(".loading").height($(window).height()); $(".loading").width($(window).width()); $(".loading img").css({ paddingTop: ($(".loading").height() - $(".loading img").height()) / 2, paddingLeft: ($(".loading").width() - $(".loading img").width()) / 2 }); }); $(window).mousemove(function (e) { "use strict"; $(".original").css({ left: e.pageX - 16, top: e.pageY - 16 }); }); $("body").on("click", function (e) { "use strict"; $(".original").clone(true).appendTo("body").css({ left: e.pageX - 16, top: e.pageY - 16 }).removeClass("original"); });
Ad #1
Ad #2
Scroll to Top