Skip to content
This repository has been archived by the owner on Jan 7, 2019. It is now read-only.

Commit

Permalink
Added linear gradient line colours
Browse files Browse the repository at this point in the history
  • Loading branch information
alexgibson committed Jun 13, 2012
1 parent fe417c0 commit a7c643b
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions main.js
Expand Up @@ -119,12 +119,20 @@ var sketch = (function () {
xPos = x;
yPos = y;
}

var grad1 = ctx.createLinearGradient(0, 0, window.innerWidth, window.innerHeight);
grad1.addColorStop(0, 'yellow');
grad1.addColorStop(0.25, 'red');
grad1.addColorStop(0.50, 'blue');
grad1.addColorStop(0.75, 'limegreen');

ctx.strokeStyle = grad1;

ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.lineWidth = size;
ctx.strokeStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
ctx.globalCompositeOperation = 'source-over';
//ctx.strokeStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
ctx.globalCompositeOperation = 'source-over';
ctx.beginPath();
ctx.moveTo(xPos, yPos);
ctx.lineTo(x, y);
Expand All @@ -144,7 +152,12 @@ var sketch = (function () {
ctx.lineCap = 'round';
ctx.lineJoin = 'round';
ctx.lineWidth = size;
ctx.strokeStyle = 'rgba(' + r + ',' + g + ',' + b + ',' + a + ')';
var grad1 = ctx.createLinearGradient(0, 0, window.innerWidth, window.innerHeight);
grad1.addColorStop(0, 'yellow');
grad1.addColorStop(0.25, 'red');
grad1.addColorStop(0.50, 'blue');
grad1.addColorStop(0.75, 'limegreen');
ctx.strokeStyle = grad1;
ctx.globalCompositeOperation = 'source-over';
ctx.beginPath();
ctx.moveTo(lines[id].x, lines[id].y);
Expand Down

0 comments on commit a7c643b

Please sign in to comment.