Canvas Click Animation Demo
How do I make an canvas click animation demo?
Inspired by Material Design. What is a canvas click animation demo? How do you make a canvas click animation demo? This script and codes were developed by Danny C on 17 October 2022, Monday.
Canvas Click Animation Demo - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Canvas Click Animation Demo</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Canvas Click Animation Demo</h1>
<canvas id="myCanvas" width="960" height="500"> Your web browser does not support canvas!
</canvas> <script src="js/index.js"></script>
</body>
</html>
Canvas Click Animation Demo - Script Codes CSS Codes
body{ text-align:center; background-color:#e2e2e2;
}
canvas{ top:60px; margin:60px auto 0; background:#f2f2f2;
}
Canvas Click Animation Demo - Script Codes JS Codes
var canvas = document.getElementById('myCanvas');
canvas.addEventListener("mousedown", doMouseDown, false);
if(canvas.getContext){ var ctx = canvas.getContext('2d');
}else{ console.log('canvas not supported.');
}
function doMouseDown(event){
ctx.clearRect(0, 0, 960, 500);
//draw a circle centered at location of click
var circleX = event.clientX - canvas.offsetLeft;
var circleY = event.clientY - canvas.offsetTop;
//alert('circleX: '+ circleX + " circleY: "+ circleY);
ctx.beginPath();
ctx.arc(circleX, circleY, 50, 0, Math.PI*2, true);
ctx.fillStyle = "#000000";
ctx.fill();
}
Developer | Danny C |
Username | tychoBlender |
Uploaded | October 17, 2022 |
Rating | 3 |
Size | 1,955 Kb |
Views | 12,144 |
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 |
Toggle Object Width with jQuery | 1,729 Kb |
Table toggle | 1,795 Kb |
AJAX Form | 2,732 Kb |
Navigation Transition | 1,741 Kb |
Single Page Layout | 3,748 Kb |
Select Menu test | 3,117 Kb |
Animation Test | 1,870 Kb |
Outlook 2013 Line Height | 1,765 Kb |
CSS Social Media Icon | 3,871 Kb |
A Pen by Danny C | 1,874 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 |
Collapsing Widget | Er40 | 4,279 Kb |
CSS Bot Confusion | Jpod | 3,456 Kb |
A form arranged using automatic placement. | Vikasford | 2,103 Kb |
Wavy Road with Dashes | Jonobr1 | 2,679 Kb |
Lunar eclipse | Ademilter | 2,056 Kb |
Drag and Drop Quiz | Cgspicer | 3,837 Kb |
Scarlett Johansson Tribute Page | Diomed | 3,233 Kb |
A Pen by tugce | Ecgutcnkr | 4,197 Kb |
Login-ng-modal | Heedoo | 3,566 Kb |
Slide like Mailbox | Hmps | 3,758 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!