Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Initial delay with storyboard.gotoScene() ?
Started by Dell Dec 02 2011 11:21 PM

- - - - -
122 replies to this topic
[TOPIC CONTROLS]
« Page 4 of 5 2 3 4 5
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#76

Taruga

[GLOBAL: userInfoPane.html]
Taruga
  • Enthusiast

  • 61 posts
  • Corona SDK

Is it me, or the fromRight effect comes from the left instead of the right ?
uid: 10141 topic_id: 18556 reply_id: 92620


[TOPIC: post.html]
#77

Johantd04

[GLOBAL: userInfoPane.html]
Johantd04
  • Enthusiast

  • 62 posts
  • Corona SDK

It's not you. Values where swapped. I've fixed it now and updated the code.
uid: 106083 topic_id: 18556 reply_id: 92648


[TOPIC: post.html]
#78

Johantd04

[GLOBAL: userInfoPane.html]
Johantd04
  • Enthusiast

  • 62 posts
  • Corona SDK

Added fade and crossFade as requested, I also addressed a bugg that disrupted scene loading while using purgeAll() in enterScene.

* Updated fromLeft and fromRight
* Added non clickable layer to prevent touch/tap during transitions

-- Project: Storyboard GoTo
--
-- Version: 1.2.1
--
-- Author: Johan Johansson @ Baboons.se
--
-- Support: www.baboons.se
--
-- Copyright (C) Baboons. All Rights Reserved.
--

local storyboard = require "storyboard"

-- Set helper
local function Set(list)
    local set = {}
    for _, l in ipairs(list) do set[l] = true end
    return set
end

-- OnComplete Event
local function onComplete(view)
    local scene = view.scene
    local lastScene = view.lastScene
    local sceneName = storyboard.currentSceneName
    local loadedScenes = Set{unpack(storyboard.loadedSceneMods) }

    -- Exit current scene
    if lastScene then lastScene:exitScene() end

    -- Enter new scene
    scene:enterScene()

    -- Animate alpha if needed
    transition.to( view, { time=storyboard.effectTime,  alpha=1.0 } )

    -- Insert scene to loaded if needed
    if loadedScenes[sceneName] == nil then
        table.insert(storyboard.loadedSceneMods, sceneName)
    end

    -- Load done, remove layer
    view.layer:removeSelf()

end

-- Goto To Scene
local gotoScene = function ( sceneName, effect, effectTime)

    -- Get loaded Scenes
    local loadedScenes = Set{unpack(storyboard.loadedSceneMods)}

    -- Get The previous scene name
    local lastSceneName = storyboard.getPrevious()

    -- Get the previous scene
    local lastScene = storyboard.getScene( lastSceneName ) or nil

    -- Get or Load New Scene
    local scene = storyboard.getScene( sceneName ) or require( sceneName )

    -- Create Scene if not loaded
    if loadedScenes[sceneName] == nil then
        -- Create view group
       scene.view = display.newGroup()

       -- Save scene
       storyboard.scenes[sceneName] = scene

       -- Create scene
       scene:createScene()
    end

    -- Set current sceneName
    storyboard.currentSceneName = sceneName
    -- Set effect time
    storyboard.effectTime = effectTime

    -- Create View Group
    scene.view.scene = scene
    scene.view.lastScene = lastScene

    -- Set positions
    local newX = 0
    local newY = 0
    local curX = 0
    local curY = 0
    local alpha = 1.0
    local crossAlpha = 1.0

    if     effect == "fromRight" then
        newX =  display.contentWidth
    elseif effect == "fromLeft" then
        newX =  -display.contentWidth
    elseif effect == "fromTop" then
        newY =  -display.contentHeight
    elseif effect == "fromBottom" then
        newY =  display.contentHeight
    elseif effect == "toBottom" then
        curY = display.contentHeight
    elseif effect == "toTop" then
        curY = -display.contentHeight
    elseif effect == "slideLeft" then
        newX = display.contentWidth
        curX = -display.contentWidth
    elseif effect == "slideRight" then
        newX = -display.contentWidth
        curX = display.contentWidth
    elseif effect == "fade" then
        alpha = 0.0
        crossAlpha = 0.0
    elseif effect == "crossFade" then
        alpha = 0.0
        crossAlpha = 1.0
    end

    -- Move New Scene View out of screen
    scene.view.x = newX
    scene.view.y = newY

    -- Set new alpha
    scene.view.alpha = alpha

    -- Disable touch
    local layer = display.newRect(0, 0, display.contentWidth, display.contentHeight)
    layer.alpha = 0.0
    layer.isHitTestable = true
    layer:addEventListener("touch", function() return true end)
    layer:addEventListener("tap", function() return true end)

    -- Add layer to view object
    scene.view.layer = layer

    -- Move New Scene
    transition.to( scene.view, { time=effectTime, alpha=crossAlpha, x=(0), y=(0), onComplete=onComplete } )

    -- Move Current Scene
    if lastScene then
        transition.to( lastScene.view, { time=effectTime, alpha=alpha, x=(curX), y=(curY) } )
    end
end

return gotoScene
uid: 106083 topic_id: 18556 reply_id: 92615


[TOPIC: post.html]
#79

optionniko

[GLOBAL: userInfoPane.html]
optionniko
  • Enthusiast

  • 46 posts
  • Corona SDK

Hey Johan,

could you please explain a little more where to put storyboard.gotoScene = require("storyboardGotoScene").?

In every scene and main.lua or not?

I'd also like to know where in the code should i paste the code?

Thanks!
Nick
uid: 77183 topic_id: 18556 reply_id: 92653


[TOPIC: post.html]
#80

Taruga

[GLOBAL: userInfoPane.html]
Taruga
  • Enthusiast

  • 61 posts
  • Corona SDK

Johantd04,

I've tested and it works amazingly fast, but I have issues with my current app because sometimes it doesn't recognize some touch event listeners and I don´t know why. But the speed of screen transitions is way much faster than with storyboard, for sure!
uid: 10141 topic_id: 18556 reply_id: 92655


[TOPIC: post.html]
#81

Johantd04

[GLOBAL: userInfoPane.html]
Johantd04
  • Enthusiast

  • 62 posts
  • Corona SDK

1. create a file called "storyboardGotoScene.lua" with my code.

2. Use the following line in every scene where you want to override the gotoScene() function;

storyboard.gotoScene = require("storyboardGotoScene")
uid: 106083 topic_id: 18556 reply_id: 92714


[TOPIC: post.html]
#82

Johantd04

[GLOBAL: userInfoPane.html]
Johantd04
  • Enthusiast

  • 62 posts
  • Corona SDK

@Taruga

I added a layer to prevent touch events during scene transitions, I have only tested it with my app, you can to comment out all lines with "layer. If it works after it has something to do with my layer to disable touch events.
uid: 106083 topic_id: 18556 reply_id: 92715


[TOPIC: post.html]
#83

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

This still isn't working for me. I'll try to make a video of it happening tonight.

Basically I swipe screen1 to screen2 and things look fine. I swipe to screen3 and all is still good, but if I swipe back to screen 2, about 20 some odd pixels of screen 3 is still on the screen. If I try and swipe back to screen 3, screen 3 quickly moves right to left across the entire screen zooming off screen to the left leaving me still viewing screen2.

Now I'm only including your module in my main.lua after I load storyboard since that functionality should carry forward without having to load it in every scene.

uid: 19626 topic_id: 18556 reply_id: 92747


[TOPIC: post.html]
#84

Taruga

[GLOBAL: userInfoPane.html]
Taruga
  • Enthusiast

  • 61 posts
  • Corona SDK

@Johantd04

I've found a bug in my code that gave me a different behavior with your routine but It´s working fine now. Thanks for your work, my app is much faster now switching views :)

@Ansca

FIX THIS BUG !!!
uid: 10141 topic_id: 18556 reply_id: 92751


[TOPIC: post.html]
#85

Bladko

[GLOBAL: userInfoPane.html]
Bladko
  • Contributor

  • 342 posts
  • Enterprise

@Ansca

This is so simple and it works!

This should be taken as an official solution for storyboard problems.

Regards
Tom
uid: 111283 topic_id: 18556 reply_id: 92844


[TOPIC: post.html]
#86

Hive

[GLOBAL: userInfoPane.html]
Hive
  • Enthusiast

  • 86 posts
  • Corona SDK

I can confirm that for some reason, this breaks my widget tableview. No idea why. The tableview is added to the screenGroup and works fine without this fix.

argh!
uid: 42417 topic_id: 18556 reply_id: 92851


[TOPIC: post.html]
#87

Bladko

[GLOBAL: userInfoPane.html]
Bladko
  • Contributor

  • 342 posts
  • Enterprise

@Johantd04

could you create sample project with 2 scenes and your version of gotoscene ? maybe this would speedup process of updating api by ansca

Regards,
Tom
uid: 111283 topic_id: 18556 reply_id: 92873


[TOPIC: post.html]
#88

Johantd04

[GLOBAL: userInfoPane.html]
Johantd04
  • Enthusiast

  • 62 posts
  • Corona SDK

Added the code to "share your code" and compressed a modified version of Anscas Storyboard code example.

http://developer.anscamobile.com/code/storyboard-goto-no-delay
uid: 106083 topic_id: 18556 reply_id: 93092


[TOPIC: post.html]
#89

chevol

[GLOBAL: userInfoPane.html]
chevol
  • Contributor

  • 292 posts
  • Corona SDK

Anyone else upset that it's been 3 months and no fix from Corona?
uid: 58885 topic_id: 18556 reply_id: 94253


[TOPIC: post.html]
#90

Johantd04

[GLOBAL: userInfoPane.html]
Johantd04
  • Enthusiast

  • 62 posts
  • Corona SDK

@chevol

You should check out my fix: http://developer.anscamobile.com/code/storyboard-goto-no-delay

uid: 106083 topic_id: 18556 reply_id: 94254


[TOPIC: post.html]
#91

Bladko

[GLOBAL: userInfoPane.html]
Bladko
  • Contributor

  • 342 posts
  • Enterprise

@Johantd04

This is just simple workaround. This API must be fixed anyway.

Tom
uid: 111283 topic_id: 18556 reply_id: 94255


[TOPIC: post.html]
#92

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

@Johantd04

I still cant get your solution to work for me.

See: http://omnigeekmedia.com/tmp/bug.mov

If I don't use your module it works fine but with the delay.
uid: 19626 topic_id: 18556 reply_id: 94262


[TOPIC: post.html]
#93

Johantd04

[GLOBAL: userInfoPane.html]
Johantd04
  • Enthusiast

  • 62 posts
  • Corona SDK

@robmiracle

I would love to get this issue fixed (even tough it works with my project and corona demo). Is there any chance that you can give me a part of your project that I can use for resolving this issue?

/J
uid: 106083 topic_id: 18556 reply_id: 94265


[TOPIC: post.html]
#94

Omnigeek Media

[GLOBAL: userInfoPane.html]
Omnigeek Media
  • Corona Geek

  • 2,975 posts
  • Corona SDK

got an email address? I can either zip it up and send it to you, or put it on drop box and share the folder with you.
uid: 19626 topic_id: 18556 reply_id: 94269


[TOPIC: post.html]
#95

Johantd04

[GLOBAL: userInfoPane.html]
Johantd04
  • Enthusiast

  • 62 posts
  • Corona SDK

johan(at)baboons.se
uid: 106083 topic_id: 18556 reply_id: 94270


[TOPIC: post.html]
#96

Hive

[GLOBAL: userInfoPane.html]
Hive
  • Enthusiast

  • 86 posts
  • Corona SDK

Hey I'm confused at the silence here. While Johan has a workaround, it's not perfect and I think we all agree that ansca hopefully addresses this soon.
uid: 42417 topic_id: 18556 reply_id: 94272


[TOPIC: post.html]
#97

Danny

[GLOBAL: userInfoPane.html]
Danny
  • Corona Geek

  • 2,597 posts
  • Corona Staff

I am working on fixing this issues guys. As soon as possible.
uid: 84637 topic_id: 18556 reply_id: 94292


[TOPIC: post.html]
#98

jonathanbeebe

[GLOBAL: userInfoPane.html]
jonathanbeebe
  • Contributor

  • 654 posts
  • Alumni

Hi all,

I have a quick update regarding the delay issues:

I just checked-in the fix you've all been waiting for :-)

I want to thank you all for your patience, and apologize to those who have been waiting for the fix for quite some time.

And special thanks to Joshua Quick, the engineer who did all the back-end heavy lifting work that made the fix possible!

Look for the fix to be available in the daily build *after* 2012.768.

Please let me know if you're still experiencing issues once you're able to download the new build and try it out.
uid: 52430 topic_id: 18556 reply_id: 94553


[TOPIC: post.html]
#99

Johantd04

[GLOBAL: userInfoPane.html]
Johantd04
  • Enthusiast

  • 62 posts
  • Corona SDK

@Ansca

All hail Joshua!

Can't wait to try it out :-)
uid: 106083 topic_id: 18556 reply_id: 94557


[TOPIC: post.html]
#100

chevol

[GLOBAL: userInfoPane.html]
chevol
  • Contributor

  • 292 posts
  • Corona SDK

@Ansca good job! Gonna be nice to have Storyboard working with transitions.
uid: 58885 topic_id: 18556 reply_id: 94560



[topic_controls]
« Page 4 of 5 2 3 4 5
 
[/topic_controls]