HTML canvas lineWidth 属性
标签" href="tag-main.html"><main>
<map>
<mark>
<menu>
<meta>
<meter>
<nav>
<noframes>
<noscript>
<object>
<ol>
<optgroup>
<option>
<output>
<p>
<param>
<pre>
<html>
<picture>
<progress>
<q>
<rp>
<rt>
<ruby>
<s>
<samp>
<script>
<section>
<select>
<small>
<source>
<span>
<strike>
<strong>
<style>
<sub>
<summary>
<sup>
<table>
<tbody>
<td>
<textarea>
< template>
<tfoot>
<th>
<thead>
<time>
<title>
<tr>
<track>
<tt>
<u>
<ul>
<var>
<video>
<wbr>
HTML canvas lineWidth 属性
实例
用宽度为 10 像素的线条来绘制矩形:
JavaScript:
var c=document.getElementById("myCanvas");
var ctx=c.getContext("2d");
ctx.lineWidth=10;
ctx.strokeRect(20,20,80,100);
var ctx=c.getContext("2d");
ctx.lineWidth=10;
ctx.strokeRect(20,20,80,100);
浏览器支持
Internet Explorer 9、Firefox、Opera、Chrome 和 Safari 支持 lineWidth 属性。
注意:Internet Explorer 8 及之前的版本不支持 <canvas> 元素。
定义和用法
lineWidth 属性设置或返回当前线条的宽度,以像素计。
| 默认值: | 1 |
|---|---|
| JavaScript 语法: | context.lineWidth=number; |
属性值
| 值 | 描述 |
|---|---|
| number | 当前线条的宽度,以像素计。 |
HTML canvas 参考手册