Mousy canvas experiment
How do I make an mousy canvas experiment?
What is a mousy canvas experiment? How do you make a mousy canvas experiment? This script and codes were developed by Joseph on 21 November 2022, Monday.
Mousy canvas experiment - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>mousy canvas experiment</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="container"> <div id="follower"></div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Mousy canvas experiment - Script Codes CSS Codes
html, body { width: 100%; height: 100%; margin: 0; padding: 0; overflow: hidden;
}
/* Hide the scrollbar... */
body::-webkit-scrollbar { display: none; }
#follower { position : absolute; background-color : yellow; width:100px; height:100px; border-radius:100%; margin-left:-50px; margin-top:-50px;
}
.container
{ width:100%; height:100%; position:absolute; top:0; left:0; overflow:hidden; border:1px solid #000000;
}
Mousy canvas experiment - Script Codes JS Codes
$(document).ready(function()
{
var mouseX = 0, mouseY = 0;
$(window).mousemove(function(e) { var offset = $('.container').offset(); mouseX = Math.min(e.pageX - offset.left); mouseY = Math.min(e.pageY - offset.top); if (mouseX < 0) mouseX = 0; if (mouseY < 0) mouseY = 0;
});
// cache the selector
var follower = $("#follower");
var xp = 0, yp = 0;
var loop = setInterval(function(){ // change 12 to alter damping higher is slower xp += (mouseX - xp) / 12; yp += (mouseY - yp) / 12; follower.css({left:xp, top:yp});
}, 12); });
![Mousy canvas experiment - Script Codes](http://shots.codepen.io/jibbon/pen/sEIGz-512.jpg)
Developer | Joseph |
Username | jibbon |
Uploaded | November 21, 2022 |
Rating | 3 |
Size | 2,076 Kb |
Views | 18,216 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
3d image canvas play | 3,181 Kb |
3d transform card flip | 2,276 Kb |
Fluid poster wall | 2,856 Kb |
Css only parallax | 5,628 Kb |
Dragdealer slider | 3,117 Kb |
Bloody Simple Grid | 2,195 Kb |
A Pen by Joseph | 1,826 Kb |
NEW SPACE COLONY | 2,681 Kb |
Large canvas mousemove experiment | 2,885 Kb |
Fluid full-width vimeo element | 2,242 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Comment Jquery | SquishyAndroid | 2,421 Kb |
Process Accordion | Devilskitchen | 31,432 Kb |
CSS Chat Bubbles | Boylett | 2,094 Kb |
Weather App | Kw7oe | 3,162 Kb |
Faces SVG animation | ScavengerFrontend | 2,957 Kb |
Jochaho Skeleton | Dhanushbadge | 1,689 Kb |
Beautiful canvas stars | Matths | 2,399 Kb |
JQuery AJAX reddit Exercise | Btholt | 1,777 Kb |
Masonry | Uriuriuriu | 5,005 Kb |
Nav Test -- cats 1 | Payls | 4,735 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!