Certified Animation Professional (CAP) Practice Test

Disable ads (and more) with a membership for a one time $2.99 payment

Prepare for the Certified Animation Professional Exam. Use engaging quizzes with flashcards and multiple choice questions, each with hints and detailed explanations. Gear up for success!

Each practice test/flash card set has 50 randomly selected questions from a bank of over 500. You'll get a new set of questions each time!

Practice this question and more.


In JavaScript, what is the command to color a drawn shape?

  1. paint

  2. fill

  3. color

  4. shade

The correct answer is: fill

In JavaScript, particularly in the context of the HTML5 Canvas API, the command used to color a drawn shape is "fill." This command is part of the drawing functions that allow developers to create shapes and then fill them with a specified color or pattern. When you call the fill() method after defining a shape using methods like beginPath(), rect(), or arc(), it applies the current fill style to that shape, effectively coloring it. This concept is central to graphics programming in JavaScript, as filling shapes provides a way to visually represent data or create art. The fill style can be set using the fillStyle property, where you can define colors using different formats, such as named colors, HEX code, or RGBA. The other options—paint, color, and shade—do not correspond to any specific method or property in the context of JavaScript for coloring shapes. Hence, "fill" is the appropriate and recognized command for this purpose.