How to rotate an Image using Corona sdk with iPhone
myAnim1 = movieclip.newAnim{"ICQ.png"}
  --foreground:insert( myAnim2 )

  myAnim1.x = 20
  myAnim1.y = 80


local function pressFunction()
    myAnim1.alpha = 0.7
end
(to be continue...) (continue)

local function releaseFunction()
    myAnim1.alpha = 1.0
end



-- Make 2nd sprite draggable
myAnim1:setDrag{
    drag=true,
    onPress=pressFunction,
    onRelease=releaseFunction,
    bounds = { 0, 0, 320, 480 }


}

local rotate = function( event )
    myAnim1.rotation = event.x
    end
myAnim1:addEventListener( "touch",rotate)
   
myAnim1:rotate(0)
   
local rotate = function(event)
  if event.phase == "ended" then
    myAnim1.rotation = event.x
  end
end
   
myAnim1:addEventListener("tap", rotate)

Date: 2012-06-14 11:41:21 and last modified: 2012-06-14 11:41:21

Relate tags: