Giter Site home page Giter Site logo

skycons's Introduction

Skycons

Skycons is a set of ten animated weather glyphs, procedurally generated by JavaScript using the HTML5 canvas tag. They're easy to use, and pretty lightweight, so they shouldn't rain on your parade:

<canvas id="icon1" width="128" height="128"></canvas>
<canvas id="icon2" width="128" height="128"></canvas>

<script>
  var skycons = new Skycons({"color": "pink"});
  // on Android, a nasty hack is needed: {"resizeClear": true}

  // you can add a canvas by it's ID...
  skycons.add("icon1", Skycons.PARTLY_CLOUDY_DAY);

  // ...or by the canvas DOM element itself.
  skycons.add(document.getElementById("icon2"), Skycons.RAIN);

  // if you're using the Forecast API, you can also supply
  // strings: "partly-cloudy-day" or "rain".

  // start animation!
  skycons.play();

  // you can also halt animation with skycons.pause()

  // want to change the icon? no problem:
  skycons.set("icon1", Skycons.PARTLY_CLOUDY_NIGHT);

  // want to remove one altogether? no problem:
  skycons.remove("icon2");
</script>

Skycons were designed for Forecast by those wacky folks at The Dark Sky Company, and were heavily inspired by Adam Whitcroft's excellent Climacons. The source code has been released into the public domain, so please do with it as you see fit! โ™ก

Variants

Dark Sky no longer actively maintains Skycons, but several kind folks have made variants that you might be interested in:

skycons's People

Contributors

esamattis avatar gasperk avatar loop0 avatar maxdow avatar peternewman avatar tbarmann avatar thegrossman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skycons's Issues

viewbox should be viewBox in <svg> element of icons

I tried to use the Skycons in my project, but they weren't scaling to fit into the specified bounding box.

I found that the viewbox atrribute in the <svg> element is using the wrong case. The 'B' should be a capital letter. It should be viewBox .

The SVG icon files need to be changed to fix this.

Wind icon animation and non 1:1 aspect ratios

Hi,

Firstly thanks for this, it's really nice. I find if I draw a canvas by default it seems to have an aspect ratio of 2:1 and I don't seem to be able to constrain it as a percentage of the browser size. This is generally not an issue, but it spoils the wind animation as you see the leaf appearing and disappearing. I've been able to temporarily fix it with canvas.height = canvas.width in the draw function. Is there a better way? Should I open a PR to set both dimensions to the smallest of the two so all the icons render correctly?

Having just tested, as similar thing happens with the falling icons (rain/sleet/snow) if you make the aspect ratio 1:2, the elements vanish before they disappear off the bottom of the canvas.

Skycons animation consuming constantly 100% CPU in Chromium

Hi, just wondered why my project is consuming constantly 100% of CPU (single core) and also some GPU in Chromium (newest build - April 4th 2020).
I could determine the Skycons, hanging in the requestAnimationFrame-loop. I can reproduce it.
Not sure what is going on exactly though. Firefox does not have any problems with it.

Two screenshot from the Chromium profiler:
Bildschirmfoto_2020-04-06_20-02-57
Bildschirmfoto_2020-04-06_20-04-42

Changing the icon colors

Is there any way to change the color of the icons once they're created? With themed sites being very common these days it seems an oversight to not have this ability. Nor do I mean individually coloring the icons either.

Animated SVGs are well enough supported now that Skycons should be SVG.

Way, way back when we originally made Skycons, the only way to make them was by drawing to a Canvas in JavaScript. These days, animated SVGs are well-enough supported that Skycons should really just be SVG.

This would fix several issues:

  1. Heavy CPU usage on pages that include Skycons.
  2. "Blurry" rasterization of Skycons when one doesn't size the Canvas appropriately.
  3. Make it easier to customize/alter the Skycons using tools that are already built for the purpose.

We've started a skycons/svg branch for working on these. (It's slow going, though, since I very rarely have the extra hours to work on it.)

Already complete are the clear_day and clear_night Skycons. The next big task is to implement that fancy cloud, since so many of the Skycons depend on it.

List

Why not make a very simple list of image->name ? It should be less painful to find the correct image for the right situation.
Thanks

Don't user IDs

I would think utilizing class names for the canvas attribute rather than IDs would be preferable. As it is, the same icon cannot appear twice on a page as that would mean elements sharing the same ID. This practically impedes any ability to utilize this for a true forecast where multiple days may have the same weather.

Library license

Hi @ironwallaby,

Under what license you library is hosted?
Thanks

Package.json

Hi. Please, can you init package.json file on your project?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.