【问题标题】:Rotate Image in JavaScript with new Image()使用 new Image() 在 JavaScript 中旋转图像
【发布时间】:2017-03-11 14:29:11
【问题描述】:

我尝试使用 new Image() 在 javascript 中旋转 image 我尝试了这个:

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

但图像还是正常的。

我该怎么做?

【问题讨论】:

标签: javascript html css image rotation


【解决方案1】:

试试这个:

var image = new Image();
image.src = 'http://placehold.it/350x150';
document.body.append(image);
image.style.transform = "rotate(90deg)";

【讨论】:

    猜你喜欢
    • 2018-12-27
    • 2011-04-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-23
    • 1970-01-01
    相关资源
    最近更新 更多