HTML5 Canvas Intro

Size
1,870 Kb
Views
28,336

How do I make an html5 canvas intro?

What is a html5 canvas intro? How do you make a html5 canvas intro? This script and codes were developed by Mobile Application Design-Development on 10 August 2022, Wednesday.

HTML5 Canvas Intro Previews

HTML5 Canvas Intro - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>HTML5 Canvas Intro</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <body> <canvas id="c" width="600" height="400"></canvas>
</body> <script src="js/index.js"></script>
</body>
</html>

HTML5 Canvas Intro - Script Codes CSS Codes

#c{ width: 600px; height: 400px; border: 1px solid #edf;
}

HTML5 Canvas Intro - Script Codes JS Codes

var c = document.getElementById("c");
var ctx = c.getContext("2d");
ctx.moveTo(100, 200);
ctx.lineTo(200, 50);
ctx.lineWidth = 4;
ctx.strokeStyle = '#BADA55';
ctx.lineTo(10,10);
ctx.stroke();
//create a new layer with BeginPath
ctx.beginPath();
ctx.strokeStyle = 'red';
ctx.moveTo(10,10);
ctx.lineTo(100,100);
ctx.stroke();
//draw an arc
ctx.beginPath();
ctx.strokeStyle = 'black';
ctx.fillStyle = '#123abc';
ctx.lineWidth = 2;
ctx.arc(200, 200, 75, 0, Math.PI, false);
ctx.fill();
ctx.stroke();
//face
ctx.beginPath();
ctx.strokeStyle = 'black';
ctx.fillStyle = 'goldenrod';
ctx.lineWidth = 2;
ctx.arc(200, 200, 75, 0, 2* Math.PI, false);
ctx.fill();
ctx.stroke();
//mouth
ctx.beginPath();
ctx.arc(200, 210, 40, 0.6, Math.PI-0.3, false);
ctx.stroke();
//left eye
ctx.beginPath();
ctx.strokeStyle = 'black';
ctx.fillStyle = 'black';
ctx.lineWidth = 2;
ctx.arc(170, 170, 15, -0.6, Math.PI-0.6, false);
ctx.fill();
ctx.stroke();
//right eye
ctx.beginPath();
ctx.strokeStyle = 'black';
ctx.fillStyle = 'black';
ctx.lineWidth = 2;
ctx.arc(230, 170, 15, 0.6, Math.PI+0.6 , false);
ctx.fill();
ctx.stroke();
HTML5 Canvas Intro - Script Codes
HTML5 Canvas Intro - Script Codes
Home Page Home
Developer Mobile Application Design-Development
Username mad-d
Uploaded August 10, 2022
Rating 3
Size 1,870 Kb
Views 28,336
Do you need developer help for HTML5 Canvas Intro?

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!

Mobile Application Design-Development (mad-d) Script Codes
Create amazing video scripts 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!