https://bananarobot5.github.io/broot/web/color/ 제가 만든거에요
이건 제가 짠 js 코드에요
let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d");
ctx.canvas.width = window.innerWidth;
ctx.canvas.height = window.innerHeight;
let random1 = String(Math.floor(Math.random() * 256));
let random2 = String(Math.floor(Math.random() * 256));
let random3 = String(Math.floor(Math.random() * 256));
ctx.fillStyle = "rgb(" + random1 + "," + random2 + "," + random3 + ")"; //1
ctx.fillRect(0, 0, canvas.width / 5, canvas.height);
ctx.fillStyle = "rgb(" + random1 + "," + random3 + "," + random2 + ")"; //2
ctx.fillRect(canvas.width * (1 / 5), 0, canvas.width / 5, canvas.height);
ctx.fillStyle = "rgb(" + random2 + "," + random1 + "," + random3 + ")"; //3
ctx.fillRect(canvas.width * (2 / 5), 0, canvas.width / 5, canvas.height);
ctx.fillStyle = "rgb(" + random2 + "," + random3 + "," + random1 + ")"; //4
ctx.fillRect(canvas.width * (3 / 5), 0, canvas.width / 5, canvas.height);
ctx.fillStyle = "rgb(" + random3 + "," + random1 + "," + random2 + ")"; //5
ctx.fillRect(canvas.width * (4 / 5), 0, canvas.width / 5, canvas.height);
console.log(random1 + "@" + random2 + "@" + random3 + "@");
많이 더러운것 같은데 최적화를 어떤 방법으로 해야할가요
댓글 0