我做了以下内容:PaperJS画布背景色填充
<script type="text/paperscript" canvas="canvas">
fill_canvas(set_of_clicked_points){
//code which correctly fills up colour for static array
context.putImageData(imageData, 0,0);
//
}
alert(set_of_clicked_points);
}
var cells=new Array();
function onMouseDown(event) {
var myCircle = new Path.Circle(event.point, 3);
myCircle.fillColor = 'black';
set_of_clicked_points.push(event.point.x);
set_of_clicked_points.push(event.point.y);
fill_canvas(set_of_clicked_points){
}
</script>
现在我的脚本工作完美,直到警报(set_of_clicked_points);之后,背景会再次变成白色,因为根据我的功能它应该有不同的颜色。我怎样才能做到这一点?
PaperJS是否会定期刷新画布的背景?
我想绘制使用鼠标放在画布上的单元格的中心,创建单元格中心的坐标列表并使用它们绘制voronoi图 –