โ† All HTML5 Flashcard Decks

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
  1. Which method is used to get a 2D drawing context from an HTML5 canvas element?

    Answer: getContext('2d')

    The getContext('2d') method returns a CanvasRenderingContext2D object used for drawing shapes, text, and images on the canvas.

  2. What does the canvas fillRect() method do?

    Answer: Draws a filled rectangle at the specified position

    The fillRect(x, y, width, height) method draws a filled solid rectangle using the current fillStyle.

  3. Which canvas method is used to draw an arc or circle?

    Answer: arc()

    The arc(x, y, radius, startAngle, endAngle, anticlockwise) method adds an arc to the current path, used to draw circles and circular shapes.

  4. What is the purpose of beginPath() in HTML5 Canvas?

    Answer: Starts a new drawing path, clearing any previous path

    The beginPath() method resets the current path so that subsequent path commands start fresh without connecting to old path segments.

  5. Which canvas property sets the color or style used to fill shapes?

    Answer: fillStyle

    The fillStyle property sets the color, gradient, or pattern used to fill shapes drawn on the canvas.

  6. What does the canvas clearRect() method do?

    Answer: Clears the specified rectangular area, making it transparent

    The clearRect(x, y, width, height) method erases the pixels in the specified rectangle, making that area transparent.