欢迎大家赞助一杯啤酒🍺 我们准备了下酒菜:Formal mathematics/Isabelle/ML, Formal verification/Coq/ACL2/Agda, C++/Lisp/Haskell
HTML5/canvas
来自开放百科 - 灰狐
				
								
				(版本间的差异)
				
																
				
				
								
小  | 
			小  | 
			||
| 第6行: | 第6行: | ||
第一个例子:  | 第一个例子:  | ||
| − | + |  <html>  | |
  <head>  |   <head>  | ||
   <script type="application/x-javascript">  |    <script type="application/x-javascript">  | ||
| 第13行: | 第13行: | ||
       if (canvas.getContext) {  |        if (canvas.getContext) {  | ||
         var ctx = canvas.getContext("2d");  |          var ctx = canvas.getContext("2d");  | ||
| − | |||
         ctx.fillStyle = "rgb(200,0,0)";  |          ctx.fillStyle = "rgb(200,0,0)";  | ||
         ctx.fillRect (10, 10, 55, 50);  |          ctx.fillRect (10, 10, 55, 50);  | ||
| − | |||
         ctx.fillStyle = "rgba(0, 0, 200, 0.5)";  |          ctx.fillStyle = "rgba(0, 0, 200, 0.5)";  | ||
         ctx.fillRect (30, 30, 55, 50);  |          ctx.fillRect (30, 30, 55, 50);  | ||
| 第28行: | 第26行: | ||
      <a href="http://www.w3.org/html/wg/html5/">HTML5</a>    |       <a href="http://www.w3.org/html/wg/html5/">HTML5</a>    | ||
      <canvas> feature.</p>  |       <canvas> feature.</p>  | ||
| − | |||
    </canvas>  |     </canvas>  | ||
  </body>  |   </body>  | ||
| − | </html  | + |  </html>  | 
==项目==  | ==项目==  | ||
2011年2月13日 (日) 09:41的版本
|   | 
您可以在Wikipedia上了解到此条目的英文信息 HTML5/canvas Thanks, Wikipedia. | 
Convas 是 HTML5 的一部分,它支持动态生成与渲染2D图形、图表、图像和动画。
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">
     This example requires a browser that supports the <a href="http://www.w3.org/html/wg/html5/">HTML5</a> <canvas> feature.
</canvas> </body> </html>
项目
链接
- HTML5: The Canvas Element
 - HTML Canvas 2D Context
 - Canvas tutorial on Mozzila.org
 - HTML5 canvas - the basics on Opera
 
<discussion>characters_max=300</discussion>
	分享您的观点