14.1 State whether each of the following is true or false. If false, explain why.
- The strokeStyle attribute specifies the line width. False. The strokeStyle attribute specifies the stroke color
- The bevel lineJoin gives the path square corners. False. The bevel lineJoin gives the path sloping corners
- canvas’s roundedRect method is used to build rounded rectangles. False. there is no roundedRect method in canvas.
- The fillRect method is used to specify a color or gradient. False, the fillRect method drase the color or gradient on the canvas, the fillStyle method specifies a color gradientt
- By default, the origin (0, 0) is located at the exact center of the monitor. False. (0,0) is on the upper left corner of the canvas.
- The restore method restores the context to its initial state. False. The restore method restores the context to its previous state.
- The canvas’s state includes its current style and transformations, which are maintained in a stack.True
14.2 Fill in the blanks in each of the following.
- The canvas element has two attributes width and height .
- When drawing a retangle, the strokeRect method specifies the path of the stroke in the format (x,y,w,h).
- The lineCap attribute has the possible values square, round,and butt.
- The closePath method draws a line from the last specified destination back to the point of the path's orgin.
- The bezierCurveTo method specifies the 3 points in the Bezier curve.
- The shawdowColor attribute specifies the coloar of the shadow.
- Arcs are portions of the circumference of a circle and are measured in radians.
- The save method is used to save the context's current state.
14.3 State whether each of the folloing is true or false. If false, explain why.
- The moveTo method sets the x- and y- coordinates of the paths' destination. False, the moveTo method sets the x and y coordinates to the path's origin.
- A square lineCap specifies that the line ends have edges perpendicular to the direction of the line and no additional cap. True
- A vertical gradient has different x-coordinates but the same y-coordinates. False, the x-coordinates have the same value while the the y-coordinates are different.
- In the canvas coordinate system, x values increase from left to right. True
- Bezier curves have a starting point, and ending point and a single point of inflection. False, the Bezier curves have two control points of inflection.
14.4 Fill in the blanks in each of the following:
- The beginPath method starts the path.
- The lineJoin attribute has three possible values bevel, round, and miter.
- The fillStyle attribute specifies the line color.
- The bevel lineJoin bevels the lines at an angle where they meet
- Each color stop in a gradient has a value between 0 (the start of the gradient) and 1(the end of the gradient)
- The textAlign attribute specifies the horizontal alignment of the text related to the x-coordiante of the text.
- The constant Math.pi is the JavaScript repesentation of the mathematical contant pie.