local testImage = display.newImage( "testimage.jpg", true ) testImage.xScale, testImage.yScale = 12,12 --centres on screen-- testImage.x = 160 testImage.y = 283 local function frames() testImage.xScale = testImage.xScale\*.998 --resets image scale-- if testImage.xScale \< 1 then testImage.xScale = 12 end testImage.yScale = testImage.xScale end Runtime:addEventListener( "enterFrame", frames )
My new game involves having images (1024 x 1024) being scaled up quite a lot and then slowly zooming out. The code above is a very striped down part of the code which demonstrates the problem I am having. Choose an image that has some good contrast/detail near the middle so you can witness it jump about. It is worse while at a high scale and gets better as it shrinks.
NOTE: problem is only noticeable on the iPhone device itself
I have tried many things to circumnavigate this issue:
-
increased image file dimensions so I don’t need to scale so much (in case it’s due to the large scales, but it appears to happen independent of scales and is more dependant on contentWidth).
-
decreased image dimensions
-
set anchor points to 0,0 and scaled from my own “anchor” points by manually manipulating image.x & image.y values
-
changed frame rates
-
rounding values
-
using my own scale variable and shrinking it, then matching the image.xScale,yScale to that
-
display.setDefault( “magTextureFilter”, “nearest”), which I was hoping would help as I thought the jumping might have been something to do with pixels trying to filter and round to the proper place
The only small bit of success I had was setting anchor points to 0,0 and leaving the image.x,image.y completely still (effectively zooming out from the top left corner only). This is not appropriate for my game as I need to be zoomed in on certain points of the picture.
I’m beginning to think this might be a fundamental problem with how images are rendered, but I refuse to give up! Any guidance would be much appreciated