Skip to content

Commit

Permalink
Renamed new icons
Browse files Browse the repository at this point in the history
SLEET was renamed to RAIN_SNOW.
The original SLEET was restored.
The original index.html was also restored.
  • Loading branch information
galdiuz committed Jan 28, 2016
1 parent 76d4075 commit b5e295e
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 92 deletions.
184 changes: 94 additions & 90 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,110 +23,117 @@
margin: 0.5em 0;
}

h2 {
font-size: 2em;
margin: 0.5em;
text-align: center;
}

p {
margin: 1.5em 0;
}

figure {
margin: 3em auto;
width: 368px;
height: 152px;
}

canvas {
display: inline-block;
margin-left: 4px;
margin-right: 20px;
margin-top: 0px;
display: block;
float: left;
margin-left: 8px;
margin-top: 8px;
}

td {
text-align: right;
pre {
font: 77.8%/1.5em "Lucida Sans Typewriter", "Lucida Console", "Monaco", "Bitstream Vera Sans Mono", monospace;
margin: 3.375em 1.6875em;
}

a {
a, pre span.comment {
color: royalblue;
}

a:visited {
a:visited, pre span.constant {
color: indianred;
}
</style>
</head>

<body>
<article>
<h1>Skycons Extension</h1>

<p>This is a modification of the original <a href="http://darkskyapp.github.io/skycons/">Skycons</a>, adding additional weather conditions that were not present in the original and changing sleet to what I thought was a more fitting option.</p>

<h2>Icons:</h2>
<table>
<tr>
<td>clear-day</td>
<td><canvas id="clear-day" width="64" height="64"></canvas></td>
<td>clear-night</td>
<td><canvas id="clear-night" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>partly-cloudy-day</td>
<td><canvas id="partly-cloudy-day" width="64" height="64"></canvas></td>
<td>partly-cloudy-night</td>
<td><canvas id="partly-cloudy-night" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>cloudy</td>
<td><canvas id="cloudy" width="64" height="64"></canvas></td>
<td>rain</td>
<td><canvas id="rain" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>showers-day</td>
<td><canvas id="showers-day" width="64" height="64"></canvas></td>
<td>showers-night</td>
<td><canvas id="showers-night" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>sleet</td>
<td><canvas id="sleet" width="64" height="64"></canvas></td>
<td>sleet-showers-day</td>
<td><canvas id="sleet-showers-day" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>sleet-showers-night</td>
<td><canvas id="sleet-showers-night" width="64" height="64"></canvas></td>
<td>snow</td>
<td><canvas id="snow" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>snow-showers-day</td>
<td><canvas id="snow-showers-day" width="64" height="64"></canvas></td>
<td>snow-showers-night</td>
<td><canvas id="snow-showers-night" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>wind</td>
<td><canvas id="wind" width="64" height="64"></canvas></td>
<td>fog</td>
<td><canvas id="fog" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>thunder</td>
<td><canvas id="thunder" width="64" height="64"></canvas></td>
<td>thunder-rain</td>
<td><canvas id="thunder-rain" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>thunder-showers-day</td>
<td><canvas id="thunder-showers-day" width="64" height="64"></canvas></td>
<td>thunder-showers-night</td>
<td><canvas id="thunder-showers-night" width="64" height="64"></canvas></td>
</tr>
<tr>
<td>hail</td>
<td><canvas id="hail" width="64" height="64"></canvas></td>
</tr>
</table>
<h1>Skycons</h1>

<p><strong>Skycons</strong> is a set of ten animated weather glyphs,
procedurally generated by JavaScript using the HTML5 canvas tag.</p>

<figure class="icons">
<canvas id="clear-day" width="64" height="64">
</canvas>

<canvas id="clear-night" width="64" height="64">
</canvas>

<canvas id="partly-cloudy-day" width="64" height="64">
</canvas>

<canvas id="partly-cloudy-night" width="64" height="64">
</canvas>

<canvas id="cloudy" width="64" height="64">
</canvas>

<canvas id="rain" width="64" height="64">
</canvas>

<canvas id="sleet" width="64" height="64">
</canvas>

<canvas id="snow" width="64" height="64">
</canvas>

<canvas id="wind" width="64" height="64">
</canvas>

<canvas id="fog" width="64" height="64">
</canvas>
</figure>

<p>They&rsquo;re easy to use, and pretty lightweight, so they
shouldn&rsquo;t rain on your parade:</p>

<pre>&lt;canvas id="icon1" width="128" height="128"&gt;&lt;/canvas&gt;
&lt;canvas id="icon2" width="128" height="128"&gt;&lt;/canvas&gt;

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

<span class="comment">// you can add a canvas by it's ID...</span>
skycons.add(<span class="constant">"icon1"</span>, Skycons.PARTLY_CLOUDY_DAY);

<span class="comment">// ...or by the canvas DOM element itself.</span>
skycons.add(document.getElementById(<span class="constant">"icon2"</span>), Skycons.RAIN);

<span class="comment">// if you're using the Forecast API, you can also supply
// strings: "partly-cloudy-day" or "rain".</span>

<span class="comment">// start animation!</span>
skycons.play();

<span class="comment">// you can also halt animation with skycons.pause()</span>

<span class="comment">// want to change the icon? no problem:</span>
skycons.set(<span class="constant">"icon1"</span>, Skycons.PARTLY_CLOUDY_NIGHT);

<span class="comment">// want to remove one altogether? no problem:</span>
skycons.remove(<span class="constant">"icon2"</span>);
&lt;/script&gt;</pre>

<p>Skycons were designed for <a href="http://forecast.io/">Forecast</a>
by those wacky folks at <strong>The Dark Sky Company</strong>, and were
heavily inspired by Adam Whitcroft&rsquo;s excellent
<a href="http://adamwhitcroft.com/climacons/">Climacons</a>. The source
code is available on
<a href="http://github.com/darkskyapp/skycons">Github</a>, and has been
<a href="http://creativecommons.org/publicdomain/zero/1.0/">released
into the public domain</a>, so please do with it as you see fit!
&#9825;</p>
</article>

<script src="skycons.js"></script>
Expand All @@ -135,11 +142,8 @@ <h2>Icons:</h2>
var icons = new Skycons(),
list = [
"clear-day", "clear-night", "partly-cloudy-day",
"partly-cloudy-night", "cloudy", "rain", "showers-day",
"showers-night", "sleet", "sleet-showers-day",
"sleet-showers-night", "snow", "snow-showers-day",
"snow-showers-night", "wind", "fog", "thunder", "thunder-rain",
"thunder-showers-day", "thunder-showers-night", "hail"
"partly-cloudy-night", "cloudy", "rain", "sleet", "snow", "wind",
"fog"
],
i;

Expand Down
14 changes: 12 additions & 2 deletions skycons.js
Original file line number Diff line number Diff line change
Expand Up @@ -650,12 +650,22 @@
h = ctx.canvas.height,
s = Math.min(w, h);

sleet(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
cloud(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
};

Skycons.RAIN_SNOW = function(ctx, t, color) {
var w = ctx.canvas.width,
h = ctx.canvas.height,
s = Math.min(w, h);

rain(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
snow(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
cloud(ctx, t, w * 0.5, h * 0.37, s * 0.9, s * STROKE, color);
};

Skycons.SLEET_SHOWERS_DAY = function(ctx, t, color) {

Skycons.RAIN_SNOW_SHOWERS_DAY = function(ctx, t, color) {
var w = ctx.canvas.width,
h = ctx.canvas.height,
s = Math.min(w, h);
Expand All @@ -666,7 +676,7 @@
cloud(ctx, t, w * 0.375, h * 0.5, s * 0.7, s * STROKE * 0.9, color);
};

Skycons.SLEET_SHOWERS_NIGHT = function(ctx, t, color) {
Skycons.RAIN_SNOW_SHOWERS_NIGHT = function(ctx, t, color) {
var w = ctx.canvas.width,
h = ctx.canvas.height,
s = Math.min(w, h);
Expand Down

0 comments on commit b5e295e

Please sign in to comment.