AlainGourves / solar-widget

Widget to display the position of the Sun in the sky according to time and geolocation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Solar Widget

Usage

HTML

<div class="solar-parent"></div>

CSS/SCSS

// feuille de style à intégrer

Javascript

import SolarWidget from "./solar-widget.js";

const params = {
    lat: 48.1124,
    lon: -1.6798,
    apiKey: import.meta.env.VITE_API_KEY
}

let widget;

async function main() {
    widget = new SolarWidget(parent, params);
    widget.clipping = true; // widget is clipped in a "squircle"
    widget.refreshDelay = 60000; // redraw every minute
    await widget.init()
    temp.innerHTML = widget.temperature; // tempeature & relative humidity infos are accessible
    hum.innerHTML = widget.humidity;
}

window.addEventListener('load', ev => {
    main();
});

About

Widget to display the position of the Sun in the sky according to time and geolocation


Languages

Language:JavaScript 80.5%Language:SCSS 17.2%Language:HTML 2.2%