Skip to content

Instantly share code, notes, and snippets.

@amkraft
amkraft / index.html
Created April 17, 2020 00:34
threejs-first
<!DOCTYPE html>
<head>
<title>three js</title>
<style>
/*css goes here*/
html, body {
margin: 0;
overflow: hidden; /*nice to not use this*/
}
</style>
var degtorad = Math.PI / 180;
function makeRotationMatrix(alpha, beta, gamma) {
var _x = beta ? beta * degtorad : 0;
var _y = gamma ? gamma * degtorad : 0;
var _z = alpha ? alpha * degtorad : 0;
var cX = Math.cos( _x );
var cY = Math.cos( _y );
@amkraft
amkraft / index.html
Created April 17, 2020 01:02
file from today
<!-- 2 terminal windows
one running ngrok
one running localhost server
php -S localhost:8000 -->
<!DOCTYPE html>
<head>
<title>three js</title>
<style>
@amkraft
amkraft / algebra.ts
Last active February 15, 2021 16:51
(a,b,c) ring algebra
class Ring {
a: number;
b: number;
c: number;
constructor(a: number, b: number, c:number) {
this.a = a;
this.b = b;
this.c = c;
}
};
@amkraft
amkraft / opxToSVG.js
Created December 20, 2022 08:17
OPX to SVG conversion. OPX is an origami file format outputted by ORIPA by Jun Mitani
const svgNS = "http://www.w3.org/2000/svg";
/**
* @description Not currently used.
* There are top level nodes which contain metadata,
* I'm not sure how many there are, but at least I've seen:
* memo, originalAuthorName, title
*/
const getMetadataValue = (oripa, metadataKey) => {
const parentNode = Array.from(oripa.children)
.filter(el => el.attributes.length && Array.from(el.attributes)