Rotate native Electron window on macOS
Note: this is a silly proof-of-concept npm module that demonstrates using Nodejs N-API.
Read a blog post about it: https://antonfisher.com/posts/2020/12/27/how-to-animate-native-electron-window/
Install the module:
npm install electron-window-rotator
Rotate BrowserWindow every 3 seconds:
const Rotator = require('electron-window-rotator');
const mainWindow = new BrowserWindow({ ... });
setInterval(() => {
Rotator.rotate(
mainWindow, // Electron's BrowserWindow instance
1000, // animation duration [ms]
Rotator.DIRECTION_LEFT // rotation direction
);
}, 3000);
git clone https://github.com/antonfisher/electron-window-rotator.git
cd electron-window-rotator && npm install
cd demo && npm install && cd -
xcode-select --install
npm start
MIT License