feat: Change colors for square2
This commit is contained in:
parent
5538a6ae0b
commit
86f3c679c3
1 changed files with 15 additions and 1 deletions
|
|
@ -35,6 +35,17 @@ tags:
|
||||||
'#90bac2',
|
'#90bac2',
|
||||||
'#7daeb7'
|
'#7daeb7'
|
||||||
];
|
];
|
||||||
|
/*const colors = [
|
||||||
|
'#fad803',
|
||||||
|
'#f2af13',
|
||||||
|
'#d30a51',
|
||||||
|
'#8e1f68',
|
||||||
|
'#273f8b',
|
||||||
|
'#3c579a',
|
||||||
|
'#b7e0f0',
|
||||||
|
'#6bc7d9',
|
||||||
|
'#52bed1'
|
||||||
|
];*/
|
||||||
|
|
||||||
function isPowerOfTwo(n) {
|
function isPowerOfTwo(n) {
|
||||||
return n > 0 && (n & (n - 1)) === 0;
|
return n > 0 && (n & (n - 1)) === 0;
|
||||||
|
|
@ -97,10 +108,13 @@ tags:
|
||||||
function draw(gridX, gridY, sizeInPixels) {
|
function draw(gridX, gridY, sizeInPixels) {
|
||||||
const x = gridX * minSize;
|
const x = gridX * minSize;
|
||||||
const y = gridY * minSize;
|
const y = gridY * minSize;
|
||||||
|
const type = Math.random() < 0.5;
|
||||||
|
|
||||||
ctx.fillStyle = colors[Math.floor(Math.random() * colors.length)];
|
ctx.fillStyle = colors[Math.floor(Math.random() * colors.length)];
|
||||||
ctx.fillRect(x, y, sizeInPixels, sizeInPixels);
|
ctx.fillRect(x, y, sizeInPixels, sizeInPixels);
|
||||||
ctx.strokeStyle = '#333';
|
// TODO: Linie anpassen und wiederholen
|
||||||
|
ctx.strokeStyle = '#404040';
|
||||||
|
// ctx.strokeStyle = type ? '#fff' : '#000';
|
||||||
ctx.lineWidth = 1;
|
ctx.lineWidth = 1;
|
||||||
ctx.strokeRect(x, y, sizeInPixels, sizeInPixels);
|
ctx.strokeRect(x, y, sizeInPixels, sizeInPixels);
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue