Skip to content

Instantly share code, notes, and snippets.

View zz85's full-sized avatar

Joshua Koo zz85

View GitHub Profile
@zz85
zz85 / ParametricGeometry2.js
Last active August 29, 2015 13:56
Exploring ParametricGeometry2
/**
* @author zz85 / https://github.com/zz85
* Parametric Surfaces Geometry
* based on the brilliant article by @prideout http://prideout.net/blog/?p=44
*
* new THREE.ParametricGeometry( parametricFunction, uSegments, ySegements );
*
*/
THREE.ParametricGeometry2 = function ( func, slices, stacks ) {
@zz85
zz85 / LoopSubdivisionModifier.js
Created February 18, 2014 04:32
Loop Scheme Subdivision Modifier for Three.js (Draft 1)
/*
* @author zz85 / http://twitter.com/blurspline / http://www.lab4games.net/zz85/blog
*
* Subdivision Geometry Modifier
* using Loop Subdivision Scheme
*
* References:
* http://graphics.stanford.edu/~mdfisher/subdivision.html
* http://www.holmes3d.net/graphics/subdivision/
* http://www.cs.rutgers.edu/~decarlo/readings/subdiv-sg00c.pdf
@zz85
zz85 / ShaderUtils.js
Last active July 26, 2022 20:02
AutoGen Three.js Shader Uniforms
// https://github.com/mrdoob/three.js/issues/4145
// based on https://github.com/unconed/ShaderGraph.js/blob/master/src/Snippet.js
var typeMaps = {
'float': 'f',
'vec2': 'v2',
'vec3': 'v3',
'vec4': 'v4',
'mat3': 'm3',
'mat4': 'm4',
@zz85
zz85 / messages.js
Created September 7, 2013 23:48
Offline Rendering of @kig's Message presentation app using SlimerJS
/*
PDF Generator for @ilmarihei's Awesome "Messsage" Presentation App!
Usage:
./slimerjs messages.js
You may also need to
- get http://slimerjs.org/
- edit the config variables
- run `convert slides/*.jpg presentation.pdf`
@zz85
zz85 / gist:5522800
Last active December 17, 2015 00:39
JS1K 2013 "Spring" Finalists
@zz85
zz85 / in_words.js
Last active December 14, 2015 08:29 — forked from bcamarda/in_words.js
Now support up to 999 trillion. (fixed a flooring error with ~~ and removed unneeded console.log)
// 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",
@zz85
zz85 / SimpleEventExample.js
Created June 22, 2012 21:01
Example for SimpleEvent component from http://jsdo.it/zz85/75cq
// 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');
@zz85
zz85 / signed_distance_fields.js
Created April 29, 2012 12:44
Javascript Signed Distance Fields Generation
/*
* 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
@zz85
zz85 / fraction.js
Created April 12, 2012 18:55
Fractional / Rational Number Class for performing fractional calculations
// 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;
@zz85
zz85 / dabblet.css
Created March 2, 2012 12:47
Playing with the slider
body {
background-color: #333;
}
#rslider {
position:absolute;
left:50%;
width:100px;
height:18px;
border-radius:0 6px 6px 0;