various components offering game-shell's functionality as standalone modules.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var clone = require('clone') | |
var uniq = require('uniq') | |
var raf = require('raf') | |
var xhr = require('xhr') | |
var s = 200 | |
var t = 250 | |
xhr({ | |
uri: 'http://www.corsproxy.com/bl.ocks.org/mbostock/raw/4090846/world-110m.json' | |
, json: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
float sSphere(vec3 p, float time) { | |
return length(p) - 1.0 - noise(p, time) * 0.05; | |
} | |
vec3 calcNormal(vec3 p, float time) { | |
const float eps = 0.002; | |
const vec2 offset = vec2(1.0, -1.0); | |
return normalize( | |
offset.xyy * sSphere(p + offset.xyy * eps, time) + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Bookmarklet Code | |
$('head style').each(function() {if ($(this).attr('id') && $(this).attr('id').indexOf('less:') > -1) {var lesscode = $(document.createElement('div'));lesscode.html($(this).text().replace(/\/\*.*?\*\//g,' ').replace(/[ ]{2,100}/g,' '));lesscode.css('padding','20px').css('font-size','10px').css('background-color','#ddd').css('font-family','monospace');$('body:last-child').append(lesscode);} }); | |
//Legible version | |
$('head style').each(function() { | |
if ($(this).attr('id') && $(this).attr('id').indexOf('less:') > -1) { | |
var lesscode = $(document.createElement('div')); | |
//Clean up a lot of comments and white space... | |
lesscode.html($(this).text(). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Boid { | |
PVector pos; | |
PVector spd; | |
PVector acc; | |
Boid() { this(random(0, width), random(0, height)); } | |
Boid(float x, float y) { this(x, y, random(0,1), random(0,1)); } | |
Boid(float x, float y, float xspd, float yspd) { | |
pos = new PVector(x, y); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Thanks to [liangzan's gist](https://gist.github.com/807712) | |
rmdirSyncForce = function(path) { | |
var files, file, fileStats, i, filesLength; | |
if (path[path.length - 1] !== '/') { | |
path = path + '/'; | |
} | |
files = fs.readdirSync(path); | |
filesLength = files.length; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var perlin = require('perlin').noise.perlin3 | |
var fill = require('ndarray-fill') | |
var zeros = require('zeros') | |
var scale = 0.075 | |
var threshold = 0.125 | |
// Untested in 3D, but "theoretically" this should | |
// work. Using the equivalent 2d getter with the | |
// continuous-box2d demo works well. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load up the `raf` module. | |
var raf = require('raf') | |
// Create the canvas, and add it | |
// to the page. | |
var canvas = document.createElement('canvas') | |
var ctx = canvas.getContext('2d') | |
var width = 500 | |
var height = 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Load up the `raf` module. | |
var raf = require('raf') | |
var controls = require('kb-controls-iframed')({ | |
'W': 'up', | |
'A': 'left', | |
'S': 'down', | |
'D': 'right', | |
'<up>': 'up', | |
'<left>': 'left', | |
'<down>': 'down', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var observer = require('continuous-observer') | |
var cave = require('cave-automata-2d') | |
var fill = require('ndarray-fill') | |
var zero = require('zeros') | |
var raf = require('raf') | |
var canvas = document.createElement('canvas') | |
var ctx = canvas.getContext('2d') | |
// Set up the controls, so that we can control |
OlderNewer