所以我试图让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>