Home » Microsoft » 70-480 v.2 » Which method should you use?
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 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()
Correct Answer: A
Explanation/Reference:
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);
Incorrect Answers:
B: there is no canvas.spin method.
Reference: HTML canvas rotate() Method