HTML 5 Canvas Example

Developer
Size
2,026 Kb
Views
6,072

How do I make an html 5 canvas example?

What is a html 5 canvas example? How do you make a html 5 canvas example? This script and codes were developed by Victor Yan on 05 January 2023, Thursday.

HTML 5 Canvas Example Previews

HTML 5 Canvas Example - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>HTML 5 Canvas Example</title> <link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'>
</head>
<body> <div class="container"> <h2>HTML 5 Canvas Example</h2> <div class="row"> <div class="col-sm-3"> <h4>Draw Line</h4> <canvas id="myCanvasLine" width="200" height="100" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> </div> <div class="col-sm-3"> <h4>Draw Circle</h4> <canvas id="myCanvas" width="200" height="100" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> </div> </div> <div class="row"> <div class="col-sm-3"> <h4>Draw Text</h4> <canvas id="myCanvasText" width="200" height="100" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> </div> <div class="col-sm-3"> <h4>Draw Stroke Text</h4> <canvas id="myCanvasStrokeText" width="200" height="100" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> </div> </div> <div class="row"> <div class="col-sm-3"> <h4>Draw Linear Gradient</h4> <canvas id="myCanvasGradient1" width="200" height="100" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> </div> <div class="col-sm-3"> <h4>Draw Radial/Circular Gradient</h4> <canvas id="myCanvasGradient2" width="200" height="100" style="border:1px solid #d3d3d3;"> Your browser does not support the HTML5 canvas tag.</canvas> </div> </div> <div>Provided by <a onclick="window.open('https://www.tipsoftheday.com.au')">Tips of the day</a></div>
</div> <script src="js/index.js"></script>
</body>
</html>

HTML 5 Canvas Example - Script Codes JS Codes

 var c = document.getElementById("myCanvas"); var ctx = c.getContext("2d"); ctx.beginPath(); ctx.arc(95,50,40,0,2*Math.PI); ctx.stroke(); var c = document.getElementById("myCanvasLine"); var ctx = c.getContext("2d"); ctx.moveTo(0,0); ctx.lineTo(200,100); ctx.stroke(); var c = document.getElementById("myCanvasText"); var ctx = c.getContext("2d"); ctx.font = "30px Arial"; ctx.fillText("Hello World",10,50); var c = document.getElementById("myCanvasStrokeText"); var ctx = c.getContext("2d"); ctx.font = "30px Arial"; ctx.strokeText("Hello World",10,50); var c = document.getElementById("myCanvasGradient1"); var ctx = c.getContext("2d"); // Create gradient var grd = ctx.createLinearGradient(0,0,200,0); grd.addColorStop(0,"red"); grd.addColorStop(1,"white"); // Fill with gradient ctx.fillStyle = grd; ctx.fillRect(10,10,150,80); var c = document.getElementById("myCanvasGradient2"); var ctx = c.getContext("2d"); // Create gradient var grd = ctx.createRadialGradient(75,50,5,90,60,100); grd.addColorStop(0,"red"); grd.addColorStop(1,"white"); // Fill with gradient ctx.fillStyle = grd; ctx.fillRect(10,10,150,80);
HTML 5 Canvas Example - Script Codes
HTML 5 Canvas Example - Script Codes
Home Page Home
Developer Victor Yan
Username tipsoftheday
Uploaded January 05, 2023
Rating 3
Size 2,026 Kb
Views 6,072
Do you need developer help for HTML 5 Canvas Example?

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!

Victor Yan (tipsoftheday) Script Codes
Create amazing love letters 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!