HTML5 Canvas and Graphics Flashcards
6 cards from real HTML5 practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 6 HTML5 Canvas and Graphics flashcards as text
Which method is called to render the current path as a filled shape on the canvas?
Answer: fill()
The fill() method fills the current path with the current fillStyle, rendering the interior of the shape.
What does the canvas stroke() method do?
Answer: Draws the outline of the current path using strokeStyle
The stroke() method draws the outline of the current path using the current strokeStyle and lineWidth settings.
Which canvas method draws an image onto the canvas?
Answer: drawImage()
The drawImage() method draws an image, canvas, or video onto the canvas at a specified position, with optional sizing and cropping.
What does the canvas save() method do?
Answer: Saves the entire state of the canvas context to a stack
The save() method pushes the current canvas state (transforms, styles, clipping) onto a stack so it can be restored later with restore().
The canvas rotate() method rotates the canvas by:
Answer: An angle specified in radians
The rotate(angle) method rotates the canvas transformation matrix by the given angle measured in radians.
Which HTML5 technology is better suited for high-performance 3D rendering in the browser?
Answer: WebGL via canvas getContext('webgl')
WebGL, accessed via getContext('webgl') on a canvas element, provides hardware-accelerated 3D rendering using OpenGL ES.