當前位置:
首頁 >
前端技术
> javascript
>内容正文
javascript
每天一个JavaScript实例-canvas绘图
生活随笔
收集整理的這篇文章主要介紹了
每天一个JavaScript实例-canvas绘图
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>每天一個JavaScript實例-canvas繪圖</title>
<style>.canvas{width:600px;height:500px;}
</style><script>
window.onload = function(){var imgcanvas = document.getElementById("imgcanvas");if(imgcanvas.getContext){var ctx = imgcanvas.getContext('2d');ctx.fillStyle="rgba(255,0,0,.1)";ctx.strokeStyle = "#000";//第一個ctx.fillRect(0,0,100,100);ctx.strokeRect(0,0,100,100);//第二個ctx.fillRect(50,50,100,200);//第三個ctx.strokeRect(80,130,200,100);}
}
</script></head><body><canvas class="canvas" id = "imgcanvas">
<p>畫布</p></canvas></body>
</html>
轉載于:https://www.cnblogs.com/mfrbuaa/p/4082039.html
總結
以上是生活随笔為你收集整理的每天一个JavaScript实例-canvas绘图的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 余额宝还信用卡要手续费吗?余额宝还款失败
- 下一篇: Spring_HelloWord