Sets up a transparent, always-on-top, frameless Electron window hosting a Three.js scene that loads assets/avatar.vrm via @pixiv/three-vrm and plays the bundled .vrma clips through @pixiv/three-vrm-animation. Fixes the default CSP (which blocked texture-loading blob: fetches) and frames the camera on the model automatically. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
23 lines
605 B
TypeScript
23 lines
605 B
TypeScript
import { contextBridge, ipcRenderer } from 'electron'
|
|
import { electronAPI } from '@electron-toolkit/preload'
|
|
|
|
const api = {
|
|
setIgnoreMouseEvents: (ignore: boolean, options?: { forward: boolean }): void => {
|
|
ipcRenderer.send('set-ignore-mouse-events', ignore, options)
|
|
}
|
|
}
|
|
|
|
if (process.contextIsolated) {
|
|
try {
|
|
contextBridge.exposeInMainWorld('electron', electronAPI)
|
|
contextBridge.exposeInMainWorld('api', api)
|
|
} catch (error) {
|
|
console.error(error)
|
|
}
|
|
} else {
|
|
// @ts-ignore (define in dts)
|
|
window.electron = electronAPI
|
|
// @ts-ignore (define in dts)
|
|
window.api = api
|
|
}
|