
Javascript Canvas Flashcard

Flashcard
•
Computers
•
6th - 8th Grade
•
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().
Create a free account and access millions of resources
Similar Resources on Wayground
13 questions
Exponents Power of a Power

Flashcard
•
7th - 8th Grade
15 questions
Scale Factor and Scale Drawings

Flashcard
•
7th - 8th Grade
15 questions
proportion word problems

Flashcard
•
7th - 8th Grade
15 questions
Volume Of Rectangular Prism

Flashcard
•
7th Grade
15 questions
3D Figures

Flashcard
•
7th - 8th Grade
15 questions
Grade 7 Math - SOL Practice Test

Flashcard
•
7th Grade
10 questions
Unit 3: Lesson 4: Shapes and Parameters Flashcard

Flashcard
•
6th Grade
12 questions
Volume of Cubes & Rectangular Prisms

Flashcard
•
6th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
Discover more resources for Computers
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade
20 questions
typing

Quiz
•
6th Grade
18 questions
Company Logos

Quiz
•
6th - 8th Grade
10 questions
Proper Keyboarding Techniques

Interactive video
•
6th - 10th Grade
14 questions
Inputs and Outputs: Computer Science Intro

Lesson
•
5th - 9th Grade
20 questions
Input, Output, Processing or Storage

Quiz
•
5th - 6th Grade
10 questions
Understanding Computers: Hardware, Software, and Operating Systems

Interactive video
•
7th - 12th Grade