Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions simpleheat.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ function simpleheat(canvas) {
this._height = canvas.height;

this._max = 1;
this._fixedOpacity = null;
this._data = [];
}

Expand All @@ -37,6 +38,12 @@ simpleheat.prototype = {
return this;
},

// value between 0 and 255
fixedOpacity: function(fixedOpacity) {
this._fixedOpacity = fixedOpacity;
return this;
},

add: function (point) {
this._data.push(point);
return this;
Expand Down Expand Up @@ -126,6 +133,8 @@ simpleheat.prototype = {
pixels[i] = gradient[j];
pixels[i + 1] = gradient[j + 1];
pixels[i + 2] = gradient[j + 2];
if (this._fixedOpacity != null)
pixels[i + 3] = this._fixedOpacity;
}
}
},
Expand All @@ -140,3 +149,4 @@ simpleheat.prototype = {
}
}
};