English 中文(简体)
采用多式超文本5血管成层图像
原标题:Using multipe HTML5 canvas s to layer images

我开始了一个网络游戏引擎,但主要利用 j子处理间谍和动画,现在我正在学习超文本5的力量,将游乐团移至超文本5。 因此,我在此问:按照的建议,使用multple canvas。 a) 层图像。

这对我来说不可行,即使我制定了Z-index to 999999: 这里是我的法典和法典;

http://snipt.org/xoKn"rel=“nofollow> http://snipt.org/xoKn

物体层不是顶峰,因为!

最佳回答

如果任何人存在同样的问题,我就设法解决这一问题,首先装上第一层,最后是最低层。 很明显,似乎任何负荷都放在首位。

因此,我的解决办法只是把 m物排在我的tile子上。 对我感兴趣的是,没有任何想法认为它首先涉及什么。

问题回答

守则应当发挥作用(至少是处理血管部分)。 我看着你的文字,可能会有装上图像的问题。 你

var tile = new Image();
tile.src = tiles[i][ bg ];
tilesCtx.drawImage(tile, tiles[i][ col ]*32, tiles[i][ row ]*32);

但是,由于图像尚未装满,它赢得了一定的工作。 相反,你应当使用

tile.onload = function(){
  tilesCtx.drawImage(tile, tiles[i][ col ]*32, tiles[i][ row ]*32);
}

or something like that (i.e. you won t have a reference to the i variable so it needs to be modified).

Note that in the tutorial they use setInterval(drawAll, 20); which makes it work after a while (since after a time all images will be loaded).

Of course you may lose ordering of images (although this does not seem to be important), so preloading all images at the begining and then drawing them all at once is a good idea. Give it a try and let us now if it works!





相关问题
CSS working only in Firefox

I am trying to create a search text-field like on the Apple website. The HTML looks like this: <div class="frm-search"> <div> <input class="btn" type="image" src="http://www....

image changed but appears the same in browser

I m writing a php script to crop an image. The script overwrites the old image with the new one, but when I reload the page (which is supposed to pickup the new image) I still see the old one. ...

Firefox background image horizontal centering oddity

I am building some basic HTML code for a CMS. One of the page-related options in the CMS is "background image" and "stretch page width / height to background image width / height." so that with large ...

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签