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

  • #1, z MachtnixWednesday, 10. May 2017, 18:44 hodinky 8 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...


    Kapitán

    1097 Posts


  • #2, z sebastianWednesday, 10. May 2017, 19:37 hodinky 8 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)

    Kapitán

    2346 Posts

  • #3, z afrlmeWednesday, 10. May 2017, 20:14 hodinky 8 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.

    Imperátor

    7285 Posts

  • #4, z stroncisWednesday, 10. May 2017, 20:28 hodinky 8 years ago
    I use this for gradial:
    Objects.objName.TimeToDestVisibility = 500
    Objects.objName.DestVisibility = 100

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

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

    Bažant

    42 Posts

  • #5, z afrlmeWednesday, 10. May 2017, 21:40 hodinky 8 years ago
    I use this for gradial:
    Objects.objName.TimeToDestVisibility = 500
    Objects.objName.DestVisibility = 100

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

    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

    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.

    Imperátor

    7285 Posts

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

    Bažant

    42 Posts

  • #7, z afrlmeWednesday, 10. May 2017, 22:27 hodinky 8 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.

    Imperátor

    7285 Posts

  • #8, z stroncisWednesday, 10. May 2017, 22:41 hodinky 8 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!

    Bažant

    42 Posts

  • #9, z MachtnixWednesday, 10. May 2017, 23:51 hodinky 8 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


    Kapitán

    1097 Posts