猿问

看大家的回答改了代码,还是相同的报错。。一脸懵逼

var can1;

var can2;

var ctx1;

var ctx2;

var lastTime;

var deltaTime;

document.body.onload = game;

function game()

{

init();

gameloop();

}

function init()

{

can1 = document.getElementById("canvas1");

ctx1 = can1.getContext('2d');

can2 = document.getElementById("canvas2");

ctx2 = can2.getContext();

}

function gameloop()

{

window.requestAnimFrame(gameloop);

}

称霸一世
浏览 1205回答 1
1回答

KXFT

两个都改成getContext("2d")can1 = document.getElementById("canvas1");ctx1 = can1.getContext("2d");can2 = document.getElementById("canvas2");ctx2 = can2.getContext("2d");
随时随地看视频慕课网APP
我要回答