
Javascript Canvas Flashcard
Flashcard
•
Computers
•
6th - 8th Grade
•
Practice Problem
•
Hard
Wayground Content
FREE Resource
Student preview

13 questions
Show all answers
1.
FLASHCARD QUESTION
Front
Where is the origin (0,0) located on the canvas?
Back
Top Left
Answer explanation
In math, it's the bottom left. But on the canvas, it's the top left.
2.
FLASHCARD QUESTION
Front
In which direction does the y coordinate increase?
Back
Moving from bottom to top
Answer explanation
Math and javascript are the same for the x coordinate. To the right is increasing for x in math and javascript.
But it's different for the y coordinate. In Javascript, going down is an increasing y coordinate.
3.
FLASHCARD QUESTION
Front
Which one of these represents a point that is 50 pixels to the right of the top left corner and 70 pixels lower than the top left corner? (70, 50), (50, -70), (50, 70), (70, -50)
Back
(50, 70)
Answer explanation
Left/right is the x coordinate, which is first. So 50, should go there. Up/down is the y coordinate, which comes second. So 70 should go there.
We don't really use negative coordinates in javascript. So those don't make much sense.
4.
FLASHCARD QUESTION
Front
Which one of these represents a point that is 80 pixels to the right of the top left corner and 100 pixels lower than the top left corner? (80, 80), (getWidth(), 100), (80, 20), (80, 100)
Back
(80, 100)
Answer explanation
getWidth() is for when we want to think of the coordinate as how far it is from the right edge. So that won't work.
This is the distance from the top left corner, which in javascript is (0, 0). So we really just need to put the left/right # of pixels in the first spot (the x coordinate) and the up/down # of pixels in the second spot (the y-coordinate).
5.
FLASHCARD QUESTION
Front
Which one of these represents a point that is 80 pixels to the left of the top right corner and 100 pixels lower than the top right corner? Options: (getWidth() - 100, 80), (getWidth() - 80, 100), (80, 100), (80, getHeight() - 100)
Back
(getWidth() - 80, 100)
Answer explanation
The top is normally where we measure the y coordinate from, so that doesn't need to change.
But we usually measure the x coordinate from the left. So measuring from the top right corner makes our lives more annoying. To count from the right, we first go all the way right using getWidth(). That sets the x coordinate all the way to the right side of the canvas.
But we wanted to go 80 pixels left of that, so we just subtract 80 from getWidth().
6.
FLASHCARD QUESTION
Front
Which one of these represents a point that is 210 pixels to the left of the bottom right corner and 140 pixels higher than the bottom right corner? Options: (getWidth() - 210, getHeight() - 140), (getWidth() + 210, getHeight() + 140), (getWidth(), getHeight()), (210, 140)
Back
(getWidth() - 210, getHeight() - 140)
Answer explanation
The top is normally where we measure the y coordinate from, so measuring from the bottom means we need to subtract from getHeight(). getHeight() represents going all the way to the bottom. So subtracting 140 from that take us 140 above the bottom.
Same idea for the x coordinate. We want to be 210 from right edge, so do getWidth() - 210.
7.
FLASHCARD QUESTION
Front
Back
Answer explanation
getWidth() is the full width of the canvas. So dividing it by two will go halfway.
Same idea for getHeight().
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
15 questions
Addition and Subtraction Equations
Flashcard
•
5th - 7th Grade
15 questions
Year 7 - Expanding Brackets
Flashcard
•
5th - 7th Grade
10 questions
Solving problem Conversion of Unit Measurement
Flashcard
•
7th Grade
10 questions
The Renaissance
Flashcard
•
5th Grade
15 questions
Esperanza Rising Vocab Part 3
Flashcard
•
5th - 8th Grade
13 questions
Vocabulary Flashcards
Flashcard
•
8th Grade
15 questions
Area, Perimeter, & Volume
Flashcard
•
5th - 8th Grade
15 questions
04.08 CAD
Flashcard
•
7th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade