Microsoft Exam Questions

You are developing a web page that will contain an animated logo. The web page currently has a logo

You are developing a web page that will contain an animated logo. The web page currently has a logo image on a canvas object. You reference the context of the canvas object by using a variable named context.

You need to spin the logo image on the canvas.

Which method should you use?

A. context.rotate()

B. context.spin()

C. context.translatePosition()

D. context.setTransform()

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);

Reference: HTML canvas rotate() Method