1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 6x 6x 6x | const pid = {}; // calculating the conservation is expensive // we only want to do it once pid.init = function(){ this.cons = this.opt.conservation(); } pid.run = function(letter,opts){ var cons = this.cons[opts.pos]; if(cons > 0.8){ return "#6464ff"; }else if(cons > 0.6){ return "#9da5ff"; }else if(cons > 0.4){ return "#cccccc"; }else{ return "#ffffff"; } } export default pid; |