我想在3D中旋转图像,这可以在css中使用
transform: perspective(50px) rotateX(10deg) rotateY(10deg) rotateZ(10deg);
目前我正在使用画布,而.style.transform属性对我不起作用。示例:https://jsfiddle.net/chung9ey/31/。注意:我根本不想拥有css文件或样式标记。
答案 0 :(得分:1)
您的代码基本上是正确的,但不是x <- c(20160628,20160629,20160630,20160701,20160702)
y <- 5:9 * 100
x <- as.character(as.Date(as.character(x),format = "%Y%m%d"))
data <- data.frame(x,y)
library(ggplot2)
ggplot(data,aes(x=x,y=y)) +
geom_point() +
labs(x="Date",y="Value")
,而是使用img.style.transform
转换画布:
canvas.style.transform
var img = new Image;
var canvas = document.getElementById("hello");
var context = canvas.getContext("2d");
img.onload = function(){
canvas.style.transform = "perspective(50px) rotateX(10deg) rotateY(10deg) rotateZ(10deg)";
context.drawImage(img, 0 ,0, 500, 300);
}
img.src = "https://www.enterprise.com/content/dam/global-vehicle-images/cars/CHRY_200_2015.png";