Show HN: 300x288 pixel clock using HTML5 canvas and Javascript
coding.pressbin.com
coding.pressbin.com
I like that your clock simply displays the time of day as a visual ratio of time elapsed to time remaining. Of course, at the one-second-per-pixel scale, getting the precise time of day at a glance is a little tough.
Have you considered using color to earmark blocks of time? If it's 300 pixels wide, then a row is 5 minutes. Have you tried maybe some pinstriping on each sixth row to show hour marks? Maybe wider, like 2-hour blocks? I think it would give a lot more information in a single glance.
Do you think turning it 90 degrees and having it progress left to right would be easier or more intuitive? And what about the size? 300x288 has its advantages, but have you played with other aspect ratios?
I'm not trying to pick apart your work, I'm trying to suggest different ways to take it because I like what you've done. If you want to return fire, I made http://slumberheart.com/things/clock.html earlier this year and would love to hear some suggestions.
--- pixelclock.html.orig 2011-12-06 16:40:56.000000000 +0000
+++ pixelclock.html 2011-12-06 16:39:43.000000000 +0000
@@ -23,6 +23,7 @@
var inpos = (y*width*4);
for (var x = 0; x < width; x++) {
var color = (y*width)+x < elapsed ? low : high;
+ if (y % (3600/width)) { color = (color+128)/2; }
imageData.data[inpos++] = r;
imageData.data[inpos++] = g;
imageData.data[inpos++] = b;http://jcs.org/notaweblog/2005/06/28/pixelclock/
it draws little notches along the right side of the screen, one for every hour, with green ones for special times (lunch, or time to leave). a yellow square just moves down the side of the screen as the day progresses.
Picturing it shading hours in the office, after-hours appointments, approximate lunch times, reminders to move cars or do other things.
Though that would require geoip location and a sun rise/set calculator.
<!DOCTYPE HTML> is necessary to let IE9 work without whining
imageData is slow and I'd avoid using it. In this instance you can accomplish the same effect with calls to fillRect.
As it stands right now, you are setting the fillStyle of the arc each time but only need to set it once since the fillStyle never changes. In fact, you probably don't even have to recreate the path each time, since the last path ought to still be there, so the only thing that needs to be in the loop for the arc is `ctx.fill();`! (Haven't tested, but that ought to be the case)
I'll leave it up to you to figure out what that will represent.
The depressing part is either that this forces you to realize or reminds you that time is, in fact, limited -- or that it tricks you into thinking time isn't infinite, depending on your philosophy.
colours could be used to mean different things! day, night, summer, winter, full moons etc... cant think of a use for it right now, but I'm sure one will 'spring' to mind! ;-)
Lots of things like this don't seem to have even been tested in IE9, despite the fact it's (subjectively, to me at least) a decent browser that finally supports Canvas.
But for one-off interesting thing, you'll probably check it in browser(s) you have installed only, or maybe even only your favourite one... and it's unlikely that IE will be that browser. Just a reflection on the setup of an average webdev interested in canvas.
Perhaps the author of this code is in a similar position, and has no Windows Vista/7 installs to test via IE9 with? It doesn't matter how decent IE9 is, if it won't run on your current platforms.
Testing on Chrome, Firefox and Opera is more universally easy as their latest desktop releases will run on Linux, OSX and XP+.
If a missing or malformed DOCTYPE is an issue then that is not IE9's fault, but you can't criticise the author for not explicitly testing on IE9 if he/she can't do so.
The reasons behind that I'm sure are numerous and valid for a lot of people, but they don't make it any less annoying for me as a regular IE9 user.
... I hate you.