Question about set_opacity timer

I was running some tests because I'm wanting to make a day/night script I wrote compatible with UL script. I was tracking amount of time that lapsed along with the amount of the opacity changed during the course of the change.

It seems as if, for example, when I have the opacity set at 0 then run set_opacity(180, 2880) which is how I currently have my script set up for 1 hour on in-game time, the opacity change starts out slow. It gradually gets faster then eventually slows down and hits the 180 mark before 2880 frames have even passed. Am I know understanding the time argument correctly?

Just to test, I went into the demo and manually set to shadow opacity to 0. I then ran set_opacity(180, 43200) as 43200 frames is equal to 12 hours in my game time. According to this, the opacity should increase by 1 every 240 frames which is equal to 4 real life seconds. Instead it didn't change to 1 until around the 35 second mark, 2 about 15 seconds later, 3 about 10 seconds later, 4 about 9 seconds later, 5 about 8 seconds later, 6 about 7 seconds later and so on and so on. It was never consistent.
You would probably be better off running the opacity changes every few frames rather than using one command over a long period of time... Even for fade-out BGM, it does seems like it starts off slow and quickens as it nears the end.
Yeah, I don't want to do that for performance sake. Maybe every hour on the hour I'll have it recalculate and auto set it to what it should be at that time. That works retain some semblance of gradually changing over time without affecting performance. But I still wonder why it's not just consistent.
This behavior is expected!

I've implemented smooth opacity variation within this function (if you call it with a desired time). It uses a cosine curve to change the opacity smoothly, so it starts slow, then it increases the opacity variation speed, and then it reverses until it slowly approaches the desired opacity.

As your time script needs to change the opacity slowly, I recommend to you to make instant opacity changes every significant frames. The player won't notice an opacity increase of 1, so you can add a bit more opacity and increase the change interval.

This method won't affect performance 😀
Ahh I see. That does make sense. And actually after some extensive testing of my time script with the smooth opacity variation, I think I actually like that better. More of a realistic feel to the sun going up and coming down. Thanks for the help!

Original thread: https://forums.rpgmakerweb.com/threads/question-about-set_opacity-timer.43992/