Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/spite/maf.js
Maf
https://github.com/spite/maf.js
Last synced: 11 days ago
JSON representation
Maf
- Host: GitHub
- URL: https://github.com/spite/maf.js
- Owner: spite
- License: mit
- Created: 2015-10-16T20:30:53.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2021-09-04T18:36:38.000Z (about 3 years ago)
- Last Synced: 2024-10-23T11:44:25.925Z (20 days ago)
- Language: JavaScript
- Size: 14.6 KB
- Stars: 81
- Watchers: 7
- Forks: 12
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Maf.js
=============A library for doin' maf innit
About
-----Maf.js implements many common useful functions that are not supported in the JavaScript Math library. Instead of adding methods to Math.prototype and risking potential conflicts with future implementations, let's create a Math library with those methods.
There's a mix of GLSL, HLSL, Unity and other libraries and languages.
Methods
------- clamp( v, minVal, maxVal );
- step( edge, v );
- smoothstep( edge0, edge1, v );
- deg2Rad( degress ), toRadians( degress );
- rad2Deg( radians ), toDegrees( radians );
- clamp01( v );
- mix( x, y, a ), lerp( x, y, a );
- inverseMix( a, b, v ), inverseLerp( a, b, v );
- mixUnclamped( x, y, a ), lerpUnclamped( x, y, a ),
- fract( v );
- isPowerOfTwo( v );
- closestPowerOfTwo( v );
- nextPowerOfTwo( v );
- deltaAngle( a, b ), deltaAngleDeg( a, b ), deltaAngleRad( a, b );
- lerpAngle, lerpAngleDeg, lerpAngleRad;
- gammaToLinearSpace( v );
- linearToGammaSpace( v );
- map( from1, to1, from2, to2, v ), scale( from1, to1, from2, to2, v );
- latLonToCartesian( lat, lon );
- cartesianToLatLon( x, y, z );
- randomInRange( min, max );
- norm( v, minVal, maxVal );
- hash( n );
- noise2d( x, y );
- smoothMin( a, b, k );
- smoothMax( a, b, k );Coming up (?)
-------
- almostIdentity( x, m, n )
- impulse( k, x );
- cubicPulse( c, w, x );
- expStep( x, k, n );
- parabola( x, k );
- powerCurve( x, a, b );Discarded
-------
- smoothDamp / smoothDampAngle, smoothDampAngleDeg, smoothDampAngleRad; Can be done with basic functions and easing the time value
- easing functions: there's libraries for that (TweenMax, tween.js)
- perlin functions: there's ImprovedNoise.jsLicense
-------MIT licensed
Copyright (C) 2015 Jaume Sanchez Elias http://twitter.com/thespite
http://www.clicktorelease.com