programming-examples/html/Basics/Drawing an arc onto the canvas.html
2019-11-18 14:44:36 +01:00

23 lines
608 B
HTML

<!DOCTYPE html>
<html subLang="en">
<head>
<meta charset="UTF-8">
<title>Drawing an Arc on Canvas</title>
<style type="text/css">
canvas{
border: 1px solid #000;
}
</style>
<script type="text/javascript">
window.onload = function(){
var canvas = document.getElementById("myCanvas");
var context = canvas.getContext("2d");
context.arc(150, 150, 80, 1.2 * Math.PI, 1.8 * Math.PI, false);
context.stroke();
};
</script>
</head>
<body>
<canvas id="myCanvas" width="300" height="200"></canvas>
</body>
</html>