댓글 검색 목록

[javascript] 교차하는 두 개의 직사각형을 그리는 JavaScript 프로그램을 작성하십시오. 그 중 하나는 알파 투명성을가집니다.

페이지 정보

작성자 운영자 작성일 17-12-30 19:28 조회 1,222 댓글 0

HTML :

<!DOCTYPE html>
  <html>
  <head>
  <meta charset=utf-8 />
  <title>Draw two intersecting rectangles, one of which has alpha transparency</title>
  </head>
  <body onload="draw();">
  <canvas id="canvas" width="150" height="150"></canvas>
  </body>
  </html>



JS :

function draw() 
  {
      var canvas = document.getElementById("canvas");
      if (canvas.getContext)
      {
        var context = canvas.getContext("2d");

        context.fillStyle = "rgb(256,0,0)";
        context.fillRect (15, 10, 55, 50);
        
        context.fillStyle = "rgba(0, 0, 200, 0.6)";
        context.fillRect (35, 30, 55, 50);
      }
  }



댓글목록 0

등록된 댓글이 없습니다.

웹학교 로고

온라인 코딩학교

코리아뉴스 2001 - , All right reserved.