- Code: Select all
- MOAISim.openWindow ( "layer rotation", 320, 480 )
- viewport = MOAIViewport.new ()
- viewport:setSize ( 320, 480 )
- viewport:setScale ( 320, -480 )
- layer = MOAILayer2D.new ()
- layer:setViewport ( viewport )
- MOAISim.pushRenderPass ( layer )
- gfxQuad = MOAIGfxQuad2D.new ()
- gfxQuad:setTexture ( "moai.png" )
- gfxQuad:setRect ( 0, 0, 128, 128 )
- gfxQuad:setUVRect ( 0, 0, 1, 1 )
- prop = MOAIProp2D.new ()
- prop:setDeck ( gfxQuad )
- layer:insertProp ( prop )
I am trying to rotate a layer by 180 degrees but am not having much success.
- Code: Select all
- layer:setPiv(160, 240)
- layer:seekRot ( 180, 1 )
I tried the code above (set pivot point at the centre of the screen and then rotate. The prop is seen to expand and then shrink. This transformation leaves no changes.
- Code: Select all
- layer:seekRot ( 180, 1 )
- layer:seekLoc(320, 480, 1)
(The second line of the code above is to move the layer back in to the screen as the prop 'rotates off' the screen.)
In the code above the prop is seen to loop around but not rotate. Again this transformation leaves no changes once it has finished.
Could anyone help me with this?

