setTimeout无法正常工作并尝试更改图像

时间:2014-02-25 21:37:27

标签: javascript html5

所以我试图让setTimeout激活我的enteranimation()函数,但它只是拒绝,我试图让这一切都在canvas元素内部工作,我不想让它切换到其他图片让它看起来像动画。任何想法?

的JavaScript

setTimeout("enteranimation()",3000);

var enteranim = new Array(5);   
var curenter = 0;

function enteranimation() {
var mycanvas = document.getElementById("myCanvas");
var context = myCanvas.getContext("2d");
var enterpic0 = new Image();
var enterpic1 = new Image();
var enterpic2 = new Image();
var enterpic3 = new Image();
var enterpic4 = new Image();
 enterpic0.src = "images/enter0.png";
enterpic1.src = "images/enter1.png";
enterpic2.src = "images/enter2.png";
enterpic3.src = "images/enter3.png";
enterpic4.src = "images/enter4.png";

context.drawImage(enterpic0,0,0);

}

HTML

<a href="intro.html"><canvas class="enterbutton" id="myCanvas" width="239" height="64">

</canvas></a>

0 个答案:

没有答案