Drawing board
How do I make an drawing board?
What is a drawing board? How do you make a drawing board? This script and codes were developed by Quincy Soeliman on 22 July 2022, Friday.
Drawing board - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Drawing board</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <canvas id="drawing-board" width="640" height="360"></canvas>
<button onclick="clearCanvas()">Clear</button> <script src="js/index.js"></script>
</body>
</html>
Drawing board - Script Codes CSS Codes
canvas { background-color: white; border: 1px solid black;
}
Drawing board - Script Codes JS Codes
var canvas = document.getElementById('drawing-board');
if (canvas.getContext) { var ctx = canvas.getContext('2d'); var draw = false; canvas.addEventListener('mousedown', function() { ctx.beginPath(); ctx.moveTo( getMousePosX(canvas), getMousePosY(canvas) ); ctx.stroke(); draw = true; }); canvas.addEventListener('mousemove', function () { ctx.lineTo( getMousePosX(canvas), getMousePosY(canvas) ); if (draw) { ctx.stroke(); } }); canvas.addEventListener('mouseup', function () { draw = false; }); function getMousePosX(elem) { return event.clientX - elem.offsetTop; } function getMousePosY(elem) { return event.clientY - elem.offsetLeft; } function clearCanvas() { ctx.clearRect(0, 0, canvas.width, canvas.height); }
}
// Fix dis
var drawify = { canvas: {}, context: {}, settings: { parentElem: {}, }, init: function() { this.canvas = this.createCanvas(); console.log(this.canvas); }, createCanvas: function() { return document.createElement('canvas'); }
};
drawify.init();
Developer | Quincy Soeliman |
Username | quincysoeliman |
Uploaded | July 22, 2022 |
Rating | 3 |
Size | 1,985 Kb |
Views | 64,768 |
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 |
ATM | 2,484 Kb |
Firefox Breakout Guide | 2,576 Kb |
Car Animation | 2,238 Kb |
VueJS Names | 1,608 Kb |
Datepicker | 1,358 Kb |
A Pen by Quincy Soeliman | 1,279 Kb |
CSS Rocket Ship | 3,714 Kb |
CSS Jenga Loading Animation | 2,932 Kb |
Flipping cards | 2,375 Kb |
VueJS Multi Select | 1,772 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 |
Iron Man SVG Loading Animation | Andythayer | 3,069 Kb |
CSS3 Butterfly | Timohausmann | 3,430 Kb |
Canvas stripes | Adrianparr | 1,948 Kb |
CSS Tooltips | Darylldoyle | 2,599 Kb |
Portfolio Layout Flex | Lahvjal | 3,489 Kb |
Lightrays v2 | Sinthetyc | 2,903 Kb |
Personal Website Redesign v2.0 | DevItWithDavid | 5,168 Kb |
Material design buttons | Fischaela | 4,381 Kb |
Box Shadow Effects | Retrofuturistic | 2,143 Kb |
Shopping cart | Andiio | 6,581 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!