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);
/** | |
* Add ipad IOS7 Classes | |
* Allows us to temporariliy try to fix the slight scroll 100% hack. | |
* http://stackoverflow.com/questions/19012135/ios-7-ipad-safari-landscape-innerheight-outerheight-layout-issue | |
*/ | |
if (navigator.userAgent.match(/iPad;.*CPU.*OS 7_\d/i)) { | |
$('html').addClass('ipad ios7'); | |
} | |
/** |
/** | |
* Add a delay at the end of the timeline (or at any label) | |
* @param {number} delay Seconds to wait | |
* @param {string} position Label name where to start the delay | |
* | |
* Usage: tl.addDelay(4); //easy! | |
*/ | |
TimelineLite.prototype.addDelay = function (delay, position) { | |
var delayAttr; | |
if(typeof delay === 'undefined' || isNaN(delay)){ |
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);
var Car = Backbone.Model.extend({ | |
defaults:{ | |
engine: 'gasoline', | |
hp: 0, | |
doors: 4, | |
color: 'generic' | |
}, | |
engine: function(){ | |
return 'Wroomm'; | |
} |
// * iOS zooms on form element focus. This script prevents that behavior. | |
// * <meta name="viewport" content="width=device-width,initial-scale=1"> | |
// If you dynamically add a maximum-scale where no default exists, | |
// the value persists on the page even after removed from viewport.content. | |
// So if no maximum-scale is set, adds maximum-scale=10 on blur. | |
// If maximum-scale is set, reuses that original value. | |
// * <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=2.0,maximum-scale=1.0"> | |
// second maximum-scale declaration will take precedence. | |
// * Will respect original maximum-scale, if set. | |
// * Works with int or float scale values. |
/* | |
* This work is free. You can redistribute it and/or modify it under the | |
* terms of the Do What The Fuck You Want To Public License, Version 2, | |
* as published by Sam Hocevar. See the COPYING file for more details. | |
*/ | |
/* | |
* Easing Functions - inspired from http://gizma.com/easing/ | |
* only considering the t value for the range [0, 1] => [0, 1] | |
*/ | |
EasingFunctions = { |
/*! ****************************** | |
Handlebars helpers | |
*******************************/ | |
// debug helper | |
// usage: {{debug}} or {{debug someValue}} | |
// from: @commondream (http://thinkvitamin.com/code/handlebars-js-part-3-tips-and-tricks/) | |
Handlebars.registerHelper("debug", function(optionalValue) { | |
console.log("Current Context"); | |
console.log("===================="); |