如何在 HTML5 中檢測旋轉後畫布上的點


每當我們使用畫布並希望旋轉畫布時,我們需要轉換點才能在其旋轉位置繪製點。

可以在旋轉畫布後製作一個轉換類來檢測畫布上的點。

var t = new Transform();
console.log(t.transformPoint(5,6)); //Transform point will be [5,6]

t.rotate(1); // Same transformations can be applied that we did to the canvas
console.log(t.transformPoint(5,6)); // Transformed point will be [-2.347, 7.449]

更新時間: 2020 年 1 月 30 日

225 次瀏覽

開啟你的職業生涯

完成課程以獲得認證

開始
廣告
© . All rights reserved.