Script: Making an object visible/invisible - Ein Objekt sichtbar/unsichtbar machen

  • #1, by MachtnixWednesday, 10. May 2017, 18:44 3 years ago
    There is ObjectVisibility in the Data structure. How can I use it?

    I tried 2 hours with 100 cases to arrange... but it's all the inexplicable Visionaire stuff...


    Thread Captain

    1087 Posts


  • #2, by sebastianWednesday, 10. May 2017, 19:37 3 years ago
    Action part "set object visibility" changes the visibility. You can also change this via lua

    old method:

    getObject("Objects[name]"):setValue(VObjectVisibility,0-100)

    you can also using tweening:

    Objects["name"]:to(300, {Visibility = 0-100}) -- "300" is the time in which the visibility changes (300ms)

    Thread Captain

    2337 Posts

  • #3, by afrlmeWednesday, 10. May 2017, 20:14 3 years ago
    There is ObjectVisibility in the Data structure. How can I use it?

    I tried 2 hours with 100 cases to arrange... but it's all the inexplicable Visionaire stuff...


    Really surprised you didn't just use the action part method found under the scene action parts category.

    Imperator

    6842 Posts

  • #4, by stroncisWednesday, 10. May 2017, 20:28 3 years ago
    I use this for gradial:
    Objects.objName.TimeToDestVisibility = 500
    Objects.objName.DestVisibility = 100
    1
    2

    And this for toggle:
    Objects.kittan.Visibility = 100
    1

    Though they cannot be used interchangeably, if you used .Visibility to reveal object, you cannot then hide it with .TimeToDestVisibility + .DestVisibility and vice versa.

    Newbie

    42 Posts

  • #5, by afrlmeWednesday, 10. May 2017, 21:40 3 years ago
    I use this for gradial:
    Objects.objName.TimeToDestVisibility = 500
    Objects.objName.DestVisibility = 100
    1
    2

    And this for toggle:
    Objects.kittan.Visibility = 100
    1

    Though they cannot be used interchangeably, if you used .Visibility to reveal object, you cannot then hide it with .TimeToDestVisibility + .DestVisibility and vice versa.
    Aye, that was the old method.

    Simon implemented the to tweening function into 4.1 or 4.2 (I forget), which allows you to create a transition with easing & loop or pendulum loop.
    game.CurrentScene.SceneObjects["example"]:to(1000, {Visibility = 0}, easeQuintInOut, true, true) -- fade back &; forth in a loop between 0 &; 100% opacity
    1

    You don't have to include easing or loop/reverse boolean values. By default they would be easeLinearInOut (probably) & false/false. One thing to note about the to() function is that it's technically possible to adjust multiple different data structure fields inside of the same to() function, which can save a bit of time every so often depending on the situation.

    Imperator

    6842 Posts

  • #6, by stroncisWednesday, 10. May 2017, 21:57 3 years ago
    Nice. damn, i made it hard way - used sin() for pendulum visibility tweening.

    Newbie

    42 Posts

  • #7, by afrlmeWednesday, 10. May 2017, 22:27 3 years ago
    Nice. damn, i made it hard way - used sin() for pendulum visibility tweening.
    Aye. Really glad Simon implemented that function. He created another one that did same thing more or less before he created the to() function, but it was very complicated to use.

    You can find an example of the startObjectTween() function in this workflow function I wrote the other year... it's not so bad when you look at it in the example, because typically people were directly accessing objects & data structure fields inside of the function & it ended up looking really messy.

    Imperator

    6842 Posts

  • #8, by stroncisWednesday, 10. May 2017, 22:41 3 years ago
    Thanks! Definitely will look. My first attempt to understand Lua and Visionaire started from opening one of your scripts, you are all over this place!

    Newbie

    42 Posts

  • #9, by MachtnixWednesday, 10. May 2017, 23:51 3 years ago
    Thanks a lot. I will try the old method first (because its more comprehensible to me). I don't need tweening (stufenloser Übergang?), but maybe it's somewhat I can use in future... wink


    Thread Captain

    1087 Posts

Write post