I\'m creating a game, and in my game, when the HERO stay near the MONSTER, a gif will be showed, to scare the player. But I have no idea how to do this. I tried to put PHP o
It is not possible to simply draw a .gif (animated!) on the element.
You have two options.
a) you can append the b) You need to learn how to animate stuff. Look up You can draw the Basicly, if you want the animated behavior of a HTML with a .gif (via node) and then layer the via z-Index and css top/left over the , at the correct position. It will mess up with mouse events eventually tho, which can be solved by event propagation. I would consider this a poor mans solution.
window.requestAnimationFrame method. Doing so will allow you to animate on the , which can emulate the .gif behavior you are looking for. It will however be a bit complex at your current level i think..gif on the canvas like the above poster described. However, it will be 100 % static, like a .jpg or .png in that case, unless you manage to dissolve the .gif into its frames and still use the window.requestAnimationFrame method..gif, you will need to make major adjustments.