7-2的练习题

来源:7-2 编程练习

慕函数3468989

2018-11-25 11:18:51

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8" />

    <title>Document</title>

    <style>

        canvas{background-color:lightblue;}

    </style>

</head>

<body>

    <canvas id="canvas" width="800px" height="800px">

        您的浏览器不支持canvas

    </canvas>

    <script>

        var canvas=document.getElementById("canvas");

        var context=canvas.getContext("2d");

        //在此处补充代码

        context.arc(400,400,100,0,2*Math.PI,true);

         context.clip();

         context.fillStyle='#90ee90';

         context.fillRect(300,300,100,100);

         context.fillStyle='#800080';

         context.fillRect(400,300,100,100);

        context.fillStyle='#ffa500';

        context.fillRect(300,400,100,100);

        context.fillStyle='#ffc0cb';

        context.fillRect(400,400,100,100)



    </script>

</body>

</html>

 


写回答

1回答

好帮手慕星星

2018-11-26

效果图中可以看到圆是有边框的,绘制完圆之后可以填充一下:

http://img.mukewang.com/climg/5bfb538f0001291708130136.jpg

整体效果是不错的,继续加油!

0

0 学习 · 4826 问题

查看课程

相似问题

7-2的练习题

回答 2

7-7练习

回答 1

2-5编程练习

回答 1

6-2练习

回答 1