• canvas-0scale.html


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Document</title>
    </head>
    <body>
        <canvas id="canvas" style="margin:0 auto;border:1px #ddd solid">
            The current browser does not support Canvas, can replace the browser a try!
        </canvas>
    
        <script>
    
            window.onload = function(){
                var canvas = document.getElementById('canvas');
    
                canvas.width = 1024;
                canvas.height = 768;
    
                if(canvas.getContext('2d')){
                    var context = canvas.getContext('2d');
    
                    context.lineWidth = 5;
    
                    context.save();
                        context.scale(1,1);
                        context.strokeRect(50,50,200,200);
                    context.restore();
    
                    context.save();
                        context.scale(2,2);
                        context.strokeRect(50,50,200,200);
                    context.restore();
    
                    context.save();
                        context.scale(3,3);
                        context.strokeRect(50,50,200,200);
                    context.restore();
        
    
                }else{
                    alert('当前游览器不支持Canvas,请更换游览器后再试!');
                }
            }
    
        </script>
    </body>
    <script>
        /*图形变换
    
            位移 translate(x,y)
    
            旋转 rotate(deg)
    
            缩放 scale(sx,sy) :
                原点、边框、大小 都scale了
    
    
    
        变换矩阵 trasform
            a c e
            b d f
            0 0 1
    
            a 水平缩放(1)
            b 水平倾斜(0)
            c 垂直倾斜(0)
            d 垂直缩放(1)
            e 水平位移(0)
            f 垂直位移(0)
            
        */
    </script>
    </html>
  • 相关阅读:
    积性函数前缀和
    CF1067D Computer Game
    Atcoder Tenka1 Programmer Contest 2019 题解
    Codeforces Round #549 (Div. 1) 题解
    SHOI2019旅游记
    CF871D Paths
    CF1065E Side Transmutations
    停更公告
    博客说明
    SCOI2019酱油记
  • 原文地址:https://www.cnblogs.com/cynthia-wuqian/p/4978317.html
Copyright © 2020-2023  润新知