Double Tap - Zoom in/out sample code request

hi master,

anyone can show some light here?
i would need a double tap zoom a displayGroup object to maybe 5x bigger than original, then double tap again to restore to original size.

How can i do that?

Thanks for the light [import]uid: 10373 topic_id: 16568 reply_id: 316568[/import]

This had double tap to zoom 2x, as well as pinch zooming; http://developer.anscamobile.com/code/pinch-zoom-xl

You could just take the tap part and modify it to suit your needs.

Peach :slight_smile: [import]uid: 52491 topic_id: 16568 reply_id: 61902[/import]

thanks but for a tap zoom in/out effect, i guess following transition.to work easier

local bluePrint = display.newImageRect('editor/blueprint01.png', display.contentWidth, display.contentHeight)  
 bluePrint:setReferencePoint( display.CenterReferencePoint )  
 bluePrint.x, bluePrint.y = g.splash.x, g.splash.y  
 localGroup:insert(bluePrint)  
 local zoom = ''  
 local prevRefX, preRefY = 0, 0  
 local updateRuntimeEvent = function(e)  
  
 if e.phase == 'ended' then  
  
 local listener1 = function( obj )  
 print( "Transition 1 completed on object: " .. tostring( obj ) )  
 end  
  
 -- default zoom in  
 if zoom == '' or zoom == 'out' then  
 localGroup.xReference = e.x  
 localGroup.yReference = e.y  
  
 transition.to( localGroup, { time=500, xScale = 2, yScale = 2, onComplete=listener1 } )  
  
 zoom = 'in'  
 else  
 transition.to( localGroup, { time=500, xScale = 1, yScale = 1, onComplete=listener1 } )  
  
 zoom = 'out'  
 end  
 end  
 end  
 Runtime:addEventListener('touch', updateRuntimeEvent)  

it’s working better now [import]uid: 10373 topic_id: 16568 reply_id: 62108[/import]