Skip to content

Instantly share code, notes, and snippets.

THREE.Particle = function (material) {
this.constructor.call(this);
this.size = 1,
this.material = material;
}
THREE.Particle.prototype = new THREE.Object3D();
package aze.motion.easing
{
final public class Bounce
{
static public function easeIn(k:Number):Number
{
return 1 - Bounce.easeOut(1 - k);
}
static public function easeOut(k:Number):Number
{
// http://mrl.nyu.edu/~perlin/noise/
var ImprovedNoise = function () {
var p = [151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10,
23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87,
174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211,
133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208,
89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5,
202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119,
// Ported from http://blog.inspirit.ru/wp-content/uploads/qsort/Main.as
function flashSort( array ) {
var a = array, n = array.length;
var i = 0, j = 0, k = 0, t, hold, flash;
var m = ~~( n * 0.125 );
var l = [], anmin = a[ 0 ], nmax = 0, nmove = 0;
while ( ++i < n ) {
@mrdoob
mrdoob / gist:647576
Created October 26, 2010 19:13
Three.js - Material system
// Approach 1 (links)
// Once the renderer finds a *MeshFaceMaterial*, it'll process the face material array
var common_material = [ new BitmapUVMaterial( bitmap ) ];
mesh.material = [ new MeshFaceMaterial(), new MeshColorStrokeMaterial( 0xff0000 ) ];
mesh.faces[ 0 ].material = common_material;
mesh.faces[ 1 ].material = common_material;
// Approach 2 (indices)
// Approach 1 (links)
// Once the renderer finds a *MeshFaceMaterial*, it'll process the face material array
var head_material = [ new MeshBitmapUVMappingMaterial( head_bitmap ) ];
var torso_material = [ new MeshBitmapUVMappingMaterial( torso_bitmap ) ]
mesh.material = [ new MeshFaceMaterial(), new MeshColorStrokeMaterial( 0xff0000 ) ];
mesh.faces[ 0 ].material = head_material;
mesh.faces[ 1 ].material = head_material;
@mrdoob
mrdoob / gist:665235
Created November 6, 2010 06:29
Simple encode/decode for Array of Numbers (6-bit)
function decode( string ) {
var output = [];
string.split('').forEach( function ( v ) { output.push( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".indexOf( v ) ); } );
return output;
}
function encode( array ) {
@mrdoob
mrdoob / gist:718743
Last active July 23, 2023 06:53
Simplest HTML5 drawing tool
<html>
<style>
body {
margin: 0;
padding 0;
}
</style>
<body>
<script>
@mrdoob
mrdoob / gist:721717
Created November 30, 2010 14:02
Matrix4New.js
THREE.Matrix4 = function () {
var _x = new THREE.Vector3(), _y = new THREE.Vector3(), _z = new THREE.Vector3(),
_array = new Float32Array( [ 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 ] );
this.array = _array;
this.copy = function ( m ) {
_array[ 0 ] = m.array[ 0 ]; _array[ 1 ] = m.array[ 1 ]; _array[ 2 ] = m.array[ 2 ]; _array[ 3 ] = m.array[ 3 ];
'new' : {
uniforms: {},
vertex_shader: [
"void main() {",
"gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );",