As easy as 1, 2, 3!
Updated:
- Aug, 08, 2022 update
config
docs for npm 8+ - Jul 27, 2021 add private scopes
- Jul 22, 2021 add dist tags
- Jun 20, 2021 update for
--access=public
- Sep 07, 2020 update docs for
npm version
// MIT http://rem.mit-license.org | |
function trim(c) { | |
var ctx = c.getContext('2d'), | |
copy = document.createElement('canvas').getContext('2d'), | |
pixels = ctx.getImageData(0, 0, c.width, c.height), | |
l = pixels.data.length, | |
i, | |
bound = { | |
top: null, |
img.grayscale.disabled { | |
filter: url("data:image/svg+xml;utf8,<svg xmlns=\'http://www.w3.org/2000/svg\'><filter id=\'grayscale\'><feColorMatrix type=\'matrix\' values=\'1 0 0 0 0, 0 1 0 0 0, 0 0 1 0 0, 0 0 0 1 0\'/></filter></svg>#grayscale"); | |
-webkit-filter: grayscale(0%); | |
} |
// total number of samples at each fragment | |
#define NUM_SAMPLES {{ numSamples }} | |
#define NUM_SPIRAL_TURNS {{ numSpiralTurns }} | |
#define USE_ACTUAL_NORMALS {{ useActualNormals }} | |
#define VARIATION {{ variation }} | |
uniform sampler2D sGBuffer; |
#!/usr/bin/env bash | |
# MIT © Sindre Sorhus - sindresorhus.com | |
# git hook to run a command after `git pull` if a specified file was changed | |
# Run `chmod +x post-merge` to make it executable then put it into `.git/hooks/`. | |
changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" | |
check_run() { | |
echo "$changed_files" | grep --quiet "$1" && eval "$2" |
/*! | |
* $rootScope listeners, remember to unbind on $destroy | |
*/ | |
var $rootListeners = { | |
'transmitProgress': $rootScope.$on('transmit:progress', transmitProgress), | |
'transmitSuccess': $rootScope.$on('transmit:success', transmitSuccess), | |
'transmitError': $rootScope.$on('transmit:error', transmitError) | |
}; | |
// iterate the Object and pass the methods to be called on $destroy |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
Please consider using http://lygia.xyz instead of copy/pasting this functions. It expand suport for voronoi, voronoise, fbm, noise, worley, noise, derivatives and much more, through simple file dependencies. Take a look to https://github.com/patriciogonzalezvivo/lygia/tree/main/generative
float rand(float n){return fract(sin(n) * 43758.5453123);}
float noise(float p){
float fl = floor(p);
float fc = fract(p);
(function() { | |
var defaultFrameRate = 20, // fps lock for old browsers | |
// This is the default fallback throttle function | |
framerateThrottle = function(callback) { | |
return _.throttle(callback, 1 / (defaultFrameRate * 1000)); | |
}; | |
// Feature detection - should have requestAnimationFrame | |
if (window.requestAnimationFrame) { | |
framerateThrottle = function(callback) { |