久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      Canvas標(biāo)簽是什么意思

      Canvas是可以使用腳本(通常為 JavaScript)在其中繪制圖像的HTML元素。它可以用來制作照片集或者制作簡單(也不是那么簡單)的動(dòng)畫,甚至可以進(jìn)行實(shí)時(shí)視頻處理和渲染。

      Canvas標(biāo)簽是什么意思

      在html中,canvas標(biāo)簽用來定義圖形,比如圖表和其他圖像,必須使用腳本來繪制圖形,例如在畫布上畫一個(gè)紅色矩形,漸變矩形,彩色矩形,和一些彩色的文字。

      1.什么是canvas?

      HTML5canvas元素用于圖形的繪制,通過腳本 (通常是JavaScript)來完成.

      canvas標(biāo)簽只是圖形容器,您必須使用腳本來繪制圖形。

      你可以通過多種方法使用 canvas 繪制路徑,盒、圓、字符以及添加圖像。

      2.Canvas基本使用

      <canvas id="myCanvas" width="200" height="100"

      style="border:1px solid #000000;">

      </canvas>

      2.1 <canvas> 元素

      <canvas> 看起來和 <img> 標(biāo)簽一樣,只是 <canvas> 只有兩個(gè)可選的屬性 width、heigth 屬性,而沒有 src、alt 屬性。

      如果不給 <canvas> 設(shè)置 widht、height 屬性時(shí),則默認(rèn) width為300、height 為 150,單位都是 px。也可以使用 css 屬性來設(shè)置寬高,但是如寬高屬性和初始比例不一致,他會出現(xiàn)扭曲。所以,建議永遠(yuǎn)不要使用 css 屬性來設(shè)置 <canvas> 的寬高。

      2.2案例

      <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>php中文網(wǎng)(php.cn)</title> <style type="text/css"> canvas {     border: 1px solid black; } </style> </head> <body> <canvas id="tutorial" width="300" height="300"></canvas> <script type="text/javascript"> function draw(){     var canvas = document.getElementById('tutorial');     if(!canvas.getContext) return;     var ctx = canvas.getContext("2d");     ctx.fillStyle = "rgb(200,0,0)";       //繪制矩形     ctx.fillRect (10, 10, 55, 50);       ctx.fillStyle = "rgba(0, 0, 200, 0.5)";     ctx.fillRect (30, 30, 55, 50); } draw(); </script> </body> </html>

      效果如下:

      Canvas標(biāo)簽是什么意思

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號