Group ease

I’m hoping there’s a good solution I’m missing, but I could sure use some help. In it’s simplest form I have 2 images in a group. I’d like the user to be able to move that group, much like a table in the “Coffee demo” where it eases out when the user releases. Hopefully very simple.

Here’s what I have so far and it works fine. But I don’t have the easing anywhere. Just not sure what to do. Any help would be appreciated.

–this allows for the user to touch and move the “director group”.

[code]

module(…, package.seeall)

local director = require “director”

local ui = require(“ui”)

local localGroup

local directorGroup = display.newGroup()
–directorGroup:setReferencePoint(display.TopCenterReferencePoint);
directorGroup.x, directorGroup.y = centerX, 50

local centerX = display.contentCenterX
local centerY = display.contentCenterY

local makeButtons = function ()
–everything in here

localGroup:insert(directorGroup)
– A basic function for dragging physics objects ••COPIED/Adapted FROM DRAGPLATFORMS TUTORIAL••
local function startDrag( event )
local t = event.target

local phase = event.phase
if “began” == phase then
display.getCurrentStage():setFocus( t )
t.isFocus = true

– Store initial position
t.x0 = event.x - t.x
t.y0 = event.y - t.y

– Make body type temporarily “kinematic” (to avoid gravitional forces)
event.target.bodyType = “kinematic”

– Stop current motion, if any
event.target:setLinearVelocity( 0, 0 )
event.target.angularVelocity = 0

elseif t.isFocus then
if “moved” == phase then
t.x = event.x - t.x0
t.y = event.y - t.y0

elseif “ended” == phase or “cancelled” == phase then
display.getCurrentStage():setFocus( nil )
t.isFocus = false

– Switch body type back to “dynamic”, unless we’ve marked this sprite as a platform
if ( not event.target.isPlatform ) then
event.target.bodyType = “dynamic”
end

end
end

– Stop further propagation of touch event!
return true
end

local CorinBG=display.newImageRect( “K_Corin_bg1.png”, 496, 476 )
CorinBG.alpha = 1
CorinBG.x, CorinBG.y=centerX, centerY
CorinBG.xScale, CorinBG.yScale = 1,1
directorGroup:insert(CorinBG)
local CorinBG2=display.newImageRect( “K_Corin_bg2.png”, 496, 375 )
CorinBG2.alpha = 1
CorinBG2.x, CorinBG2.y=centerX, 585
CorinBG2.xScale, CorinBG2.yScale = 1,1
directorGroup:insert(CorinBG2)
–CODE FOR Dragging
eventoffset = {x=0,y=0}

---------------- drag function with no physics required

local function dragging (event)
local stage = display.getCurrentStage()
local target = event.target
if event.phase == “began” then – on touch
stage:setFocus(target, event.id)
–eventoffset.x = event.x - target.x
eventoffset.y = event.y - target.y
–group1:insert(target)
end

if event.phase == “moved” then – on move
target.y = event.y - eventoffset.y

– target.y = event.y - eventoffset.y
end

if event.phase == “ended” or event.phase == “cancelled” then – on release
stage:setFocus(nil)

end

end
local function snap (event)
–for Up
if directorGroup.y > 60 then
transition.to(directorGroup, {time=750, y=50, delay=0, alpha=1,transition=easing.outExpo})

end
–for down
if directorGroup.y transition.to(directorGroup, {time=750, y=-440, delay=0, alpha=1,transition=easing.outExpo})

end
end

directorGroup:addEventListener(“touch”, dragging)
directorGroup:addEventListener(“touch”, snap)
[import]uid: 11144 topic_id: 7360 reply_id: 307360[/import]

Anyone have any answers? [import]uid: 11144 topic_id: 7360 reply_id: 26257[/import]