Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! HTTP/1.1 503 Service Temporarily Unavailable in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
HTML5+js绘图:canvas - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


一些教程:

Firefox的教程:

https://developer.mozilla.org/zh-CN/docs/Web/API/Canvas_API

https://developer.mozilla.org/zh-CN/docs/Learn/JavaScript/Client-side_web_APIs/Drawing_graphics   


菜鸟教程:

https://www.runoob.com/w3cnote/html5-canvas-intro.html





根据页面大小动态创建一个画布:

<canvas class="myCanvas">
    <p>你的浏览器不支持canvas</p>
</canvas>

<script>
    var canvas = document.querySelector('.myCanvas');
    var width = canvas.width = window.innerWidth;
    var height = canvas.height = window.innerHeight;

    var ctx = canvas.getContext('2d');
</script>




返回首页


Copyright (C) 2018-2024 huidong