What is HTML5 canvas?

I am a little confused about what is an HTML5 canvas. I was told that this is JavaScript, but it seems to be a much larger deal?

  • How is it different from javascript?

  • Why is this so amazing?

  • Are there any other things besides JavaScript?

+3
source share
5 answers

I suggest you read this HTML5 Canvas article - the basics

But in short. It does not replace javascript.

HTML 5 JavaScript. "" ( ), JavaScript , . API .

+5

canvas - img, javascript.

+5

- , , , ; .

, "" , , - MS Paint, , , . - . , !

Mozilla , .

+1

, Canvas JavaScript! 2 .

Canvas - HTML5, , , , JavaScript. - -.

+1
  • . , , .
  • . , , , (, ).

. , :

<html>
      <body>
       <canvas id="c" width="200" height="200" style="border:1px solid"></canvas>
        <script>
          var canvas = document.getElementById("c");//get the canvas in javascript
          var context = canvas.getContext("2d");//getcontext on canvas
          context.beginPath();//start the path.we are going to draw the line
          context.moveTo(20,20);//starting point of Line
          context.lineTo(40,20);//ending point of Line
          context.stroke(); //ink used for drawing Line (Default: Black)
        </script>
      </body>
    </html>
Hide result
     
0

Source: https://habr.com/ru/post/1737824/


All Articles