Skip to content

Latest commit

 

History

History
224 lines (134 loc) · 3.4 KB

rangeFunctions.md

File metadata and controls

224 lines (134 loc) · 3.4 KB

solid-knobs / rangeFunctions

Namespace: rangeFunctions

Table of contents

Functions

Functions

toNormalised

toNormalised(range, value): number

Converts value to a normalised value (ranging from 0 to 1) and returns it.

Parameters

Name Type
range Range
value number

Returns

number


fromNormalised

fromNormalised(range, normalisedValue): number

Converts a normalised value (ranging from 0 to 1) to it's natural range and returns it.

Parameters

Name Type
range Range
normalisedValue number

Returns

number


fromString

fromString(range, value, unit): number

Parses value from a value and a unit and returns the value as a number.

Parameters

Name Type
range Range
value number
unit string

Returns

number


toString

toString(range, value): string

Converts an unnormalised value to a user-friendly string representation.

Parameters

Name Type
range Range
value number

Returns

string


snap

snap(range, value): number

Snaps an unnormalised value to the closest legal value.

Parameters

Name Type
range Range
value number

Returns

number


getRandom

getRandom(range): number

Returns a random un-normalised value.

Parameters

Name Type
range Range

Returns

number


limit

limit(range, value): number

Limits an un-normalised value to be within the range.

Parameters

Name Type
range Range
value number

Returns

number


nudge

nudge(range, value, steps): number

Nudges the un-normalised value by steps.

Parameters

Name Type
range Range
value number
steps number

Returns

number


getStart

getStart(range): number

Parameters

Name Type
range Range

Returns

number


getEnd

getEnd(range): number

Parameters

Name Type
range Range

Returns

number


limitValue

limitValue(value, min, max): number

Clamps value to at least min and at most max.

Parameters

Name Type
value number
min number
max number

Returns

number