Html Interaction Flashcards

1
Q

JS: let Var = document.getElementById(“”);

A

Takes a string that corresponds to to an HTML id attribute

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

JS: VAR.innerText = “”

A

Can be used to reassign content of an element (VAR) along side use of document.get…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

JS: document.querySelectorAll(“”)

A

Can be used to select ALL of a certain that match a selector string
Omit the ‘All’ to use on just the first/only selector

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

JS: .addEventListener(‘EVENT’, Function);

A

Events can be ‘click’ , ‘keydown’, ‘scroll’ to start with.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

JS: let ctx = canvas.getContext(‘2d’);

A

Setting up a canvas element with a 2d drawing context. Assigning to the variable means less typing when using additional methods/properties further in

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

JS: ctx.fillStyle = …

A

to create a solid 2d object fill “colour”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

JS: ctx.fillRect(10, 10, 200, 200)

A

To create a filled rectangle/square.
(Start x, start y, length x, length y)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

JS: ctx.linewidth = int

A

outline width for canvas.getContext

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

JS: ctx.strokeStyle = ‘colour’

A

Colour of outline for canvas.getContext

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

JS: ctx.strokeRect(10, 10, 200, 100)

A

create a rectangle/square outline

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

JS: ctx.fillStyle = ‘color’
ctx.beginPath;
ctx.moveTo(x, y);
ctx.lineTo(x, y);
ctx.fill()

A

Draw and fill a shape by Path

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

JS: ctx.arc(centreX , centreY, radius, start * [rad], Math.PI*2, true/false)

A

Draw a circle.
Use after .beginPath()
true = counterclockwise

How well did you know this?
1
Not at all
2
3
4
5
Perfectly