Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

186
Views
electron browser window animations

So, I try to animate browser window in electron app. I try to use this code to do this:

const fadeWindowOut =  (
  browserWindowToFadeOut,
  step = 0.1,
  fadeEveryXSeconds = 10
) => {
  let opacity = browserWindowToFadeOut.getOpacity();
  const interval = setInterval(() => {
     if (opacity <= 0) window.clearInterval(interval);
     browserWindowToFadeOut.setOpacity(opacity);
     opacity -= step;
  }, fadeEveryXSeconds);

  return interval;
}

It work's correctly but I can't handle user click to icon in the taskbar. When user clicks to icon in the taskbar, window minimized or restored by default.

I can catch events 'minimize', but I can't prevent default and do my animation before default.

// it doesn't work
mainWin.on('minimize', async (event) => {
  event.preventDefault();
  await doMyAnimationHere();
  mainWin.minimize();
});

So, how can I run my animation before default 'minimize' event?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!