Hey guys i'm currently working on a small game and i've been trying to use css to flip horizontally an image like so:
JS
sprite = new Image(13, 32);
sprite.src = w1.png;// stored locally i know but i dont intend to sell this:)
if (player.velX < 0) {
sprite.setAttribute("class", "flip")
if (player.velX > 0) {
sprite.removeAttribute("class", "flip")
CSS
.flip {
-moz-transform: scaleX(-1);
-o-transform: scaleX(-1);
-webkit-transform: scaleX(-1);
transform: scaleX(-1);
}
so is the problem the fact that i'm creating the img element in JS ?
(btw i use functions to change the sprite's src somewhere else in the code is that the problem ? (do you need some of that code too ?)