1
0
mirror of https://github.com/misskey-dev/misskey.git synced 2026-05-22 11:44:10 +02:00
This commit is contained in:
syuilo
2026-02-15 20:43:25 +09:00
parent d8d4b230b0
commit be67e75ef9
34 changed files with 789 additions and 310 deletions

View File

@@ -0,0 +1,31 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import * as BABYLON from '@babylonjs/core';
import { defineObject } from '../engine.js';
export const wallClock = defineObject({
id: 'wallClock',
defaultOptions: {},
placement: 'side',
createInstance: ({ room, o, root }) => {
return {
onInited: () => {
const hourHand = root.getChildMeshes().find(m => m.name === 'HandH') as BABYLON.Mesh;
const minuteHand = root.getChildMeshes().find(m => m.name === 'HandM') as BABYLON.Mesh;
room.intervalIds.push(window.setInterval(() => {
const now = new Date();
const hours = now.getHours() % 12;
const minutes = now.getMinutes();
const hAngle = -(hours / 12) * Math.PI * 2 - (minutes / 60) * (Math.PI * 2 / 12);
const mAngle = -(minutes / 60) * Math.PI * 2;
hourHand.rotation = new BABYLON.Vector3(0, 0, hAngle);
minuteHand.rotation = new BABYLON.Vector3(0, 0, mAngle);
}, 1000));
},
interactions: {},
};
},
});