1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-13 15:15:45 +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();
let animationObserver: BABYLON.Observer<BABYLON.Scene>;
return {
onInited: () => {
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];
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);
emitter.parent = root;
emitter.position = new BABYLON.Vector3(0, cm(10), 0);
@@ -123,7 +129,11 @@ export const lavaLamp = defineObject({
case 'lightColor': applyLightColor(); break;
}
},
dispose: () => {
if (animationObserver != null) {
scene.onAfterAnimationsObservable.remove(animationObserver);
}
},
};
},
});