Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

hiho, basically box2d-jquery is a jquery wrapper around box2dweb, it's quite simple to use

  $("#some_element").box2d({'y-velocity':10});
it was fun to code, basically it

  * creates absolute positioned clones of your selected elements https://gist.github.com/4051578 
  * and animates them usind CSS3 transforms / translate / rotate
  * the values are calculated using box2dweb
i created it as i sponsor a javascript/jquery conference in my hometown (we need more dev-conferences here) and wanted to create something cool.

please fork it on github (zlib license) https://github.com/franzenzenhofer/box2d-jquery

update: more examples linked from github Readme.md



Very cool! I created a small bookmarklet that injects it into the system we're developing over here. It's nice to amaze some colleagues real quick. ;)

    javascript:(function(){var%20s=document.createElement('script');s.setAttribute('src','https://raw.github.com/franzenzenhofer/box2d-jquery/master/js/lib/jquery.box2d.min.js');document.getElementsByTagName('body')[0].appendChild(s);window.setTimeout(function(){$("#main-nav,header").box2d({'y-velocity':5,'x-velocity':-0.05,'debug':false});},500);})();
Note: if you copy this in the omnibox of chrome, you will need to re-add "javascript:" in front of it.

Edit: And a working bookmarklet for HN that also injects jquery.

    javascript:(function(){var%20s=document.createElement('script');s.setAttribute('src','//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');document.getElementsByTagName('body')[0].appendChild(s);s=document.createElement('script');s.setAttribute('src','https://raw.github.com/franzenzenhofer/box2d-jquery/master/js/lib/jquery.box2d.min.js');document.getElementsByTagName('body')[0].appendChild(s);window.setTimeout(function(){$("td:first()").box2d({'y-velocity':5,'x-velocity':-0.05,'debug':false});},500);})();


cool, here is on for the HN frontpage with a little bit more action (selects every <a> element)

    javascript:(function(){var%20s=document.createElement('script');s.setAttribute('src','//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js');document.getElementsByTagName('body')[0].appendChild(s);s=document.createElement('script');s.setAttribute('src','https://raw.github.com/franzenzenhofer/box2d-jquery/master/js/lib/jquery.box2d.min.js');document.getElementsByTagName('body')[0].appendChild(s);window.setTimeout(function(){$("a").box2d({'y-velocity':5});},500);})();




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: