<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>镜像</title>
<style>
body{
background-color:#eee;
}
#canvas{
background-color:#fff;
margin-left:10px;
margin-top:10px;
-box-shadow:4px 4px 8px rgba(0,0,0,0.5);
}
</style>
</head>
<body>
<canvas id="canvas" width="800" height="600"></canvas>
<script>
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
drawHalfCircle();
ctx.translate(canvas.width,0);
ctx.scale(-1,1);
drawHalfCircle();
function drawHalfCircle(){
ctx.beginPath();
ctx.arc(100, 75, 50, 0.5 * Math.PI, 1.5 * Math.PI);
ctx.stroke();
}
</script>
</body>
</html>
镜像.png
网友评论