Results 1 to 5 of 5

Thread: Opposite of fadeOverTime()?

  1. #1
    Deleter/Deleted
    Join Date
    Jan 2023
    Posts
    76
    Thanks
    40
    Thanked 9 Times in 9 Posts

    Opposite of fadeOverTime()?

    Hello
    I'm trying to make the opposite of fadeOverTime()

    I mean I try to make the alpha to increase over time, progressively, according to a time value

    Could you help me please?

    I will post my results here

    I'm thinking about something like this:

    PHP Code:
    progressiveAlpha(hudtime)
    {
        
    hud.alpha 0;
        
    progresstime 0;
        while (
    progresstime time)
        {
            
    progresstime += 0.05;

            
    hud.alpha += 0//...

            
    wait 0.05;
        }

    Last edited by raphael; 20th March 2023 at 08:15.

  2. The Following User Says Thank You to raphael For This Useful Post:

    kung foo man (22nd March 2023)

  3. #2
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Yes, use fadeovertime.

    hud.alpha = 0;
    hud fadeOverTime(1);
    hud.alpha = 1;

    Done.
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  4. The Following 2 Users Say Thank You to IzNoGoD For This Useful Post:

    kung foo man (22nd March 2023),raphael (22nd March 2023)

  5. #3
    Deleter/Deleted
    Join Date
    Jan 2023
    Posts
    76
    Thanks
    40
    Thanked 9 Times in 9 Posts
    It works great thank you very much

    Does the code after fadeOverTime() get executed after it's amount is passed?

    I'm not sure to understand, I have this code for something else:

    PHP Code:
    self._welcomehud setText(&"Welcome");
    self._welcomehud.fontScale 1.3;

    wait (2);

    self._welcomehud fadeOverTime(1);
    self._welcomehud.alpha 0;

    wait (1);

    if (
    isdefined(self._welcomehud))
    {
        
    self._welcomehud destroy();

    Is wait (1); useless here?

    If I try to remove it and the hud still gets destroyed after 1sec, I will tell

  6. The Following User Says Thank You to raphael For This Useful Post:

    kung foo man (22nd March 2023)

  7. #4
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    1. set up initial alpha with .alpha
    2. call fadeovertime(time_goes_here)
    3. set new, desired alpha that should be faded towards
    4. fadeovertime will do stuff in the background, as a separated thread
    5. setting alpha will override fadeovertime (=cancel it, and set the new alpha immediately)
    6. after time_goes_here your hud will have the new alpha


    So, if you want a "breathing" style hud, you should do something like this:

    Code:
    hud.alpha = 0;
    while(true)
    {
       hud.fadeovertime(1);
       hud.alpha = 1;
       wait 1;
       hud.fadeovertime(1);
       hud.alpha = 0;
       wait 1;
    }
    "Does not work" is an error report for a bug between keyboard and chair.

    All hail Artie Effem

  8. The Following 2 Users Say Thank You to IzNoGoD For This Useful Post:

    kung foo man (22nd March 2023),raphael (22nd March 2023)

  9. #5
    Deleter/Deleted
    Join Date
    Jan 2023
    Posts
    76
    Thanks
    40
    Thanked 9 Times in 9 Posts
    Thank you so much IzNoGoD

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •