Fade In/Out Electron Window
Today we will cover how to fade in and out electron browser window to achieve some cool looking effect. We will write some functions do this in Electron’s renderer process.
Let’s start out by writing the function that fades In a browser window:
Writing a fadeOut function writing inverse of our fade In logics:
Now that we have both functions, using them goes like this:
Bonus
Let’s say for some reason we want to stop fading at will. Since both fadeWindowIn and fadeWindowOut method returns a time identifier, we can use this to cancel the interval at will using the clearInterval function.
Demo
I have set up and an Electron Fiddle for demo purpose 👇https://gist.github.com/757e9afce3b6bd97f2b024b787653dfe