canvas 스크립트 수정 질문..! 도와주세요ㅠㅠ 채택완료

https://codepen.io/osublake/pen/mxOXQQ

해당 코드에서 혹시 십자가 모양 변경이나 십자가 색상 변경 하려면 어디 변경해야하나요 ?ㅠㅠㅠ 고수님들 도와주세요..!!!

답변 2개

채택된 답변
+20 포인트

모양은 어떤 모양일까요?

색상 변경은 chatGPT  한테 물어보니 알려주네요.

Copy
var canvas2 = document.createElement("canvas");
var canvas2Context = canvas2.getContext("2d")
canvas2.width = canvas2.height = 20;
canvas2Context.lineWidth = 2;
canvas2Context.strokeStyle = "red"; // Change this to your desired color
canvas2Context.beginPath();
canvas2Context.moveTo(10, 0);
canvas2Context.lineTo(10, 20);
canvas2Context.moveTo(0, 10);
canvas2Context.lineTo(20, 10);
canvas2Context.stroke();
로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

function draw(){  
  if(mouseOver && mouseMoved){
    calculateIconPosition();
    mouseMoved = false;
  }
  
  
  context.clearRect(0, 0, c.width, c.height);
  context.save();
  // context.beginPath();
  for(var i = 0; i < gridLength; i++){
    for(var j = 0; j <gridLength; j++){
      var sign = signs[i][j];
      
      sign.draw(context);
    }
  }  
  // context.closePath();
  context.restore();
  // context.stroke();
}

여기 draw 한국에서 sign.draw함수 이전에 strokeStyle = 'yellow' 같이 설정하시면 됩니다.

로그인 후 평가할 수 있습니다

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인
🐛 버그신고