Here is the code:
display.setDefault( "textureWrapX", "repeat" ) display.setDefault( "textureWrapY", "mirroredRepeat" ) local \_W, \_H = display.contentWidth, display.contentHeight print(\_W, \_H) local snapshot = display.newSnapshot(\_W, \_H) snapshot.x = \_W \* 0.5 snapshot.y = \_H \* 0.5 snapshot.fill.effect = "filter.polkaDots" snapshot.fill.effect.numPixels = 50 snapshot.fill.effect.dotRadius = 1 local rectT = display.newRect(snapshot.group, 0, 0, \_W, \_H) rectT.fill = { type="image", filename="myImage.png" } rectT.fill.scaleX = 0.5 rectT.fill.scaleY = 0.25 rectT.fill.x = 0.5 local function updateGame(e) rectT.fill.rotation = rectT.fill.rotation + 0.03 snapshot:invalidate() end Runtime:addEventListener("enterFrame", updateGame)
There was no particular reason for not using the config.lua file, we were just testing out the effect. However even with the following config.lua, the polkadots are still elipses.
-- config.lua application = { content = { fps = 60, width = 640, height = 960, scale = "letterbox", }, }
@albert90 “Change the size of the object to be square. ie: You don’t have to make the object match the size of the screen. Take the largest size in either direction and apply that to both the width and height of your object.”
That’s fine if the object is just a plain rect, but what about if it’s an image? Although it’s being distorted by an effect, it still needs to keep it’s resemblance to the original image, which I realise is dependant on the filter settings. A picture of the empire state building would look strange if it was set to be square (it would also look strange being made of polka dots, but that’s another matter).
Play with the polkaDots parameters until each dot has the look you want.
There are 2 parameters as far as I can see: dotRadius and numPixels. Neither of these control the shape of the dots, only the size.
numPixels changes the area which each dot can occupy, and the dotRadius simply gives you a bigger elipse within that area.