let canvas = document.getElementById("canvas");
let ctx = canvas.getContext("2d");
let random = String(Math.floor(Math.random * 200));
ctx.fillStyle = "rgb(" + random + "," + random + "," + random + ")";
ctx.fillRect(0, 0, 100, 1000);
이대로 하면 검정색만 나와요
canvas에 사각형 색깔이 랜덤으로 나오게하고 싶어요
Math.random 뒤에 () 붙이니까 됬어요!
그런데 random 값이 세개 다 독같이 나와요ㅜ
array 를 써야하나요
random을 호출하는 타이밍을 다르게 잡아보는건 어떩가 - dc App
같은 변수 3개 만들어서 하니까 되네요 감사합니다ㅜㅜㅜ