2
我正忙於爲我的HTML5遊戲編寫紋理圖集類,但是, 我在繪製圖像的旋轉部分時遇到問題。HTML5畫布繪製旋轉圖像部分
例如:從spritesheet中提取足球並旋轉繪製。
我已經設置了以下小提琴,我在那裏繪製圖像旋轉,然後將圖像的一部分,我只是無法弄清楚如何在同一時間做兩:/
的代碼,我需要幫助的部分如下:
targetX = 450;
targetY = 35;
context.save();
context.translate(targetX, targetY);
context.translate(halfWidth, halfHeight);
context.rotate(60 * TO_RADIANS);
// Help needed HERE!!!!!
// draws full image rotated at half height
// context.drawImage(logoImage, -halfWidth, -halfHeight, halfWidth, halfHeight);
// draws nothing that is visible
//context.drawImage(logoImage, -halfWidth, -halfHeight, halfWidth, halfHeight, targetX, targetY, halfWidth, halfHeight);
context.restore();
任何幫助將不勝感激! :)