canvas最简程序

复制代码
<html>
<head>
    <script>
    window.onload = function(){
        var canvas = document.getElementById("cc");
        var context = canvas.getContext("2d");
        context.fillStyle = "red";
        context.fillRect(0, 0, 1000, 1000);
        context.fillStyle = "black";
        context.fillRect(10,10,100,100);
    }
    </script>
</head>
<body>
    <canvas id="cc" width=300 height=300></canvas>
</body>
</html>
复制代码

 

posted @   fff8965  阅读(149)  评论(0编辑  收藏  举报
努力加载评论中...
点击右上角即可分享
微信分享提示