Compare commits
2 commits
bd31c08c16
...
6220dd76d5
Author | SHA1 | Date | |
---|---|---|---|
|
6220dd76d5 | ||
|
ac2728b393 |
|
@ -13,11 +13,13 @@ const res = await fetch("https://whereis.chandlerswift.com/api/0/last");
|
|||
const locs = await res.json();
|
||||
const loc = locs[0];
|
||||
|
||||
let geometry = new Point(fromLonLat([loc.lon, loc.lat]));
|
||||
|
||||
const vectorLayer = new VectorLayer({
|
||||
source: new VectorSource({
|
||||
features: [
|
||||
new Feature({
|
||||
geometry: new Point(fromLonLat([loc.lon, loc.lat])),
|
||||
geometry: geometry,
|
||||
})
|
||||
]
|
||||
}),
|
||||
|
@ -29,4 +31,11 @@ const vectorLayer = new VectorLayer({
|
|||
}),
|
||||
});
|
||||
|
||||
setInterval(async function(){
|
||||
const res = await fetch("https://whereis.chandlerswift.com/api/0/last");
|
||||
const locs = await res.json();
|
||||
const loc = locs[0];
|
||||
geometry.setCoordinates(fromLonLat([loc.lon, loc.lat]));
|
||||
}, 10 * 1000);
|
||||
|
||||
export default vectorLayer;
|
||||
|
|
|
@ -25,4 +25,5 @@ let layers = [];
|
|||
export default {
|
||||
name: "Light Pollution",
|
||||
layers: layers,
|
||||
details: "For legend and more information, see <a href='https://www.cleardarksky.com/'>cleardarksky.com</a>.",
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue