我创建了一个新的图像,但是我尝试调整其大小并添加一些变换效果。然而,它们没有生效。
示例:https://jsfiddle.net/chung9ey/3/
示例:https://jsfiddle.net/chung9ey/3/
img.onload = function(){
img.style.width = "500";
img.style.height = "300";
img.style.transform = "perspective(500px) rotateZ(30deg)";
context.drawImage(img, 0 ,0);
}
0
。 - dandaviscontext.drawImage(img, topLeftCornerHorizontalPosition, topLeftCornerVerticalPosition, imageWidth, imageHeight);
。请参见 https://developer.mozilla.org/zh-CN/docs/Web/API/CanvasRenderingContext2D/drawImage。 - jkdevimg.style.transform
。请参阅Rotate and save image for JavaScript。 - jkdev