镜像

作者: antlove | 来源:发表于2019-07-23 09:18 被阅读0次
    <!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

    相关文章

      网友评论

          本文标题:镜像

          本文链接:https://www.haomeiwen.com/subject/isvnlctx.html