Home Reference Source

References

dom

summary
public

C Slider

Class used to handle the sliders and their labels.

public

C Button

Class used to handle a button (<button>).

private

Parent class for handling DOM elements.

public

C Input

Class used to handle an Input (<input>).

public

C Option

Class used to handle a checkbox (<input type="checkbox">).

public

Class used to handle a set of multiple radio buttons (<input type="radio">).

public

C Select

Class used to handle select elements (<select>).

elements

summary
private

C Axis

The Axis class is responsible for drawing the axis onto the canvas and setting the new origin used for the canvas.

public

C Ball

The Ball class is a particle class used to draw round particles with the advantage that they can be labeled and displayed with a gradient, giving a more realistic feel to the particle.

private

C Graph

A Graph Box allow for Plot elements to be displayed in the box using a different scale to the main axis in the world.

private

C Label

A Label Box allows for a pair of label and value to be displayed.

private

C Text

A Text Box allows for text to be displayed on a Box element.

public

C Box

A Box allows for a window like object to be displayed in the world.

public

The DataCursor class is used to add data cursors to plots.

public

The Picture class is used to draw images on the screen.

public

C Plot

The Plot class can be used to draw a line plot or a histogram on an axis.

public

C Shape

The Shape class is used to draw shapes manually onto the world.

public

C Vector

The Vector class is used for handling vector quantities and for drawing them onto the world.

utils

summary
private

C Font

Stores the font settings currently used by a World Element.

private

Enables an element to be prerendered in a hidden canvas.

public

C Scale

Stores the scale properties in a particular axis (-x or -y).

public

F calcStepSize(value: number, stepAmount: number): number

Finds the best fitting scale for a given range.

public

F clamp(val: number, min: number, max: number): number

Constrain a value within a range of values.

public

F cos(val: number, type: number): number

Cosine function that can accept angles in radians or degrees.

public

F distSquared(x0: number, y0: number, x1: number, y1: number): number

Given a set of two points the squared distance is calculated.

public

F fixId(id: string): string

Makes sure that a HTML id allways has a # at the beginning.

public

F formatValue(val: number | string, units: string, decPlaces: number, fixPlaces: boolean): string

Format a number to have a certain number of decimal places and/or fixed places and add a unit label.

public

Generate a random number following a gaussian distribuition.

public

Obtains the pixel ratio of the device.

public

F isCoordInside(x: number, y: number, bx: number, by: number, bw: number, bh: number): boolean

Determines if a point is inside of a box.

public

Test if an object is a function.

public

Test if an object is an object.

public

Test if an object is a string.

public

F loadOptions(obj: object, args: object)

Assign the matching properties from the args object to the obj object.

public

F rad(angle: number, type: number): number

Given an angle makes sure that it is in radians.

public

F rgbToRgba(color: string, alpha: number): string

Adds an alpha channel to an rgb color.

public

F round(value: number, precision: number): number

Round a number to a given amount of decimal places.

public

F sin(val: number, type: number): number

Sine function that can accept angles in radians or degrees.

public

V ANGLE_STYLE: {"DEG": number, "RAD": number}

Defines if the angle used is in radians or degrees.

public

Avogadro constant.

public

Boltzmann constant.

public

V BOX_COLORS: {"BLUE": *, "GREEN": *, "RED": *, "YELLOW": *, "ORANGE": *, "PURPLE": *, "GRAY": *}

Defines the default colors used for box displays.

public

Conversion factor from cubic centimeters to cubic meters.

public

Conversion factor from centimeters to meters.

public

V COLORS: {"RED": string, "BLUE": string, "GREEN": string, "YELLOW": string, "PURPLE": string, "BROWN": string, "LIGHT_GREEN": string, "GRAY": string, "LIGHT_GRAY": string, "WHITE": string, "BLACK": string, "COMPONENT": string}

Defines the default colors used for simulations.

public

Cosine of 30°.

public

Cosine of 60°.

public

V CURSOR: {"DEFAULT": string, "POINTER": string, "CROSS": string, "MOVE": string, "TEXT": string}

Types of cursors that an object can have when hovered or dragged.

public

Conversion factor from degrees to radians.

public

Used when the mouse isn't dragging an object.

public

V E0: number

Vacuum permittivity constant.

public

PI / 5 constant.

public

Defines the default font used for all simulations.

public

Defines teh valid font alignments.

public

Defines the valid font baselines.

public

Defines the default font color for all simulaions.

public

s Defines the default font size for all simulations.

public

PI / 4 constant.

public

Graviy constant.

public

PI / 2 constant.

public

V K: number

Coulomb's constant.

public

Log 10 constant.

public

V MOVE_STYLE: {"BY_PX": string, "BY_UNITS": string}

Defines how the coordinates of an object will be changed when the object is dragged around.

public

Conversion factor from meters to centimeters.

public

Used when the mouse isn't over an object.

public

Conversion factor from pascals to atmospheres.

public

V PI: number

PI constant.

public

Conversion factor from radians to degrees.

public

V SHAPE_STYLE: {"NONE": *, "ACCOMULATIVE": number}

Defines how a shape is drawn with the methods Shape.moveTo and Shape.lineTo.

public

Sine of 30°.

public

Sine of 60°.

public

PI / 6 constant.

public

V SYMBOL: {"BLANK": string, "THETA": string, "INF": string, "MICRO": string, "OHM": string, "LETTERS": string}

Useful symbols for simulations.

public

PI / 3 constant.

public

2 * PI constant.

world

summary
public

C World

The World class handles the canvas and the drawing of elements.

private

Parent class for all elements added to the world.

Directories