README
84.tools
84.tools is a collection of helpers for your projects
List of helpers
colors
hexToRgb
- Convert hexadecimal color string to rgba stringrgbToHex
- Convert RGB(A) color string to HEX stringtoObject
- Convert RGB(A) or HEX color string to RGBA object
dom
destroyVideo
- Properly destroy HTMLVideoElement taking care of removing it from memorygetIndex
- Get index of specific element relative to its parentgetURLParameters
- Retrieve all URL GET parameters
maths
calculatAspectRatioFit
- This method calculate the ratio depending of an specified maxWidth & maxHeightclamp
- Clamp a value between two boundsclosestInArray
- Return the closest value|index of an array from a specified valuedegrees
- Convert radians to degreesgetPointOnCircle
- Method to get a point from a circle and an anglegetPointsAngle
- Return the angle between 2 pointsgetPointsDist
- Return the distance between two pointsgetRandomFloat
- Generate a random float between a min and max valuesgetRandomInt
- Generate a random int between a min and max valuesgetSlope
- Get the slope value from two pointsprependZeros
- This method prepend an amout of 0 to a string|numberradians
- This method prepend an amout of 0 to a string|number - Convert degrees to radiansrange
- Return a new value linearly interpolate between a new min and maxrectHitTest
- Check if two rectangle are overlaping
How to use
You can add this project as a dependency in your project.
You can require it or just the methods you need via Browserify.
How to contribute
If you want to add methods to this collection :
- Each file can contain only one function to export.
- The function and the file must have the same name.
- Add your new function to the global category file. For example, if you add a maths helpers, add your file into the
maths
directory and add require this file intomaths.js
. - In case the category doesn't exists, create the directory of the category and the category file at root. And be sure to require this category file into
index.js
. - Write a bunch of test for your function/method into the
tests
directory. - Commit & Push !