I am making a heatmap clicks script which will record the no. of clicks and according to that shows the color on the clicked position. Now I have the positions(X,Y) where the clicks are made, I want to set color on that positon. Any Idea ?
我正在制作一个热图点击脚本,它将记录no。点击并根据显示点击位置的颜色。现在我有了点击的位置(X,Y),我想在那个位置上设置颜色。任何的想法 ?
Something like this:
像这样的东西:
GetPosition(X,Y).setColor("any color");
1 个解决方案
#1
0
If you are going to draw an HTML5 Canvas you can do something like this:
如果您要绘制HTML5 Canvas,您可以执行以下操作:
var id = yourContext.createImageData(1, 1);
var data = id.data;
data[0] = red;
data[1] = green;
data[2] = blue;
data[3] = alpha;
yourContext.putImageData(id, x, y);
#1
0
If you are going to draw an HTML5 Canvas you can do something like this:
如果您要绘制HTML5 Canvas,您可以执行以下操作:
var id = yourContext.createImageData(1, 1);
var data = id.data;
data[0] = red;
data[1] = green;
data[2] = blue;
data[3] = alpha;
yourContext.putImageData(id, x, y);