Skip to content

Instantly share code, notes, and snippets.

View squarefeet's full-sized avatar

Luke Moody squarefeet

View GitHub Profile
@squarefeet
squarefeet / valueOverLifetimeTest.html
Created October 27, 2015 12:16
SPE valueOverLifetime Test
<!DOCTYPE html>
<meta charset="UTF-8">
<html>
<head>
<title>Demo</title>
<script language = 'javascript' src = "../examples/js/THREE-r72.js" type = 'text/javascript'></script>
<script type="text/javascript" src="../src/SPE.js"></script>
<script type="text/javascript" src="../src/helpers/SPE.TypedArrayHelper.js"></script>
<script type="text/javascript" src="../src/helpers/SPE.ShaderAttribute.js"></script>
<script type="text/javascript" src="../src/shaders/SPE.shaderChunks.js"></script>
@squarefeet
squarefeet / one.js
Created October 16, 2015 23:18
SPE valueOverLifetimeLength bug
particleTexture = this.params.map ? ENGINE.loadCachedTexture('/img/particles/' + this.params.map + '.png') : null;
particleArray = ENGINE.mc.get('particleArray');
this.particleGroup = new SPE.Group({
texture: particleTexture,
fog: true
});
@squarefeet
squarefeet / Broken WebAudio LFO
Created February 10, 2013 01:48
WebAudio LFOs - Why you no worky!?
<body>
<script type="text/javascript">
var context = new webkitAudioContext();
destination = context.destination,
osc = context.createOscillator(),
lfo = context.createOscillator(),
lfoGain = context.createGainNode(),
filter = context.createBiquadFilter();
osc.type = osc.TRIANGLE;
@squarefeet
squarefeet / nodePIDBug
Created June 20, 2012 14:38
Node PID bug
var exec = require('child_process').exec,
child = exec('node [PATH-TO-YOUR-KEEP-ALIVE-NODE-FILE]');
console.log('child pid: ' + child.pid);
exec('ps aux | grep node', function(err, stdout) {
console.log(stdout);
});
@squarefeet
squarefeet / SineArcJumping.js
Created February 28, 2012 23:46
Sine arc jumping. This chunk of code is called on each update tick, and with each tick, the position vector is moved along the sine curve...
// If jump key is pressed, toggle the isJumping property, reset the
// jumpSinPos to zero, and set the y position.
if(keyHandler.isKeyPressed('space') && !this.isJumping) {
this.vel.y = 0;
this.jumpSinPos = 0;
this.isJumping = true;
this.jumpStartPos = this.pos.y;
}
// If we're jumping, move along the sine wave.
// Try putting this in your touchstart...
// Where 'e' is your event.
var that = this,
point = e.changedTouches[0],
target;
target = document.elementFromPoint(point.pageX, point.pageY);
if(target.nodeType === 3) target = target.parentNode;