Skip to content

Commit

Permalink
reorganize
Browse files Browse the repository at this point in the history
  • Loading branch information
wpowers42 committed Dec 11, 2023
1 parent 9776e00 commit 5a861ac
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions box-breathing/BreathingCircle.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,31 +47,24 @@ class BreathingCircle {
);

// Add color stops to the gradient

// Set the stroke style to the gradient
ctx.strokeStyle = gradient;
ctx.lineWidth = this.lineWidth;
ctx.fillStyle = this.color;

gradient.addColorStop(1.00, 'rgba(255, 255, 255, 1.00)');
gradient.addColorStop(0.75, 'rgba(255, 255, 255, 0.05)');
gradient.addColorStop(0.00, 'rgba(255, 255, 255, 0.00)');

// Draw the arc for 1/4 of the circle
ctx.beginPath();
ctx.arc(this.x, this.y, this.radius, startAngle, endAngle);

ctx.strokeStyle = gradient;
ctx.stroke();

ctx.strokeStyle = this.color;

for (let i = 0; i < 4; i++) {
ctx.save();
ctx.globalAlpha = this.activeSegment == i ||
this.activeSegment == (i - 1 + 4) % 4 ? 1.0 : 0.10;
ctx.translate(this.x, this.y);
ctx.rotate(Math.PI * 2 * i / 4 - this.baseAngle);
ctx.translate(0, this.radius);
ctx.fillStyle = this.color;
ctx.fillRect(0, -8, 1, 16);
ctx.restore();
}
Expand Down

0 comments on commit 5a861ac

Please sign in to comment.