0
我有一個大小爲1162 x 16的圖像,我想要在觸摸「移動相位」事件上旋轉, 問題是,當圖像旋轉時,它會變成「像素化」加擾,儘管它是沒有得到縮放, 我試圖用128×128的圖像,但圖像沒有像素化, 可能是由於圖像的大尺寸!在日冕裏的大圖像旋轉
旋轉會影響圖像結構嗎? 任何人都有一個想法,爲什麼會發生?
或者如果任何人有解決方法,請你幫我一下。
這裏是更新的代碼使之方後:
local bck = display.newRect (0,0,display.contentWidth,display.contentHeight)
bck.x = display.contentWidth * 0.5
bck.y = display.contentHeight * 0.5
bck:setFillColor (255,255,255)
local img = display.newImageRect ("laser1.png",1170,1170)
img.x = display.contentWidth * 0.5
img.y = display.contentHeight * 0.5
local function getRotation(PointX1,PointY1,PointX2,PointY2)
--display.getCurrentStage():setFocus (Bug)
local atan2 = math.atan2
local pi = 3.14159265358
local deltax = PointX2 - PointX1
local deltay = PointY2 - PointY1
local currentAngle = ((atan2(deltay,deltax))* 180.0)/pi
local rotationDigree = currentAngle - img.previousAngle;
img.previousAngle = currentAngle
return rotationDigree;
end
local function handleTouch (event)
img.previousAngle = 1
if(event.phase == "moved") then
img.rotation = getRotation (img.x , img.y , event.x , event.y)
end
end
Runtime:addEventListener ("touch",handleTouch)
thx ChrisF我已經嘗試使它與空白區域1162 x1162,但沒有工作,仍然是像素化時旋轉。:S –
@ Israa.Kh - 我猜你還在延伸16至1162年。編輯你的代碼到你的問題。 – ChrisF
我添加了上面的代碼 –