Forum overview > Scene Zoom
  • Scene Zoom

    by darren-beckett · Friday, 26. June 2015, 16:37 h ~ 6 years ago
    Is there a way a user could adjust the zoom of a scene at run-time?
    I'd like to enable a multi-touch zoom in?
  • by afrlme · Friday, 26. June 2015, 17:01 h ~ 6 years ago
    Yes, you could use the shader toolkit shaderViewport() function to zoom in/out, rotate the screen & various other things with easing options.

    P.S: you need Visionaire Studio 4.1 onwards to use the current shader toolkit script.
  • by Machtnix · Friday, 26. June 2015, 17:16 h ~ 6 years ago
    Geht das auch ohne Toolkit? Z.B. durch eine Klick-Aktion, die den kompletten Hintergrund plus Objekte auswechselt?

    Possible without this toolkit? Maybe to change the complete background with an action?
  • by ke4 · Friday, 26. June 2015, 18:13 h ~ 6 years ago
    You could make it as an animation or you could change the size of the background via lua script. There's no action for changing the size of objects hovewer you can change the size of animation. You would have to set the background as one frame looping animation and then control the size through lua script.
  • by darren-beckett · Saturday, 27. June 2015, 11:19 h ~ 6 years ago
    The ShaderToolkit seems to almost do what i require.

    shaderZoom works well, but it doesn't center on the current character.
    But, shaderZoomCharacter zooms the current character to the center of the screen even if this they're at the edge of the screen, which results in a black area.
  • by afrlme · Saturday, 27. June 2015, 11:53 h ~ 6 years ago
    Yeah, err we need to add a bit of code to the zoom, pan & follow functions to prevent the viewport from going past the background image - that's why you can see black.

    The viewport should go no less than 0, 0 on both x & y & no more than scene background width & height minus default game resolution x & y.
  • by darren-beckett · Saturday, 27. June 2015, 18:26 h ~ 6 years ago
    Thanks, i've now sorted the 0.
    How do i obtain the scene background width & height?

    DefaultGameRes = game.WindowResolution.x & y
    SceneBackgroundHeight = ???
  • by afrlme · Saturday, 27. June 2015, 18:52 h ~ 6 years ago

    local ss = game.CurrentScene.SceneSprite.SpriteSprite:getSize()
    print(ss.x, ss.y) -- print scene width & height to log


    Simon told me a while back that it's not a good idea to keep calling the getSize() function (for some reason or other - I forget), so I recommend creating a little function that you call once inside of an at begin of scene action for each scene. That way you can update a Lua variable with the current scene width once & access it in your other scripts (well if you use a global variable instead of local).
  • by darren-beckett · Sunday, 28. June 2015, 17:06 h ~ 6 years ago
    This works well, but it doesn;t follow the character.
    I've tried shaderFollowCharacter, but it doesn't do anything. is there something i need to call to enable mainLoop?
  • by afrlme · Sunday, 28. June 2015, 20:18 h ~ 6 years ago
    I'm not sure if scroll position is updated to zoomed scale factor. Probably something worth looking into. Maybe I'll do that at some point, when I have a minute - & if I remember (terrible memory).
  • by dos4gw · Saturday, 19. September 2015, 04:44 h ~ 6 years ago
    Can the shader toolkit be used in games that will be put up for sell?
  • New post