Skip to content

Instantly share code, notes, and snippets.

@mathdoodle
mathdoodle / $3DMol.d.ts
Last active July 7, 2020 21:01
3Dmol Helix
declare module 3DMol {
}
declare module '3dmol' {
export = 3DMol;
}
@mathdoodle
mathdoodle / $3DMol.d.ts
Last active August 10, 2016 16:10
3Dmol download
declare module 3DMol {
}
declare module '3dmol' {
export = 3DMol;
}
@mathdoodle
mathdoodle / $3DMol.d.ts
Last active August 5, 2016 22:55
Using External JavaScript
declare module 3DMol {
}
declare module '3dmol' {
export = 3DMol;
}
@mathdoodle
mathdoodle / ChargedParticle.ts
Last active July 8, 2020 04:31
Electric Dipole
import { Color } from 'davinci-eight'
import { Geometric3 as G3 } from 'davinci-newton'
const m = G3.meter
const kg = G3.kilogram
const s = G3.second
const C = G3.coulomb
const N = kg * m / (s * s)
const ε0 = 8.85e-12 * C * C / (N * m * m)
@mathdoodle
mathdoodle / Example.spec.ts
Last active February 19, 2018 01:50
EIGHT Primitive
export function exampleSpec() {
describe("...", function() {
it("should ...", function() {
expect(true).toBeTruthy()
})
})
}
@mathdoodle
mathdoodle / Example.spec.ts
Last active February 19, 2018 01:31
EIGHT VertexBuffer
export default function() {
describe("...", function() {
it("should ...", function() {
expect(true).toBeTruthy()
})
})
}
@mathdoodle
mathdoodle / Igloo.ts
Last active January 15, 2018 02:28
WebGL using Igloo
import { DataType, Usage } from 'davinci-eight'
export default class Igloo {
public gl: WebGLRenderingContext;
public canvas: HTMLCanvasElement;
private defaultFramebuffer: Framebuffer;
constructor(gl: HTMLCanvasElement | WebGLRenderingContext, options?: WebGLContextAttributes) {
if (gl instanceof HTMLCanvasElement) {
this.canvas = <HTMLCanvasElement> gl;
this.gl = Igloo.getContext(gl, options);
export default function() {
describe("...", function() {
it("should ...", function() {
expect(true).toBeTruthy()
})
})
}
@mathdoodle
mathdoodle / Gesso.ts
Last active July 21, 2016 19:46
Gesso
export default class Gesso {
public context: CanvasRenderingContext2D;
private width: number;
private height: number;
private running = false;
public clearFrame = true;
public fps = 60;
public backgroundColor: any;
private togglePlayClickHandler: EventListener;
private togglePlayOnSpaceBar: EventListener;
@mathdoodle
mathdoodle / README.md
Last active February 18, 2018 22:57
Introduction to the HTML5 Canvas

Introduction to the HTML5 Canvas

Overview

The HTML Canvas can be used to draw graphics using a scripting language (we will use TypeScript).

In this lesson we will describe the canvas and start using commands to draw on the canvas.

Orientation