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
function createNoiseTexture(width, height) { | |
var canvas = document.createElement("canvas"); | |
canvas.width = width; | |
canvas.height = height; | |
var context = canvas.getContext('2d'); | |
var image = context.createImageData( width, height ); | |
var imageData = image.data; |
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
// by https://github.com/zz85 | |
// http://en.wikipedia.org/wiki/Werckmeister_temperament | |
// Werckmeister I (III): "correct temperament" based on 1/4 comma divisions | |
var werckmeister = [ | |
1, // c | |
256/243, // c# | |
64 / 81 * Math.pow(2, 1/2), // d | |
32/27, // d# |
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
/* | |
* @author @blurspline https://github.com/zz85 | |
* Similar to a turntable or a hovering camera? | |
*/ | |
THREE.OrbitControls = function( camera, target, distance, height, time ) { | |
var rotationUnits = time * 1000; | |
var startTime; | |
this.start = function() { |
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
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | |
Version 2, December 2004 | |
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE> | |
Everyone is permitted to copy and distribute verbatim or modified | |
copies of this license document, and changing it is allowed as long | |
as the name is changed. | |
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
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
// Produces 50 snow particles every second | |
particleProducer = new SPARKS.SteadyCounter( 50 ); | |
// Create the sparks.js Emitter | |
sparksEmitter = new SPARKS.Emitter( particleProducer ); | |
// This defines that snow should emit from an plane like area | |
// instead of a point, giving the feel of snow falling from the sky | |
var zone = new SPARKS.ParallelogramZone( | |
new THREE.Vector3(-1400,800,-1000), |
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
body { | |
background-color: #333; | |
} | |
#rslider { | |
position:absolute; | |
left:50%; | |
width:100px; | |
height:18px; | |
border-radius:0 6px 6px 0; |
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
// fraction / rational number class | |
// @author zz85 | |
Vex.Flow.Fraction = function(numerator, denominator) { | |
this.set(numerator, denominator); | |
}; | |
Vex.Flow.Fraction.prototype.constructor = Vex.Flow.Fraction; | |
Vex.Flow.Fraction.prototype.set = function(numerator, denominator) { | |
this.numerator = numerator === undefined ? 1 : numerator; |
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
/* | |
* signed distance fields generation in javascript | |
* uses the 8SSEDT algorithm for linear-time processing | |
* | |
* done in conjustion with the signed distance fields text experiment | |
* | |
* references: | |
* http://www.lems.brown.edu/vision/people/leymarie/Refs/CompVision/DT/DTpaper.pdf | |
* http://www.codersnotes.com/notes/signed-distance-fields | |
* http://guides4it.com/Mobile/iphone-3d-programming---crisper-text-with-distance-fields-(part-1)---generating-distance-fields-with-python.aspx |
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
// generates a "event channel" | |
var onFire = new SimpleEvent(); | |
// adds an listener | |
onFire.add(function aListener(hello, world){ | |
alert(hello + ' ' + world); | |
}) | |
// notifies listeners | |
onFire.notify('Bye', 'Universe'); |
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
// Converts a number to english words | |
// Based on https://gist.github.com/bcamarda/3001102 | |
// Refactored and made some changes to support numbers to a hundred (US) trillion | |
// github.com/zz85 | |
var inWords = (function() { | |
var numberHash = { | |
0:"", 1:"one", 2:"two", 3:"three", 4: "four", 5: "five", 6: "six", 7: "seven", 8: "eight", 9: "nine", 10: "ten", |