Created
January 9, 2015 15:20
-
-
Save st44100/41066b4aa14e725a8759 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/tusehi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
var rgb = [255, 10, 10] | |
c = [0, 0, 0] | |
mix = 0.1 | |
var newrgb2 = [ | |
Math.floor(rgb[0] + (c[0] - rgb[0]) * mix), | |
Math.floor(rgb[1] + (c[1] - rgb[1]) * mix), | |
Math.floor(rgb[2] + (c[2] - rgb[2]) * mix) | |
]; | |
console.log(newrgb2); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">var rgb = [255, 10, 10] | |
c = [0, 0, 0] | |
mix = 0.1 | |
var newrgb2 = [ | |
Math.floor(rgb[0] + (c[0] - rgb[0]) * mix), | |
Math.floor(rgb[1] + (c[1] - rgb[1]) * mix), | |
Math.floor(rgb[2] + (c[2] - rgb[2]) * mix) | |
]; | |
console.log(newrgb2); | |
</script></body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var rgb = [255, 10, 10] | |
c = [0, 0, 0] | |
mix = 0.1 | |
var newrgb2 = [ | |
Math.floor(rgb[0] + (c[0] - rgb[0]) * mix), | |
Math.floor(rgb[1] + (c[1] - rgb[1]) * mix), | |
Math.floor(rgb[2] + (c[2] - rgb[2]) * mix) | |
]; | |
console.log(newrgb2); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment