Implement tint and shade functions

This commit is contained in:
Synchro
2012-09-12 18:49:21 +02:00
committed by Luke Page
parent 8019439eb4
commit f8bee84fdf
3 changed files with 18 additions and 0 deletions

View File

@@ -304,6 +304,12 @@ tree.functions = {
var g = 255 - Math.abs(255 - color2.rgb[1] - color1.rgb[1]);
var b = 255 - Math.abs(255 - color2.rgb[2] - color1.rgb[2]);
return this.rgb(r, g, b);
},
tint: function(color, amount) {
return this.mix(this.rgb(255,255,255), color, amount);
},
shade: function(color, amount) {
return this.mix(this.rgb(0, 0, 0), color, amount);
}
};