Generates an algorithmic 3D OBJ file with ThreeJS and Node.js.
# print to stdout
node generate-mesh.js > test.obj
# write to file
node generate-mesh.js test.obj| var colorPalette = [“#fdfdfd”, “#1d1d1d”, “#ebce2b”, “#702c8c”, “#db6917”, “#96cde6”, “#ba1c30”, “#c0bd7f”, “#7f7e80”, “#5fa641”, “#d485b2”, “#4277b6”, “#df8461”, “#463397”, “#e1a11a”, “#91218c”, “#e8e948”, “#7e1510”, “#92ae31”, “#6f340d”, “#d32b1e”, “#2b3514”]; |
| // by dave whyte :) @beesandbombs | |
| int[][] result; | |
| float t, c; | |
| float ease(float p) { | |
| return 3*p*p - 2*p*p*p; | |
| } | |
| float ease(float p, float g) { |
| int[][] result; | |
| float t, c; | |
| float ease(float p) { | |
| return 3*p*p - 2*p*p*p; | |
| } | |
| float ease(float p, float g) { | |
| if (p < 0.5) | |
| return 0.5 * pow(2*p, g); |
| ArrayList<Rect> rects; | |
| float mx, my, mm, time; | |
| void setup() { | |
| size(720, 720, P2D); | |
| generate(); | |
| } | |
| void draw() { |
| // Plane folding | |
| // Copyright by tsulej 2014, edited by Etienne Jacob (necessary-disorder.tumblr.com) | |
| // click mouse to change drawing | |
| float step ; | |
| Folds f; | |
| int[] folds = new int[8]; | |
| ///////////////////////////////////////////////////// | |
| // CHANGE THIS TO CHANGE THE 2D TRANSFORMATION USED ! |
| const sketcher = require('canvas-sketch-tool'); // not yet public | |
| const seedRandom = require('seed-random'); | |
| const settings = { | |
| // Output resolution, we use a high value for print artwork | |
| pixelsPerInch: 300, | |
| // US Letter size 8.5x11 inches | |
| dimensions: [ 8.5, 11 ], | |
| // all our dimensions and rendering units will use inches | |
| units: 'in' |