News for hackers. Stuff that matters.
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by kevingadd on Friday November 26, 2010 @11:20AM (#1942642)
Left the snowglobe open for about 10 minutes in a tab and Firefox hit 2GB of memory usage. :-( Not necessarily your fault, but definitely hampers the charm... pretty demo, regardless. Wish I had a device with support for HTML orientation events so I could try it out there.
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by fredoliveira on Friday November 26, 2010 @11:28AM (#1942656)
Ouch. Sorry - that is indeed a problem (not necessarily in this context - this page goes away on monday - but in general)! Strangely, we are reusing our objects, so I don't think it can be the javascript code itself. Could it somehow be Firefox's implementation of canvas?

I will investigate. Thanks!

Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by timtadh on Friday November 26, 2010 @12:49PM (#1942825)
I didn't leave the page open but I did notice that it pegged a processor [Firefox 4 beta8pre].
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by fduffner on Friday November 26, 2010 @12:07PM (#1942733)
Nicely done!

I recently made a snowglobe generator where people can create there own.

http://www.snowglobecreator.com/

It's very basic though and also in Flash so it won't run on iphone etc. =/ Yet it was fun too watch what people did with it so far. Like my friend who did a series of videogame styled globes like this one. http://www.snowglobecreator.com/?uid=52#featured

Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by fredoliveira on Friday November 26, 2010 @09:24AM (#1942430)
While the post itself talks briefly about implementing the snow algorithm and the tilting, more advanced people can go directly through the code over at github: https://gist.github.com/716215
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by colinprince on Friday November 26, 2010 @10:15AM (#1942515)
Rotation of my iPhone seemed to really throw it off. All the snowflakes suddenly zoomed off to the left, and then there were no flakes left in the globe.

After I returned back to portrait orientation there will still no flakes :(

EDIT: iPhone 4 with iOS 4.2.1

Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by fredoliveira on Friday November 26, 2010 @10:16AM (#1942522)
interesting - we tried it out (was it ultra slow for you too?) and while we didn't see the snowflakes zoom to the left, we didn't get orientation events. We didn't have a lot of time so we went with it, but we'll look into the code and see what's up.
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by windsurfer on Friday November 26, 2010 @11:41AM (#1942685)
This page works great on my N900 :)
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by fredoliveira on Friday November 26, 2010 @11:51AM (#1942707)
Now that is something I honestly didn't expect - but that I like hearing.
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by jaaron on Friday November 26, 2010 @10:42AM (#1942584)
Orientation events are new in mobile safari as of iOS 4.2. The orientation works on the iPad, for example.
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by noisebleed on Friday November 26, 2010 @02:44PM (#1943097)
Yes, but there's been a common workaround using window.orientation for a while:

http://stackoverflow.com/questions/2313194/can-i-trigger-a-c...

Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by colinprince on Friday November 26, 2010 @11:42AM (#1942686)
Yes it was kindof slow
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by fbatista on Friday November 26, 2010 @09:39AM (#1942452)
Really nice one! Love the "gracefull degrade" implementation where if you dont have tilting device, it uses the mouse instead ;)
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by callmeed on Friday November 26, 2010 @11:40AM (#1942681)
Pretty cool ... how about some mobile safari accelerometer support?

https://developer.apple.com/library/safari/#documentation/Sa...

Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by icefox on Friday November 26, 2010 @10:33PM (#1944204)
Hmm for some reason on my macbook pro if I tilt to the right the snow goes to the left and vice versa...
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by ck2 on Friday November 26, 2010 @08:03PM (#1943934)
But snowglobes are terrorist devices!

http://www.flickr.com/photos/laughingsquid/4767715025/sizes/...

I guess virtual ones will be all we can have now.

(but seriously, impressive work!)

Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by franciscocosta on Friday November 26, 2010 @10:28AM (#1942551)
very cool! I hope you get good valuable traction with this stylish hack!
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by nunomorgadinho on Friday November 26, 2010 @11:07AM (#1942621)
Very nice, congrats :)
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by sergiorebelo on Friday November 26, 2010 @01:05PM (#1942866)
pretty cool Fred!
Re:Implementing a HTML5 canvas-based, tilt sensing snow globe by obneq on Friday November 26, 2010 @10:27AM (#1942549)
now thats the kind of stuff I'd expect on hacker news... what is interesting about this? clearly it must be the advanced physics engine.