기타

JS Canvas 예제

밝은 철판 2022. 8. 12. 13:37
<!DOCTYPE html>
<html>



<head>
    <script type="text/javascript">
      function draw(){
        var canvas = document.getElementById('tutorial');
        if (canvas.getContext){
          var ctx = canvas.getContext('2d');        
          ctx.fillStyle = 'blue';
          ctx.fillRect(0,0,150,300);
          var img = new Image;
		  img.src = "https://www.galloway.me.uk/media/images/2012-01-30-uiimageorientation-exif-orientation-sample-images/up-mirrored-225x300.jpg";
          ctx.drawImage(img, 0,0,150,200);
        }
      }
    </script>
<title>Page Title</title>
</head>
<body onload="draw();">


<h1>This is a Heading</h1>
<p>This is a paragraph.</p>

<canvas id="tutorial">


</body>
</html>

Tryit Editor v3.7 (w3schools.com) 에서 구현

 

img 내 exif를 지원하지 않는 태그 때문에 Canvas에 넣으려고 발악 중

반응형
LIST

'기타' 카테고리의 다른 글

이어지는 세계...  (1) 2023.11.27
예전에 보던 애니메이션을 보면서...  (0) 2023.04.09
성격과 언어가 개발자 같다는 의문으로부터...  (0) 2023.04.02
Coding Conventions.  (0) 2023.04.01
아 멍청한 것....  (0) 2021.06.24