KLOK


    <style>
        body {
            background-color: transparent;
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            margin: 0;
        }

        canvas {
            border: none;
        }
    </style>
    <title>Studio Clock</title>
</head>
<body>
    <canvas id="countdownClock" width="800" height="800"></canvas>

    <script src="https://cdnjs.cloudflare.com/ajax/libs/ntp-client/1.0.0/ntpClient.min.js"></script>
    <script>
        const canvas = document.getElementById('countdownClock');
        const context = canvas.getContext('2d');
        const radius = canvas.width / 2;

        async function drawClock() {
            context.clearRect(0, 0, canvas.width, canvas.height);

            // Haal de tijd van een NTP-server
            const timeFromServer = await NTPClient.getNetworkTime('ntp1.time.nl');
            const now = new Date(timeFromServer);

            const seconds = now.getSeconds();
            const minutes = now.getMinutes();
            const hours = now.getHours();

            const timeString = `${hours.toString().padStart(2, '0')}:${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;

            context.font = '120px Arial';
            context.fillStyle = 'white';
            context.textAlign = 'center';
            context.textBaseline = 'middle';
            context.fillText(timeString, radius, radius);

            for (let i = 0; i < 60; i++) {
                const angle = ((i - 15) / 60) * 2 * Math.PI;
                const x = radius + (radius - 30) * Math.cos(angle);
                const y = radius + (radius - 30) * Math.sin(angle);

                context.beginPath();
                context.arc(x, y, 15, 0, 2 * Math.PI);

                if (i < seconds) {
                    context.fillStyle = 'red';
                } else {
                    context.fillStyle = 'white';
                }

                context.fill();
            }
        }

        // Start de klok nadat de pagina is geladen
        window.onload = function() {
            drawClock();
            // Update de klok elke seconde
            setInterval(drawClock, 1000);
        };
    </script>
</body>