Drawing board

Size
1,985 Kb
Views
64,768

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 Previews

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();
Drawing board - Script Codes
Drawing board - Script Codes
Home Page Home
Developer Quincy Soeliman
Username quincysoeliman
Uploaded July 22, 2022
Rating 3
Size 1,985 Kb
Views 64,768
Do you need developer help for Drawing board?

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!

Quincy Soeliman (quincysoeliman) Script Codes
Create amazing Facebook ads with AI!

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!