Skip to content

Commit

Permalink
More distinct Biome and NNH pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-000 committed Sep 9, 2023
1 parent c47e038 commit 0cd0279
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions examples/canvas-gradient-pattern.js
Expand Up @@ -17,14 +17,17 @@ const context = canvas.getContext('2d');
function createPattern(color1, color2) {
// Set equal width and height for diagonal gradient
// Set width or height 0 for horizontal or vertical gradient
const width = 32 * pixelRatio;
const width = 16 * pixelRatio;
const height = width;
const gradient = context.createLinearGradient(0, 0, width, height);
gradient.addColorStop(0, color1);
gradient.addColorStop(0.25, color2);
gradient.addColorStop(0.5, color1);
gradient.addColorStop(0.75, color2);
gradient.addColorStop(1, color1);
gradient.addColorStop(2 / 16, color1);
gradient.addColorStop(3 / 16, color2);
gradient.addColorStop(5 / 16, color2);
gradient.addColorStop(6 / 16, color1);
gradient.addColorStop(10 / 16, color1);
gradient.addColorStop(11 / 16, color2);
gradient.addColorStop(13 / 16, color2);
gradient.addColorStop(14 / 16, color1);
canvas.width = Math.max(width, 1);
canvas.height = Math.max(height, 1);
context.fillStyle = gradient;
Expand Down

0 comments on commit 0cd0279

Please sign in to comment.