4
如何使用fillText()爲HTML5中的畫布標籤生成文本?我如何使用fillText()爲HTML5中的畫布標籤生成文本?
它會以與MozTransform,webkitTransform,oTransform,transform等相同的方式完成嗎?
如何使用fillText()爲HTML5中的畫布標籤生成文本?我如何使用fillText()爲HTML5中的畫布標籤生成文本?
它會以與MozTransform,webkitTransform,oTransform,transform等相同的方式完成嗎?
使用如下語句
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
,它將變換設置回身份。
謝謝!是的,我正在嘗試context.style.MozTransform =「skewx(45deg)」;和context.MozTransform =「skewx(45deg)」; (以及WebKit和Presto版本,但那些不能用於畫布。 – chimerical 2010-05-03 04:04:45