-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpixelmapFunctions.min.js
7 lines (7 loc) · 1.2 KB
/
pixelmapFunctions.min.js
1
2
3
4
5
6
7
/*!
* pixelmap-functions - v1.0.0 - 2018-10-16
* /~https://github.com/howion/pixelmap-functions
*
* Copyright (c) 2018 howion
* Licensed under the MIT license */
var pixelmapFunctions={invert:function(n,t,r,u){return[255-n,255-t,255-r,u]},modeRGB:function(n,t,r,u){return[n,t,r,u]},modeRBG:function(n,t,r,u){return[n,r,t,u]},modeGRB:function(n,t,r,u){return[t,n,r,u]},modeGBR:function(n,t,r,u){return[t,r,n,u]},modeBGR:function(n,t,r,u){return[r,t,n,u]},modeBRG:function(n,t,r,u){return[r,n,t,u]},arithmeticMean:function(n,t,r,u){var o=Math.round((n+t+r)/3);return[o,o,o,u]},sepia:function(n,t,r,u){return[.393*n+.769*t+.189*r,.349*n+.686*t+.168*r,.272*n+.534*t+.131*r,u]},sine:function(n,t,r,u){function o(n){return Math.round(255*Math.sin(n/24))}return[o(n),o(t),o(r),u]},sineAbsolute:function(n,t,r,u){function o(n){return Math.abs(Math.round(255*Math.sin(n/24)))}return[o(n),o(t),o(r),u]},squareRoot:function(n,t,r,u){function o(n){return Math.round(Math.sqrt(255*n))}return[o(n),o(t),o(r),u]},cubeRoot:function(n,t,r,u){function o(n){return Math.round(Math.cbrt(65025*n))}return[o(n),o(t),o(r),u]},sigmoidRound:function(n,t,r,u){function o(n){return Math.round(1/(1/255+Math.exp(-n/24)))}return[o(n),o(t),o(r),u]}};