alpha = imageData[i], offset = alpha*4; if(!offset) continue; imageData[i-3]=palette[offset]; imageData[i-2]=palette[offset+1]; imageData[i-1]=palette[offset+2]; imageData[i] = (alpha < opacity)?alpha:opacity; }
还是很简练的吧,看到heatmap.js的风格,真的像是在看一个不错的艺术品一样。强烈推荐一看~