Eyeball
Eyeball

Reputation: 3317

Corona SDK: storyboard.gotoScene with effect

I am trying to use the effect slideLeft when transitioning between my menu storyboard and a storyboard called "search".

The scenechange works, however there is no effect applied to the transition. Or.. there is no transition at all. The new scene just appear.

What am i missing here?

Thanks.

local function goToPage(event)
if (event.phase == "ended") then
    changeButtonIndentation()
    local nextSceneName = "pages." .. event.target.name
    if (storyboard.getCurrentSceneName() ~= nextSceneName) then
        print("From page: " .. storyboard.getCurrentSceneName())
        print("To page: " ..nextSceneName)

        local options =
        {
            effect = "slideLeft",
            time = 1000
        }
        storyboard.gotoScene("pages.search", options)
        currentActivePage = event.target.name
        print(event.target.name)
    end
end
changeButtonIndentation()
end

EDIT: So appearently the options work. If i increase the time parameter of options i notice that some buttons are unclickable for 1 sec on the search storyboard. However the effect is not working.

Upvotes: 0

Views: 1163

Answers (3)

Pontus
Pontus

Reputation: 776

One common misstake is that you forget to add your view elements to the self.view group. Often, storyboard templates includes local group = self.view at the beginning of the scene:createScene function. Try to insert your view objects into that group.

Upvotes: 2

Rob Miracle
Rob Miracle

Reputation: 3063

The main reason why there would be no transitions is if you're creating the scene in the enterScene() function instead of the createScene() function.

Upvotes: 0

vovahost
vovahost

Reputation: 36007

Try to test first if it's not a build bug. Go to Help -> Sample projects and open Storyboard sample. If you see transition then the problem is in your code.

So try this semplified code:

local function goToPage(event)
    if (event.phase == "ended") then
        local options =
        {
            effect = "slideLeft",
            time = 1000
        }
        storyboard.gotoScene("pages.search", options)
    end
    return true
end

Upvotes: 0

Related Questions