2022-03-19 648
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>小白教程</title> </head> <body> <canvas id="myCanvas" width="150" height="70" style="border:1px solid #d3d3d3;"> 您的浏览器不支持 HTML5 canvas 标签。 </canvas> <script> var c=document.getElementById("myCanvas"); var ctx=c.getContext("2d"); ctx.strokeRect(5,5,25,15); ctx.scale(2,2); ctx.strokeRect(5,5,25,15); </script> </body> </html>
scale元素为缩放当前绘图至更大或更小
注意:如果您对绘图进行缩放,所有之后的绘图也会被缩放。定位也会被缩放。如果您 scale(2,2),那么绘图将定位于距离画布左上角两倍远的位置
scalewidth缩放当前绘图的宽度(1=100%,0.5=50%,2=200%,依次类推)
scaleheight缩放当前绘图的高度(1=100%,0.5=50%,2=200%,依次类推)
原文链接:https://77isp.com/post/763.html
=========================================
https://77isp.com/ 为 “云服务器技术网” 唯一官方服务平台,请勿相信其他任何渠道。
数据库技术 2022-03-28
网站技术 2022-11-26
网站技术 2023-01-07
网站技术 2022-11-17
Windows相关 2022-02-23
网站技术 2023-01-14
Windows相关 2022-02-16
Windows相关 2022-02-16
Linux相关 2022-02-27
数据库技术 2022-02-20
抠敌 2023年10月23日
嚼餐 2023年10月23日
男忌 2023年10月22日
瓮仆 2023年10月22日
簿偌 2023年10月22日
扫码二维码
获取最新动态