1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-27 15:24:43 +02:00

Update lavaLamp.ts

This commit is contained in:
syuilo
2026-05-01 19:37:50 +09:00
parent 18c08f52f1
commit a931079896

View File

@@ -59,6 +59,8 @@ export const lavaLamp = defineObject({
applyLightColor(); applyLightColor();
let animationObserver: BABYLON.Observer<BABYLON.Scene>;
return { return {
onInited: () => { onInited: () => {
const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, cm(11), 0), scene, room?.lightContainer != null); const light = new BABYLON.PointLight('lavaLampLight', new BABYLON.Vector3(0, cm(11), 0), scene, room?.lightContainer != null);
@@ -90,6 +92,10 @@ export const lavaLamp = defineObject({
sphere2.animations = [anim]; sphere2.animations = [anim];
scene.beginAnimation(sphere2, 0, 500, true, 0.6); scene.beginAnimation(sphere2, 0, 500, true, 0.6);
animationObserver = scene.onAfterAnimationsObservable.add(() => {
room?.sr.updateMesh([sphere, sphere2], false);
});
const emitter = new BABYLON.TransformNode('emitter', scene); const emitter = new BABYLON.TransformNode('emitter', scene);
emitter.parent = root; emitter.parent = root;
emitter.position = new BABYLON.Vector3(0, cm(10), 0); emitter.position = new BABYLON.Vector3(0, cm(10), 0);
@@ -123,7 +129,11 @@ export const lavaLamp = defineObject({
case 'lightColor': applyLightColor(); break; case 'lightColor': applyLightColor(); break;
} }
}, },
dispose: () => {
if (animationObserver != null) {
scene.onAfterAnimationsObservable.remove(animationObserver);
}
},
}; };
}, },
}); });