Which line of code should you add at line 03?

You are creating a web page that contains a canvas with text.
The page contains the following JavaScript code. (Line numbers are included for reference only.)

The text on the canvas must rotate 90 degrees when a user clicks a button on the page.
You need to ensure that the text rotates when the user clicks the button.
Which line of code should you add at line 03?

You are creating a web page that contains a canvas with text.
The page contains the following JavaScript code. (Line numbers are included for reference only.)

The text on the canvas must rotate 90 degrees when a user clicks a button on the page.
You need to ensure that the text rotates when the user clicks the button.
Which line of code should you add at line 03?

A.
context.transform(90);

B.
context.content.getRotation(90);

C.
context.rotate(90);

D.
context.content.rotate (90);

Explanation:
The rotate() method rotates the current drawing.
Example
Rotate the rectangle 20 degrees:
JavaScript:
var c=document.getElementById(“myCanvas”);
var ctx=c.getContext(“2d”);
ctx.rotate(20*Math.PI/180);
ctx.fillRect(50,20,100,50);
HTML canvas rotate() Method



Leave a Reply 0

Your email address will not be published. Required fields are marked *