Skip to content

TransformationFunctions.js

Travis CI User edited this page Sep 24, 2018 · 1 revision

Functions

linearDistanceAbsolute(absoluteOrigin, mousePosition)number
linearDistance(absoluteOrigin, mousePosition)number
simpleBellCurve(absoluteOrigin, mousePosition)number

Smoother way to do transformations than linear ones. Also based on distance, but because of the way this function works the return value stays longer at a value near to the maximum than a negative linear function.

advBellCurve(absoluteOrigin, mousePosition, [min], [max], [slope])number

Smoother way to do transformations than linear ones, advanced and optimized for real use. Also based on distance, but because of the way this function works the return value stays longer at a value near to the maximum than a negative linear function.

scaleBellCurve(absoluteOrigin, mousePosition)string

composes a complete smooth scaling transformation based on the mouse pointer's distance to the transformation's origin

combined3d(absoluteOrigin, mousePosition)string

composes a complete smooth and light 3d transformation including scaling and perspective based on the mouse pointer's distance to the transformation origin

linearDistanceAbsolute(absoluteOrigin, mousePosition) ⇒ number

Kind: global function
Returns: number - absolute euclidean distance between the origin of the transformation and the mouse position in px

Param Type Description
absoluteOrigin Array.<number> absolute transformation origin
mousePosition Array.<number> absolute mouse position

linearDistance(absoluteOrigin, mousePosition) ⇒ number

Kind: global function
Returns: number - Relative euclidean distance between the origin of the transformation and the mouse position in px. Values from 0 to 1 if element is perfectly centered. If not, the value can be up to 2

Param Type Description
absoluteOrigin Array.<number> absolute transformation origin
mousePosition Array.<number> absolute mouse position

simpleBellCurve(absoluteOrigin, mousePosition) ⇒ number

Smoother way to do transformations than linear ones. Also based on distance, but because of the way this function works the return value stays longer at a value near to the maximum than a negative linear function.

Kind: global function
Returns: number - value between 0 and 1 Smoother way to do transformations than linear ones. Also based on distance, but because of the way this function works the return value stays longer at a value near to the maximum than a negative linear function. Value always bigger than 0 and the maximum is 1.

Param Type Description
absoluteOrigin Array.<number> absolute transformation origin
mousePosition Array.<number> absolute mouse position

advBellCurve(absoluteOrigin, mousePosition, [min], [max], [slope]) ⇒ number

Smoother way to do transformations than linear ones, advanced and optimized for real use. Also based on distance, but because of the way this function works the return value stays longer at a value near to the maximum than a negative linear function.

Kind: global function
Returns: number - value between min and max

Param Type Default Description
absoluteOrigin Array.<number> absolute transformation origin
mousePosition Array.<number> absolute mouse position
[min] number 0.5 minimum value for the returned values
[max] number 1 maximum value for the returned values
[slope] number 3 natural number. The bigger, the longer the returned value stays near to the maximum

scaleBellCurve(absoluteOrigin, mousePosition) ⇒ string

composes a complete smooth scaling transformation based on the mouse pointer's distance to the transformation's origin

Kind: global function
Returns: string - valid CSS tranformation-property

Param Type Description
absoluteOrigin Array.<number> absolute transformation origin
mousePosition Array.<number> absolute mouse position

combined3d(absoluteOrigin, mousePosition) ⇒ string

composes a complete smooth and light 3d transformation including scaling and perspective based on the mouse pointer's distance to the transformation origin

Kind: global function
Returns: string - valid CSS tranformation-property

Param Type Description
absoluteOrigin Array.<number> absolute transformation origin
mousePosition Array.<number> absolute mouse position