html5画布画图时的错误

  

今天在练习的时候照着视频敲了段代码结果运行结果不是这么回事,于是苦苦寻找半天没能解决,

& lt; ! DOCTYPE  html>   & lt; html  lang=癳n”比;   & lt; head>   ,,,& lt; meta  charset=皍tf - 8”比;   ,,,& lt; title> Title   ,,,& lt; script  type=" text/javascript, src=" http://libs.baidu.com/jquery/1.4.2/jquery.min.js "祝辞& lt;/script>   & lt;/head>   & lt; body>   & lt; canvas  id=盎肌?宽度=" 640 ",身高=" 480 ",祝辞& lt;/canvas>   & lt;/body>   & lt; script>   var 上下文={   ,,,canvas :,空,   ,,,context :,空,   ,,,创建:函数(canvas_tag_id) {   ,,,,,,,this.canvas=. getelementbyid (canvas_tag_id);   ,,,,,,,this.context=this.canvas.getContext (2 d);   ,,,,,,,return  this.context;   ,,,}   };   var 雪碧=函数(文件名,is_pattern) {   ,,,this.p_w_picpath=零;   ,,,this.pattern =,空;   ,,,this.TO_RADIANS=Math.PI/180;   ,,,如果(文件名!=undefined ,,,文件名!=" ",和文件名!=null) {   ,,,,,,,this.p_w_picpath=new 图像();   ,,,,,,,this.p_w_picpath.src=https://www.yisu.com/zixun/filename;      如果(is_pattern)//createPattern//console.log(“却;能够is  a 模式”);   ,,,,,,,,,,,this.pattern=Context.context.createPattern (this.p_w_picpath,“重复”);   ,,,,,,,,,,,//return  this.pattern;   ,,,,,,,,,,,//此处赋值错误,火狐中正常,谷歌中错误      还有,,,}{   ,,,,,,,console.log (“unable 用;load 雪碧”);   ,,,}   ,,,this.draw=function (x, y, w, h) {   ,,,,,,//,,,,,,,如果(this.pattern  !=null) {//,,,,,,,,,,,console.log (“pattern  is  not 空”);   ,,,,,,,,,,,Context.context.fillStyle=this.pattern;   ,,,,,,,,,,,Context.context.fillRect (x, y, w h);   ,,,,,,,其他}{      ,,,,,,,,,,//,,,,,,,,,,,如果(w  !=,定义| |,h  !=, undefined ) {   ,,,,,,,,,,,,,,,Context.context.drawImage (this.p_w_picpath, x, y, this.p_w_picpath.width this.p_w_picpath.height);   ,,,,,,,,,,,其他}{   ,,,,,,,,,,,,,,,Context.context.drawImage (this.p_w_picpath, x, y, w h);   ,,,,,,,,,,,}      ,,,,,,,}      ,,,};      ,,,this.rotate=function (x, y,角){   ,,,,,,,Context.context.save ();      ,,,,,,,Context.context.translate (x, y);   ,,,,,,,Context.context.rotate (angle  *, this.TO_RADIANS);      ,,,,,,,Context.context.drawImage (this.p_w_picpath,   ,,,,,,,,,,,,,,,,(this.p_w_picpath.width/2)   ,,,,,,,,,,,,,,,,(this.p_w_picpath.height/2));      ,,,,,,,Context.context.restore ();   ,,,};   }//var  img=new 雪碧(“wall.png”,假);   $(文档)时函数(){   ,,//Initalize   ,,,Context.create(“画布”);      ,,,var 墙=" http://www.tigrisgames.com/wall.png ";   ,,,var 箱=" http://www.tigrisgames.com/crate.png ";      ,,,var 模式=new 雪碧(箱,真实);   ,,,var  p_w_picpath=new 雪碧(墙,假);   ,,,var  p_w_picpath3=new 雪碧(箱、虚假);      ,,,var 角=0;      ,,,setInterval(函数(){   ,,,,,,,Context.context.fillStyle=" # 000000;   ,,,,,,,Context.context.fillRect (0, 0800800);      null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null   null

html5画布画图时的错误