Skip to content
Browse files

weight as a param instead of 1/10

  • Loading branch information...
1 parent b349727 commit a4a53f94f8c435741f119fe263cfcfdc49d4bcb0 @substack committed Aug 27, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 index.js
View
10 index.js
@@ -67,12 +67,16 @@ Heat.prototype.scale = function (x, y) {
return this;
};
-Heat.prototype.addPoint = function (x, y, radius) {
+Heat.prototype.addPoint = function (x, y, params) {
var ctx = this.alphaCanvas.getContext('2d');
- if (!radius) radius = this.radius;
+ if (typeof params === 'number') {
+ params = { radius : params };
+ }
+ if (!params) params = {};
+ var radius = params.radius || this.radius;
var g = ctx.createRadialGradient(x, y, 0, x, y, radius);
- var a = 1 / 10;
+ var a = params.weight || (1 / 10);
g.addColorStop(0, 'rgba(255,255,255,' + a + ')');
g.addColorStop(1, 'rgba(255,255,255,0)');

0 comments on commit a4a53f9

Please sign in to comment.
Something went wrong with that request. Please try again.