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.
declare module 3DMol { | |
} | |
declare module '3dmol' { | |
export = 3DMol; | |
} |
declare module 3DMol { | |
} | |
declare module '3dmol' { | |
export = 3DMol; | |
} |
declare module 3DMol { | |
} | |
declare module '3dmol' { | |
export = 3DMol; | |
} |
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) |
export function exampleSpec() { | |
describe("...", function() { | |
it("should ...", function() { | |
expect(true).toBeTruthy() | |
}) | |
}) | |
} |
export default function() { | |
describe("...", function() { | |
it("should ...", function() { | |
expect(true).toBeTruthy() | |
}) | |
}) | |
} |
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() | |
}) | |
}) | |
} |
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; |