-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
32 lines (23 loc) · 1.07 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import { getTime } from "./modules/getTime.js";
import { updateRoute } from "./modules/routeLine.js";
import { blinkTimeColon } from "./modules/blinkingColon.js";
const stations = [
{ id: "station-1", name: "Nanaimo" },
{ id: "station-2", name: "Main Street – Science World" },
{ id: "station-3", name: "Stadium – Chinatown" }
];
let currentStationIndex = 0;
const progressBar = document.querySelector('.progress-bar');
const trainMarker = document.querySelector('.train-marker');
const nextStation = document.getElementById('next-station');
const timeColon = document.getElementById('blinking-colon');
const hours = document.getElementById("current-hour");
const minutesPeriod = document.getElementById("current-minutes-period");
setInterval(() => {
if (currentStationIndex < stations.length - 1) {
currentStationIndex++;
updateRoute(progressBar, trainMarker, nextStation);
}
}, 1000);
const blinkingColonUpdate = setInterval(() => {blinkTimeColon(timeColon)}, 2000);
const timeUpdate = setInterval(() => {getTime(hours, minutesPeriod)}, 30000);