Smooth Event Fade In

Danelius90

Villager
Member
Joined
Jun 27, 2017
Messages
6
Reaction score
3
First Language
English
Primarily Uses
RMMV
I'm new to scripting in MV and have been googling how to do this but couldn't find what I wanted.

I want an event to fade in smoothly, so I've made a loop that sets the event's opacity gradually increasing it. However the screen isn't updated until the script has finished. Is there some call to update what is displayed during a script? I'd prefer not to use a plugin as it seems like it should be simple enough and I'll probably just use it once anyway.
 

Danelius90

Villager
Member
Joined
Jun 27, 2017
Messages
6
Reaction score
3
First Language
English
Primarily Uses
RMMV
This is probably not the most efficient solution but I came up with this a while back - in a parallel event run this
upload_2018-3-10_15-50-13.png
and it will handle the updating on its own. Works fine for an occasional effect. Thread can be closed
 

peq42_

Yeet
Veteran
Joined
Feb 5, 2016
Messages
484
Reaction score
288
First Language
Portuguese(BR)
Primarily Uses
RMMV
i recommended you to use the ivra libs for this
https://forums.rpgmakerweb.com/index.php?threads/iavra-animate-everything-easing-library.46826/

PHP:
let myEvent = $gameMap.event(1);
new IAVRA.ANIMATE.Tween(myEvent, {_opacity: 0}).duration(60).start(); //for rmmv sprite
new IAVRA.ANIMATE.Tween(myEvent, {alpha: 0}).duration(60).start(); //for pixi sprite
But is it better in performance?Or the same thing?(Because here, the performance of his code is fine)

@topic: Your code works, but you need to add 1 thing on it: a wait (Or reduce that opacity increase to 1/frame) after that code, so it will fade in a bit slower(because that code of yours, the way it is now, takes less than 1 second to finish getting to 255, as it increases 5 per frame and MV runs at 60 frames/second)
 

Jonforum

Veteran
Veteran
Joined
Mar 28, 2016
Messages
1,623
Reaction score
1,440
First Language
French
Primarily Uses
RMMV
But is it better in performance?Or the same thing?(Because here, the performance of his code is fine)

@topic: Your code works, but you need to add 1 thing on it: a wait (Or reduce that opacity increase to 1/frame) after that code, so it will fade in a bit slower(because that code of yours, the way it is now, takes less than 1 second to finish getting to 255, as it increases 5 per frame and MV runs at 60 frames/second)
yes is very more fast to use pure scrypt than a script call inside a rmmv event.
try performance.now()
rmmv use eval() each time you call script in string.

bench here
https://jsperf.com/function-vs-constructor-vs-eval
 

peq42_

Yeet
Veteran
Joined
Feb 5, 2016
Messages
484
Reaction score
288
First Language
Portuguese(BR)
Primarily Uses
RMMV
But is faster always lighter?(Thats really a question, I don't know)
Because those tests you posted shows that this method is a lot faster, but to the game's "ecosystem" is it lighter?
 

Danelius90

Villager
Member
Joined
Jun 27, 2017
Messages
6
Reaction score
3
First Language
English
Primarily Uses
RMMV
Thanks for suggesting this, this might come in handy in future


@topic: Your code works, but you need to add 1 thing on it: a wait (Or reduce that opacity increase to 1/frame) after that code, so it will fade in a bit slower(because that code of yours, the way it is now, takes less than 1 second to finish getting to 255, as it increases 5 per frame and MV runs at 60 frames/second)
Thanks I'll have a play around. At the moment it's comparable to using FadeIn Screen for a similar effect
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top