Usage:
var player = new Rect(0, 0, 100, 100);
var target = new Rect(50, 50, 100, 100);
player.is = new AABB(player);
player.is.inside(target);
player.is.colliding(target);
player.is.containing(target);| /* bling.js */ | |
| window.$ = document.querySelector.bind(document); | |
| window.$$ = document.querySelectorAll.bind(document); | |
| Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); }; | |
| NodeList.prototype.__proto__ = Array.prototype; | |
| NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); }; |
| { | |
| "name": "my-app", | |
| "version": "1.0.0", | |
| "description": "My test app", | |
| "main": "src/js/index.js", | |
| "scripts": { | |
| "jshint:dist": "jshint src/js/*.js", | |
| "jshint": "npm run jshint:dist", | |
| "jscs": "jscs src/*.js", | |
| "browserify": "browserify -s Validating -o ./dist/js/build.js ./lib/index.js", |
| <script type="text/javascript"> | |
| (function () { | |
| "use strict"; | |
| // once cached, the css file is stored on the client forever unless | |
| // the URL below is changed. Any change will invalidate the cache | |
| var css_href = './index_files/web-fonts.css'; | |
| // a simple event handler wrapper | |
| function on(el, ev, callback) { | |
| if (el.addEventListener) { | |
| el.addEventListener(ev, callback, false); |
| // document.ready | |
| document.addEventListener("DOMContentLoaded", function() { | |
| // your code | |
| }, false); | |
| // select div | |
| var element = document.querySelector("div"); |
Usage:
var player = new Rect(0, 0, 100, 100);
var target = new Rect(50, 50, 100, 100);
player.is = new AABB(player);
player.is.inside(target);
player.is.colliding(target);
player.is.containing(target);| /*css reset*/ | |
| html,body {position:relative;margin:0;padding:0;min-height:100%;width:100%;height:100%;} | |
| div,p,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td, figure {margin:0;padding:0;} | |
| ol,ul {list-style:none;} | |
| li {list-style-type: none;} | |
| * { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; } | |
| html, body { | |
| font-family: Helvetica; | |
| height: 100%; /*important for equal height columns*/ |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Border radius on image · CodePen</title> | |
| <!-- | |
| Copyright (c) 2012 Chris Coyier, http://codepen.io/chriscoyier | |
| Permission is hereby granted, free of charge, to any person obtaining |
| <!DOCTYPE HTML> | |
| <html> | |
| <!-- | |
| @author Ben Poole, http://benpoole.com | |
| Example HTML5 code for playing with the local WebKit (Opera too?) SQL database. | |
| @see http://benpoole.com/weblog/201106222227 | |
| --> | |
| <head> | |
| <meta charset="UTF-8" /> | |
| <title>Winkles Of The World Unite!</title> |