method is a prototype of Object
This file contains hidden or 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
// Array shuffle for MooTools | |
Array.implement({ | |
shuffle: function(){ | |
var i = this.length; | |
if (i == 0) return; | |
while (--i){ | |
var j = Math.floor(Math.random() * ( i + 1 )); | |
var tempi = this[i]; |
This file contains hidden or 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
/* | |
Unmatrix 2d | |
- a crude implementation of the slightly bugged pseudo code in http://www.w3.org/TR/css3-2d-transforms/#matrix-decomposition | |
*/"use strict" | |
// returns the length of the passed vector | |
var length = function(a){ | |
return Math.sqrt(a[0] * a[0] + a[1] * a[1]) | |
} |
This file contains hidden or 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
an old test on 3d projections of vertices onto the screen |
a cubic-bezier solver.
This file contains hidden or 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
another requirebin equation-designer early demo |
This file contains hidden or 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
"use strict"; | |
var fragmentText = function(ctx, lines, index, maxWidth) { | |
var line = lines[index]; | |
var nextLine; | |
var tooLong = true; | |
while (tooLong) { | |
var width = ctx.measureText(line.join(" ")).width; |
This file contains hidden or 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
"use strict"; | |
var rgb = require("rgb"); | |
var lerp = function(from, to, delta) { | |
return (to - from) * delta + from; | |
}; | |
var convertToPct = function(c, i) { | |
if (i === 3) return c; |
This file contains hidden or 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 Scene = require('three.cjs/scenes/Scene').Scene; | |
var PerspectiveCamera = require('three.cjs/cameras/PerspectiveCamera').PerspectiveCamera; | |
var BoxGeometry = require('three.cjs/extras/geometries/BoxGeometry').BoxGeometry; | |
var MeshBasicMaterial = require('three.cjs/materials/MeshBasicMaterial').MeshBasicMaterial; | |
var Mesh = require('three.cjs/objects/Mesh').Mesh; | |
var WebGLRenderer = require('three.cjs/renderers/WebGLRenderer').WebGLRenderer; | |
var scene, camera, renderer; | |
var geometry, material, mesh; |
This file contains hidden or 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
an early version of equation-designer, demoed on requirebin |
OlderNewer