I am trying to animate a rectangle. The rectangle is part of a ‘slide’ object and is nested in a group. The slide code is:
-- slide.lua
-- builds a slide object with info popup, favourite button and email function
local slide = {}
local slide\_mt = {\_\_index = slide}
-- PRIVATE FUNCTIONS
local slideHolder
local popupBg
local dy = display.contentHeight -250
local completeListener = function(obj)
print("Complete " ..tostring(obj.name) .. " y: " ..tostring(obj.y))
end
local startListener = function(obj)
print("Starting transition on " ..tostring(obj.name) .." y: " ..tostring(obj.y))
end
local function showInfo(event)
print("attempting to show info")
-- print("slideHolder[2].name", slideHolder[2].name )
popupBg:setReferencePoint(display.TopLeftReferencePoint)
transition.to(slideHolder[2], {time=1000, y=200, onStart=startListener, onComplete=completeListener})
end
local function buildSlide(image)
slideHolder = display.newGroup()
local slideImage = display.newImage(image)
slideImage:setReferencePoint(display.CenterLeftReferencePoint)
slideImage.name = "slideImage"
slideHolder:insert(slideImage)
popupBg = display.newRect(slideHolder, 0, dy, 320, 100) -- below visible display area
popupBg.name = "popup"
popupBg.strokeWidth = 2
popupBg:setStrokeColor(0)
popupBg:setFillColor(0, 0, 0, 200)
popupBg:setReferencePoint(display.TopLeftReferencePoint)
slideHolder:insert(popupBg)
slideImage:addEventListener( "tap", showInfo )
return slideHolder
end
-- PUBLIC FUNCTIONS
function slide.new(image)
local newSlide = {
buildSlide(image)
}
return setmetatable(newSlide, slide\_mt)
end
return slide
My terminal output tells me that the y position of popupBg has changed but the rect onscreen does not move.
I am using Storyboard and the slideObject is called from a different class and then nested in another container but I’m not sure whether that affects things…
I haven’t found anything on the forum that helps yet… Any suggestions? [import]uid: 61520 topic_id: 20390 reply_id: 320390[/import]