Skip to content

Commit

Permalink
added stubbe cheapstep
Browse files Browse the repository at this point in the history
  • Loading branch information
rev3rend committed Dec 23, 2021
1 parent 75280a4 commit e6047d3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/p5.func.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*! p5.func.js v0.0.1 2017-05-27 */
/*! p5.func.js v0.0.2 2021-12-23 */
/**
* @module p5.func
* @submodule p5.func
Expand Down Expand Up @@ -1718,6 +1718,15 @@
return(_x*_x*_x*(_x*(_x*6.0 - 15.0) + 10.0));
}

// stubbe's 'cheapstep' quartic smoothstep alternative
// https://www.shadertoy.com/view/4ldSD2
p5.Ease.prototype.cheapStep = function(_x)
{
_x = 1.0 - _x*_x; // MAD
_x = 1.0 - _x*_x; // MAD
return(_x)
}

// maclaurin cosine approximation
// http://blogs.ubc.ca/infiniteseriesmodule/units/unit-3-power-series/taylor-series/the-maclaurin-expansion-of-cosx/
p5.Ease.prototype.maclaurinCosine = function(_x)
Expand Down

0 comments on commit e6047d3

Please sign in to comment.