5

I tried to rotate an image in javascript using the new Image() I tried with this:

this.gunner = new Image()
this.gunner.src = *url*
this.gunner.style.WebkitTransform = "rotate(20deg)"

but the image still was like normal.

How can I do this?

1 Answers1

3

Try this:

var image = new Image();
image.src = 'http://placehold.it/350x150';
document.body.append(image);
image.style.transform = "rotate(90deg)";
meltuhamy
  • 3,293
  • 4
  • 23
  • 22