Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

weight as a param instead of 1/10

  • Loading branch information...
commit a4a53f94f8c435741f119fe263cfcfdc49d4bcb0 1 parent b349727
James Halliday authored August 27, 2011

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. 10  index.js
10  index.js
@@ -67,12 +67,16 @@ Heat.prototype.scale = function (x, y) {
67 67
     return this;
68 68
 };
69 69
 
70  
-Heat.prototype.addPoint = function (x, y, radius) {
  70
+Heat.prototype.addPoint = function (x, y, params) {
71 71
     var ctx = this.alphaCanvas.getContext('2d');
72  
-    if (!radius) radius = this.radius;
  72
+    if (typeof params === 'number') {
  73
+        params = { radius : params };
  74
+    }
  75
+    if (!params) params = {};
  76
+    var radius = params.radius || this.radius;
73 77
     
74 78
     var g = ctx.createRadialGradient(x, y, 0, x, y, radius);
75  
-    var a = 1 / 10;
  79
+    var a = params.weight || (1 / 10);
76 80
     
77 81
     g.addColorStop(0, 'rgba(255,255,255,' + a + ')');
78 82
     g.addColorStop(1, 'rgba(255,255,255,0)');

0 notes on commit a4a53f9

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