• Register
100 points
5 1

Answer with explaination

This statement is FALSE.

 

We can draw any shape with the help of canvas like : triangle,circle,smiley face,game drawing,patterns and many.more.

The HTML canvas element is used to draw “raster” graphics on a web application. The Canvas API provides two drawing contexts which are:

  1. 2D
  2. 3D.

Canvas is a raster graphics API ,you can manipulate stuff at the pixel level with the help of grids. 

I am providing  one example which will prove that you can not draw rectangle but also draw various shapes using Canvas.

Code for drawing triangle 

function draw() {
  var canvas = document.getElementById('canvas');
  if (canvas.getContext) {
    var tri = canvas.getContext('2d');// specifies it is 2D shape.

    tri.beginPath();
    tri.moveTo(75, 50);//these are x and y positions of triangle
    tri.lineTo(100, 75);
    tri.lineTo(100, 25);
    tri.fillStyle ="green"; // triangle filled with green color
    tri.fill();
  }
}