2010-05-01 24 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