Hi,
I tried something today that I thought would work, but it didn’t.
The idea is to have a background with perspective and wrapped, tiled texture rotating. I thought it would be a nice “cheap” background. I can have the animation with the rotation, or I can have the perspective, but I can’t have both it seems. Here’s the code that illustrates the problem:
(Just create a blank project with all the defaults, and put this into main.lua.)
[lua]
– main.lua
–
local function rotateBackground(event)
local t = 200000
transition.to( bg.fill, {
rotation = bg.fill.rotation-360,
time=t,
onComplete=rotateBackground
} )
end
display.setStatusBar(display.HiddenStatusBar)
bg = display.newRect(display.contentCenterX, display.contentCenterY,
display.actualContentWidth, display.actualContentHeight)
display.setDefault( “textureWrapX”, “repeat” )
display.setDefault( “textureWrapY”, “repeat” )
bg.fill = { type=“image”, filename=“Icon.png” }
bg.fill.scaleX = 64 / bg.width
bg.fill.scaleY = 64 / bg.height
– The problem is right here:
– If these two lines are commented out there is a nice rotation animation, but no perspective.
– If these two line are not commented out there is a nice perspective effect, but no rotation animation.
–bg.path.x2 = -display.actualContentWidth / 2
–bg.path.x3 = display.actualContentWidth / 2
display.setDefault( “textureWrapX”, “clampToEdge” )
display.setDefault( “textureWrapY”, “clampToEdge” )
rotateBackground()
[/lua]
Perhaps someone can give me a hint of how to make it work? Or possibly tell me why it won’t work.