2010-05-01 26 views

回答

9

使用如下语句

context.setTransform (1, -0.2, 0, 1, 0, 0); 

spec for canvas transformations

那么,你会使用一个CSS线像

-moz-transform: matrix(a, c, b, d, tx, ty) 

您可以使用JavaScript

context.setTransform (a, c, b, d, tx, ty); 

绘制文本的一个例子是

context.font = '20px arial,sans-serif' ; 
context.fillStyle = 'black' ; 
context.setTransform (1, -0.2, 0, 1, 0, 0); 
context.fillText ('your text', 10, 10) ; 
context.setTransform (1, 0, 0, 1, 0, 0); 

注意最后setTransform,它将变换设置回身份。

+0

谢谢!是的,我正在尝试context.style.MozTransform =“skewx(45deg)”;和context.MozTransform =“skewx(45deg)”; (以及WebKit和Presto版本,但那些不能用于画布。 – chimerical 2010-05-03 04:04:45