HTML5/canvas

来自开放百科 - 灰狐
跳转到: 导航, 搜索
Wikipedia-35x35.png 您可以在Wikipedia上了解到此条目的英文信息 HTML5/canvas Thanks, Wikipedia.

Convas 是 HTML5 的一部分,它支持动态生成与渲染2D图形、图表、图像和动画。

Canvas 3D has now become WebGL.

HTML5 Canvas 将在HTML5游戏中扮演重要角色。

第一个例子:

<html>
<head>
 <script type="application/x-javascript">
   function draw() {
     var canvas = document.getElementById("canvas");
     if (canvas.getContext) {
       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);
     }
   }
 </script>
</head>
<body onload="draw();">
  <canvas id="canvas" width="150" height="150">
   <p>This example requires a browser that supports the
     <a href="http://www.w3.org/html/wg/html5/">HTML5</a> 
     <canvas> feature.</p>
  </canvas>
</body>
</body>
</html>

项目

链接

Comment-32x32.png

<discussion>characters_max=300</discussion>

分享您的观点
个人工具
名字空间

变换
操作
导航
工具箱