`
李俊良
  • 浏览: 143905 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

html5 canvas實踐

阅读更多

 

/*这部分是主要的js方面的,只测试过chrome浏览器*/

Array.prototype.S=String.fromCharCode(2);

Array.prototype.in_array=function(e)
{
var r=new RegExp(this.S+e+this.S);
return (r.test(this.S+this.join(this.S)+this.S));
}
Array.prototype.matching_math = function(){
	var re = 0;
	for(var i = 0 ; i < this.length ; i++){
		re += parseInt(this[i]);
	}
	return re;
}
function Region(x,y,width,height){
	this.x = x;
	this.y = y;
	this.width = width;
	this.height = height;
}
function Matching(h_num,v_num,container,level,gamedata){
	this.regions = [];
	this.canvas = document.getElementById("canvas");
	this.ctx = canvas.getContext("2d");
	this.gamedata = gamedata;
	this.t = null;
	this.w = 60;
	this.h = 60;
	this.level = level;
	this.param = (h_num*v_num) / 2;
	this.h_num = h_num;
	this.v_num = v_num;
	this.container = $(container);
	this.linkpath = [];
	this.sourceNode = "";
	this.currentNode = "";
	this.loadcount = 0;
	this.mapdata = (function(){
		var imgarr = [];
		
		for(var i = 0 ; i < level ; i++){
			var temp = i+1;
			imgarr[i] = temp;
		}
		return imgarr;
	})();
	this.paramdata = (function(){ //  返回有對應圖片的對數
		
		var imgarr = [];
		var pushpos = 0;
		var maxData = (function(){
			var r = 0;
			for(var i = 0 ; i < gamedata.length ; i++){
				for(var j = 0 ; j < gamedata[i].length ; j++){
					if(gamedata[i][j] == 0)
						r += 1;
				}
			}
			return r;
		})();
		while(parseInt(imgarr.matching_math()) < maxData/2){
			imgarr[pushpos] = imgarr[pushpos] ? imgarr[pushpos] + 1:1;
			pushpos = pushpos == (level-1) ? 0 : (pushpos +1);
			
		}
		return imgarr;
	})();
	this.couple = (h_num*v_num) / 2;
}

Matching.prototype = {
	getPoint:function(){
		var m = this.gamedata;
		var point = [];
		
		for(var i = 0 ; i < m.length ; i++){
			if(!m[i])
				break;
			for(var j = 0 ; j < m[i].length ; j++){
				if(m[i][j] > -1){
					var p = i+"_"+j;
					point.push(p);
				}
					
			}
		}
		return point;
	},
	getparam:function(){
		return this.paramdata;
	},
	getmapdata:function(){
		return this.mapdata;
	},
	matchingoneline:function(pos,position){
		//console.log("開始查找路徑");
		
		/*
			matching just use one line
			水平判斷
		*/
		var sxpos = this.sourceNode.split(",")[0];
		var sypos = this.sourceNode.split(",")[1];
		var cxpos = this.currentNode.split(",")[0];
		var cypos = this.currentNode.split(",")[1];
		if(position == "yline"){
			//console.log("yline");

			
			
			
			var startpos = parseInt(cypos) > parseInt(sypos) ? sypos:cypos;
			var endpos = parseInt(cypos) < parseInt(sypos) ? sypos:cypos;
			var distance = Math.abs(parseInt(endpos) - parseInt(startpos));
			var loopcount = 0;
			//console.log("start pos:"+startpos+"   end pos:"+endpos);
			for(var i = parseInt(startpos)+1 ; i < parseInt(endpos) ; i++){
				//console.log($("div.map_"+pos+"_"+i).attr("data"));
				if(this.gamedata[pos][i] == "-1"){
					loopcount++;
				}
			}
			if(distance == 1 || loopcount ==  distance-1){
				//console.log("["+cxpos+","+cypos+"] ["+sxpos+","+sypos+"] xline pos="+pos);
				this.drawline(this.sourceNode,pos+","+sypos,pos+","+cypos,this.currentNode);
				return true;
				
			}else
				return false;
		}
		/*
			matching just use one line
			垂直方向判斷
		*/
		
		if(position == "xline"){
			//console.log("xline");
			
			var startpos = parseInt(cxpos) > parseInt(sxpos) ? sxpos:cxpos;
			var endpos = parseInt(cxpos) < parseInt(sxpos) ? sxpos:cxpos;
			
			var distance = Math.abs(parseInt(endpos) - parseInt(startpos));
			
			
			var loopcount = 0;
			//console.log("start pos:"+startpos+"   end pos:"+endpos);
			for(var i = parseInt(startpos)+1 ; i < parseInt(endpos) ; i++){
			
				if(this.gamedata[i][pos] == "-1" ){
					loopcount++;
				}
			}
			if(distance == 1 || loopcount ==  distance-1){
				//console.log("["+cxpos+","+cypos+"] ["+sxpos+","+sypos+"] xline pos="+pos);
				this.drawline(this.sourceNode,sxpos+","+pos,cxpos+","+pos,this.currentNode);
				return true;
				
			}else
				return false;
		}
		
	},
	findit:function(){		
		var sxpos = parseInt(this.sourceNode.split(",")[0]);
		var sypos = parseInt(this.sourceNode.split(",")[1]);
		var cxpos = parseInt(this.currentNode.split(",")[0]);
		var cypos = parseInt(this.currentNode.split(",")[1]);
		/*
			新算法
			先查找對應的水平或者垂直方向的公共區域,然后判斷兩點是否連通
		*/
		var sxEl = [],
			cxEl = [],
			syEl = [],
			cyEl = [];
		// push sxpos and sypos where =-1
		for(var i = sxpos-1 ; i > -1 ; i--){
			if(this.gamedata[i][sypos] == "-1")
				sxEl.push(i);
			else
				break;
		}
		for(var i = sxpos+1 ; i < this.v_num+2 ; i++){
			if(this.gamedata[i][sypos] == "-1")
				sxEl.push(i); 
			else
				break;
		}
		sxEl.push(sxpos);
		
		for(var i = sypos-1 ; i > -1 ; i--){
			if(this.gamedata[sxpos][i] == "-1")
				syEl.push(i); 
			else
				break;
		}
		for(var i = sypos+1 ; i < this.h_num+2; i++){
			if(this.gamedata[sxpos][i] == "-1")
				syEl.push(i); 
			else
				break;
		}
		syEl.push(sypos);
		
		// push cxpos and cypos where =-1
		for(var i = cxpos-1 ; i > -1 ; i--){
			if(this.gamedata[i][cypos] == "-1")
				cxEl.push(i); 
			else
				break;
		}
		for(var i = cxpos+1 ; i < this.v_num+2 ; i++){
			if(this.gamedata[i][cypos] == "-1")
				cxEl.push(i); 
			else
				break;
		}
		cxEl.push(cxpos);
		
		for(var i = cypos-1 ; i > -1 ; i--){
			if(this.gamedata[cxpos][i] == "-1")
				cyEl.push(i); 
			else
				break;
		}
		for(var i = cypos+1 ; i < this.h_num +2; i++){
			if(this.gamedata[cxpos][i] == "-1")
				cyEl.push(i); 
			else
				break;
		}
		cyEl.push(cypos);
		/*
		console.log("cxEl:"+cxEl);
		console.log("cyEl:"+cyEl);
		console.log("sxEl:"+sxEl);
		console.log("syEl:"+syEl);
		*/
		/* 查找X方向相同點 */
		var samexpos = [],sameypos = [];
		for(var i = 0 ; i < sxEl.length ; i++){
			for(var j = 0 ; j < cxEl.length ; j++){
				if(sxEl[i] == cxEl[j])
					sameypos.push(parseInt(cxEl[j]));
			}
		}
		
		
		
		
		/* 查找y方向相同點 */
		for(var i = 0 ; i < syEl.length ; i++){
			for(var j = 0 ; j < cyEl.length ; j++){
				if(syEl[i] == cyEl[j])
					samexpos.push(parseInt(cyEl[j]));
			}
		}
		//console.log("same y pos:"+samexpos);
		//console.log("same x pos:"+sameypos);
		
		for(var i = 0 ; i < samexpos.length ; i++){
			if(this.matchingoneline(samexpos[i],"xline")){
				return true;
				break;
			}
		}
		
		for(var i = 0 ; i < sameypos.length ; i++){
			if(this.matchingoneline(sameypos[i],"yline")){
				return true;
				break;
			}
		}
		
		
		
		return false;
	},
	drawpoint:function(sourceEl,currentEl){

		
		var sxpos = parseInt(sourceEl.split(",")[0]);
		var sypos = parseInt(sourceEl.split(",")[1]);
		var cxpos = parseInt(currentEl.split(",")[0]);
		var cypos = parseInt(currentEl.split(",")[1]);
		if(sxpos == cxpos && sypos == cypos)
			return;
        this.ctx.beginPath();
		this.ctx.lineWidth = 6;
		this.ctx.strokeStyle = "#1b85c1";
        this.ctx.moveTo((sypos+1) * 66  - 30 ,(sxpos+1) * 66  - 30  );
        this.ctx.lineTo((cypos+1) * 66  - 30 ,(cxpos+1) * 66  - 30 );
        this.ctx.stroke();
	},
	playerMp3:function(){
			var p = $("<div></div>");
			p.appendTo("body");
			var player = p.jPlayer({
				ready: function () {
					$(this).jPlayer("setMedia", {
						mp3: "js/dp.mp3"
					}).jPlayer("play");
				},
				ended: function (event) {
					$(this).jPlayer("destroy");
					p.remove();
				},
				swfPath: "js",
				supplied: "mp3"
			});
		
	},
	drawline:function(osEl,sEl,ocEl,cEl){
		//this.ctx.save();
		//console.log(osEl+" to "+sEl+" to "+ocEl+" to "+cEl);
		this.drawpoint(osEl,sEl);
		this.drawpoint(sEl,ocEl);
		this.drawpoint(ocEl,cEl);
		var _this = this;
		setTimeout(function(){
			_this.ctx.clearRect(0,0,_this.canvas.width,_this.canvas.height);

			var sxpos = parseInt(osEl.split(",")[0]);
			var sypos = parseInt(osEl.split(",")[1]);
			var cxpos = parseInt(cEl.split(",")[0]);
			var cypos = parseInt(cEl.split(",")[1]);
			
			_this.sourceNode = "";
			_this.currentNode = "";
			_this.gamedata[sxpos][sypos] =-1;
			_this.gamedata[cxpos][cypos] =-1;
			//重新绘制map
			_this.map();
			_this.drawCurrentMap();
		},200);

		this.playerMp3();
		
	},
	dbparam:function(){
		var param = this.getparam();
		for(var i = 0 ; i < param.length ; i++){
			param[i] *= 2;
		}
		
		return param;
	},
	loadpic:function(){
		var _this = this;
		
		var param = this.getparam();
		var datas = this.getmapdata();
		var dbparam = this.dbparam();
		for(var i = 0 ; i < this.v_num+2 ; i++){
			for(var j = 0 ; j < this.h_num+2;j++){
				for(var m = 0 ; m < this.level ; m++){
					if(parseInt(dbparam[m]) > 0 && this.gamedata[i][j] == 0){
						dbparam[m]--;
						this.gamedata[i][j] = m;
						break;
					}
				}
			}
		}
		var localdata = this.gamedata;
		var allpoint = this.getPoint();
		//console.log(allpoint);
		var pointlen = allpoint.length;
		for(var i = 0 ; i < 2000 ; i++){
			var posrotate1=parseInt(Math.random()*pointlen);
			var posrotate2=parseInt(Math.random()*pointlen);
			var x1 = parseInt(allpoint[posrotate1].split("_")[0]);
			var y1 = parseInt(allpoint[posrotate1].split("_")[1]);
			var x2 = parseInt(allpoint[posrotate2].split("_")[0]);
			var y2 = parseInt(allpoint[posrotate2].split("_")[1]);

			var temp = localdata[x1][y1];
			localdata[x1][y1] = localdata[x2][y2];
			localdata[x2][y2] = temp;
		}
		
		//打亂了之后的數據
		this.drawCurrentMap();
		$(this.canvas).bind("click",{_this:this},this.clickFun);
		this.gamedata = localdata;
		
	},
	drawCurrentMap:function(){
		var _this = this;
		
		if(_this.loadcount == 17){
			for(var i = 0 ; i < _this.v_num+2 ; i++){
				for(var j = 0 ; j < _this.h_num+2;j++){
					if(_this.gamedata[i][j] > -1){
						var p = new Image();
						p.src="images/"+(_this.gamedata[i][j] + 1)+".png";
						_this.ctx.clearRect(j*60+6*(j+1), i*60+6*(i+1), 60, 60);
						_this.ctx.fillStyle="#FFF";
						_this.ctx.fillRect (j*60+6*(j+1), i*60+6*(i+1), 60, 60);
						_this.ctx.drawImage(p,j*60+6*(j+1), i*60+6*(i+1), 60, 60);
							//p = null;
					}
			
				}
			}
		}else{
			for(var i = 1; i <= 17 ; i++){
				var p = new Image();
				p.onload = function(){_this.loadcount++};
				p.src="images/"+i+".png";
			}
			var cc = setInterval(function(){
				if(_this.loadcount == 17){
					for(var i = 0 ; i < _this.v_num+2 ; i++){
						for(var j = 0 ; j < _this.h_num+2;j++){
							if(_this.gamedata[i][j] > -1){
								var p = new Image();
								p.src="images/"+(_this.gamedata[i][j] + 1)+".png";
								_this.ctx.clearRect(j*60+6*(j+1), i*60+6*(i+1), 60, 60);
								_this.ctx.fillStyle="#FFF";
								_this.ctx.fillRect (j*60+6*(j+1), i*60+6*(i+1), 60, 60);
								_this.ctx.drawImage(p,j*60+6*(j+1), i*60+6*(i+1), 60, 60);
								//p = null;
							}
				
						}
					}
					clearInterval(cc);
					cc = null;
				}
			},50);
		}
		
	},
	clickFun:function(e){
		
		var _this = e.data._this;
		//console.log(_this.gamedata);
		var mouseX = e.clientX - canvas.offsetLeft;
		var mouseY = e.clientY - canvas.offsetTop;
		var topStock = parseInt(mouseX / 66,10);	// 判斷左側的格子個數
		var leftStock = parseInt(mouseY / 66,10);	// 判斷頂部的格子個數
		if(_this.gamedata[leftStock][topStock] == "-1")
			return;
		if(_this.sourceNode == ""){
			
			
			_this.drawStoneImage(leftStock,topStock,0.5);
			//console.log("mouseX:"+mouseX + ",mouseY:"+mouseY);
			//console.log("leftStock:"+leftStock + ",topStock:"+topStock);
			
			_this.sourceNode = leftStock+","+topStock;
		}else{
			_this.currentNode = leftStock+","+topStock;
			var sx = parseInt(_this.sourceNode.split(",")[0]);
			var sy = parseInt(_this.sourceNode.split(",")[1]);
			var cx = parseInt(_this.currentNode.split(",")[0]);
			var cy = parseInt(_this.currentNode.split(",")[1]);

			if(_this.currentNode == _this.sourceNode || _this.gamedata[sx][sy] != _this.gamedata[cx][cy]){
				_this.drawStoneImage(cx,cy);
				_this.drawStoneImage(sx,sy);

				_this.currentNode = "";
				_this.sourceNode = "";
				
				//console.log("mouseX:"+mouseX + ",mouseY:"+mouseY);
				//console.log("leftStock:"+leftStock + ",topStock:"+topStock);
			}else{
				_this.drawStoneImage(cx,cy,0.5);
				// _this.findPath()
				if(_this.findit()){
					//console.log("find it");
					_this.clearImage(cx,cy);
					_this.clearImage(sx,sy);
				}else{
					//console.log("findn't it");
					_this.drawStoneImage(cx,cy);
					_this.drawStoneImage(sx,sy);
				}
			}
		}
	},
	drawStoneImage:function(x,y,transparent){
		var trans = transparent || 1;
		var p = new Image();				
		p.src="images/"+(parseInt(this.gamedata[x][y]) + 1)+".png";
		this.ctx.clearRect(y*60+6*(y+1), x*60+6*(x+1), 60, 60);
		this.ctx.fillStyle = "rgba(255, 255, 255, "+trans+")";
		if(trans != 1){
			/*畫上圖片*/
			this.ctx.drawImage(p,y*60+6*(y+1), x*60+6*(x+1), 60, 60);
			/*畫上透明背景*/
			this.ctx.fillRect (y*60+6*(y+1), x*60+6*(x+1), 60, 60);
		}else{
			this.ctx.fillRect (y*60+6*(y+1), x*60+6*(x+1), 60, 60);
			this.ctx.drawImage(p,y*60+6*(y+1), x*60+6*(x+1), 60, 60);
		}
		p = null;
	},
	clearImage:function(x,y){
		return;
		var trans = 1;
		this.ctx.clearRect(y*60+6*(y+1), x*60+6*(x+1), 60, 60);
		this.ctx.fillStyle = "rgba(255, 255, 255, "+trans+")";
		
	
		/*畫上透明背景*/
		this.ctx.fillRect (y*60+6*(y+1), x*60+6*(x+1), 60, 60);
		this.sourceNode = "";
		this.currentNode = "";
		this.gamedata[x][y] = -1;
		
	},
	map:function(){
		var htmlstring = "";
		var box_count = 0;
		
		this.ctx.fillStyle = "rgb(0,0,0)";
		this.ctx.fillRect (0, 0, canvas.width, canvas.height);
		for(var i = 0 ; i < this.v_num+2 ; i++){
			for(var j = 0 ; j < this.h_num+2;j++){
				this.ctx.fillStyle="#FFF";
				this.ctx.fillRect (j*60+6*(j+1), i*60+6*(i+1), 60, 60);
			}
		}
		
	}
}

/*canvas event*/




var mapdata = [
[0,0,0,0,0,0,0,0,0,0,0],
[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0],
[0,0,0,0,0,0,0,0,0,0,0],
[0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
[0,0,0,0,0,0,0,0,0,0,0],
[-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0],
[0,0,0,0,0,0,0,0,0,0,0],
[0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1],
];
var matching = new Matching(9,6,"#canvas",17,mapdata);
matching.map();
$(".console a").click(function(e){
	e.preventDefault();
	matching.loadpic();
			
});



 

再利用websockets就可以做成對戰版本了

源碼下載地址是

 http://www.css-ajax.com/html5/game/usecanvas.zip

1
5
分享到:
评论

相关推荐

    HTML5 Canvas实现鼠标跟随式金属融化动画特效源码.zip

    总的来说,这个源码实例结合了Canvas的基本绘图、动画控制、事件监听以及可能的图像处理技术,为学习者提供了一个生动的HTML5 Canvas实践案例。通过研究和理解这个源码,开发者可以深化对HTML5 Canvas API的理解,并...

    HTML5 Canvas核心技术代码

    这个压缩包“HTML5 Canvas核心技术代码”很可能包含了《HTML5 Canvas核心技术》这本书中的示例代码,用于帮助读者深入理解并实践Canvas的各种功能。 1. **Canvas基本概念**: - Canvas是一个HTML元素,通过...

    html5 canvas 游戏

    这个游戏不仅展示了HTML5 Canvas的技术潜力,也为学习者提供了一个很好的实践案例,通过研究源代码,可以深入了解Canvas的绘图和游戏开发原理。同时,这个小游戏也表明,HTML5 Canvas不仅可以用于复杂的可视化应用,...

    HTML5 Canvas 游戏开发实战PDF+源码

    通过《HTML5 Canvas游戏开发实战》的学习,开发者不仅能掌握Canvas的基本绘图技巧,还能深入了解HTML5游戏开发流程,结合实际项目源码,将理论知识转化为实践能力。这是一本对初学者友好,同时对有经验的开发者也颇...

    HTML5 Canvas核心技术.pdf

    HTML5 Canvas是现代网页开发中一种极为重要的图形绘制技术。它允许在网页上绘制图形,通过JavaScript控制图形的绘制细节,让网页不仅仅局限于展示静态内容,而是可以实现动态的、交互式的图形绘制。本书名为“HTML5 ...

    html5,canvas扇形菜单

    HTML5和Canvas是现代网页开发中的重要技术,它们为创建动态、交互式的用户界面提供了强大的工具。Canvas是HTML5的一个核心元素,它允许开发者通过JavaScript在网页上进行2D绘图,无需借助Flash或其他插件。这个...

    canvas粒子球.rar

    总的来说,“canvas粒子球”是一个很好的HTML5 Canvas实践案例,它展示了如何结合HTML、CSS和JavaScript来创建动态的、互动的网页效果。通过深入理解并掌握这些技术,开发者可以创造出更多富有创意的网页交互体验。

    HTML5 Canvas一群鸟空中盘旋动画特效

    HTML5 Canvas是Web开发中...总的来说,"HTML5 Canvas一群鸟空中盘旋动画特效"是一个结合了Canvas绘图、动画原理、数学模拟以及JavaScript编程技巧的综合应用案例,对于学习和掌握HTML5 Canvas技术有着很好的实践价值。

    HTML5 Canvas核心技术—图形、动画与游戏开发一书源代码

    "HTML5 Canvas核心技术—图形、动画与游戏开发"这本书深入浅出地介绍了Canvas的核心概念和实践技巧,通过丰富的示例代码帮助初学者快速掌握这一技术。 1. **Canvas基础** - **绘图上下文**:Canvas API主要通过`...

    html5 canvas模拟满天星空背景动画特效

    总的来说,"html5 canvas模拟满天星空背景动画特效"是一个综合运用了Canvas API、动画原理、随机生成、事件处理等技术的项目,通过学习和实践,可以深入理解HTML5 Canvas的强大功能和动画制作技巧。

    html5 canvas核心技术

    HTML5 Canvas是Web开发中的一个关键技术,...通过学习和实践这些HTML5 Canvas的核心技术,开发者可以构建出交互性强、视觉效果丰富的Web应用程序,无论是数据可视化、游戏开发还是艺术创作,Canvas都能提供强大的支持。

    HTML5 Canvas全屏背景动画特效

    在这个“HTML5 Canvas全屏背景动画特效”的主题中,我们将深入探讨如何利用Canvas来创建引人注目的全屏动画背景,以及相关的编程技术和实践技巧。 一、Canvas基础 1. Canvas元素:HTML5引入的Canvas是一个二维绘图...

    html5 canvas 小游戏

    HTML5 Canvas是一个强大的Web图形接口,它允许开发者在网页上绘制矢量图形和位图图像。这个"html5 canvas 小游戏"是一个基于Canvas的互动游戏,通过JavaScript编程语言实现。JavaScript是Web开发中用于创建动态和...

    开源的HTML5 Canvas画图插件 - Literally Canvas

    《开源的HTML5 Canvas画图插件 - Literally Canvas详解》 HTML5的Canvas元素为网页带来了强大的图形绘制能力,而Literally Canvas则是一个优秀的基于Canvas的开源画图插件,它提供了一套完整的画图工具,使得用户...

    html5 canvas文字放射发光动画特效

    HTML5 Canvas是Web开发中的一个强大工具,它允许开发者在网页上进行动态图形绘制,无需依赖任何外部插件。这款“html5 canvas文字放射发光动画特效”利用了Canvas API的功能,创造出引人注目的视觉效果,尽管可能在...

    Foundation HTML5 Canvas For Games and Entertainment

    HTML5 Canvas是Web开发中的一个强大工具,它允许开发者在网页上进行动态图形绘制,为游戏和娱乐应用提供了丰富的可能性。这本书"Foundation HTML5 Canvas For Games and Entertainment"深入浅出地探讨了如何利用...

    html5 canvas米字格式手写文字练习代码.zip

    总的来说,这个压缩包提供了一个基于HTML5 Canvas、jQuery和CSS的实践案例,用于学习和练习手写文字的绘制及特效制作。通过深入研究这些文件,开发者不仅可以提升Canvas绘图技能,还能了解如何将jQuery与Canvas结合...

    html5 canvas马赛克滚动调整

    HTML5 Canvas是Web开发中的一个强大工具,它允许开发者在网页上进行动态图形绘制,创造出丰富的交互式用户体验。"马赛克滚动调整"这个主题主要涉及Canvas如何实现马赛克效果,并且这种效果还能随着用户的滚动操作...

    HTML5 Canvas核心技术—图形、动画与游戏开发【扫描版PDF(71M)+试读章节+源码】

    本书“HTML5 Canvas核心技术—图形、动画与游戏开发”深入探讨了这一技术的核心概念和实践应用,对于想要掌握Canvas的开发者来说是一份宝贵的资源。 在试读章节中,读者可能会接触到以下基础概念: 1. **Canvas元素...

Global site tag (gtag.js) - Google Analytics