Skip to content

Instantly share code, notes, and snippets.


nicolas barradeau nicoptere

View GitHub Profile
nicoptere / Instances.js
Last active Feb 24, 2021
create InstancedGeometries from GLTF
View Instances.js
import {
} from "three";
import { GLTFLoader } from "three/examples/jsm/loaders/GLTFLoader.js";
View moebius 3D GLSL (for three.js)
original code
need to declare the following:
uniform vec3 origin;
uniform float p;
uniform float q;
uniform float t;
nicoptere / remove small paths in illustrator
Last active May 30, 2018
this will remove illustrator paths under a given length ( to clean up smaller paths basically )
View remove small paths in illustrator
#target illustrator
var document = app.activeDocument;
var maxLength = prompt ("maximum length of a path", 10, "destroy them with lasers!");
for (i=0 ; i< document.pathItems.length; i++)
var ipath = document.pathItems[i]
if( ipath.hidden == true )continue;
var l = 0;
for( var j = 0; j < ipath.pathPoints.length - 1; j++ ){
var p0 = ipath.pathPoints[j].anchor;
View affine transform
// and
function adj(m) { // Compute the adjugate of m
return [
m[4]*m[8]-m[5]*m[7], m[2]*m[7]-m[1]*m[8], m[1]*m[5]-m[2]*m[4],
m[5]*m[6]-m[3]*m[8], m[0]*m[8]-m[2]*m[6], m[2]*m[3]-m[0]*m[5],
m[3]*m[7]-m[4]*m[6], m[1]*m[6]-m[0]*m[7], m[0]*m[4]-m[1]*m[3]
nicoptere / toOBJ
Created Apr 14, 2017
converts a THREE.geometry to OBJ
View toOBJ
var str = "# object mesh \n";
var vs = g.getAttribute("position").array;
var ind = g.getIndex().array;
var precision = 6;
for( var i = 0 ; i < vs.length; i+=3 ){
View Object3D.js
* Created by nico on 19/02/14.
var Object3d = function( node, position, rotation )
this.node = node;
this.parent = null;
View gist:abe6cabf590158c885ecce0768cee41c
<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
html, body{
overflow: hidden;
nicoptere / mixer
Created Jun 15, 2016
texture mixer
View mixer
<!DOCTYPE html>
<head lang="en">
<meta charset="UTF-8">
head, body{
overflow: hidden;
nicoptere / convert.jsx
Last active Mar 30, 2020
converts after effects layers' keyframes to JSON and saves file on hard drive.
View convert.jsx
//JSON object
"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(t){return 10>t?"0"+t:t}function this_value(){return this.valueOf()}function quote(t){return rx_escapable.lastIndex=0,rx_escapable.test(t)?'"'+t.replace(rx_escapable,function(t){var e=meta[t];return"string"==typeof e?e:"\\u"+("0000"+t.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+t+'"'}function str(t,e){var r,n,o,u,f,a=gap,i=e[t];switch(i&&"object"==typeof i&&"function"==typeof i.toJSON&&(i=i.toJSON(t)),"function"==typeof rep&&(,t,i)),typeof i){case"string":return quote(i);case"number":return isFinite(i)?i+"":"null";case"boolean":case"null":return i+"";case"object":if(!i)return"null";if(gap+=indent,f=[],"[object Array]"===Object.prototype.toString.apply(i)){for(u=i.length,r=0;u>r;r+=1)f[r]=str(r,i)||"null";return o=0===f.length?"[]":gap?"[\n"+gap+f.join(",\n"+gap)+"\n"+a+"]":"["+f.join(",")+"]",gap=a,o}if(rep&&"object"==typeof rep)for(u=rep.length,r=0;u>r;r+=1)"string"==typeof rep[r]&&(n=rep[r],o=str(n,i),o&&f.push
nicoptere / bresenham.js
Created Oct 20, 2015
bresenham circle / disc
View bresenham.js
function bresenhamCircle( cx,cy,r )
var x = 0,y = r,p;
ctx.fillRect( cx+x,cy-y, 1, 1 );