User Interaction — Mouse, Keyboard and Touch

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

20 Terms

1
New cards

What is user interaction in animation?

When an animation responds to actions performed by the user.

2
New cards

What is a mouse event?

An event caused by mouse actions, such as moving or clicking.

3
New cards

What does mousemove mean?

The mouse pointer moves.

4
New cards

What does mousedown mean?

A mouse button is pressed down.

5
New cards

What does mouseup mean?

A mouse button is released.

6
New cards

What does click mean?

The user clicks.

7
New cards

What does keydown mean?

A keyboard key is pressed down.

8
New cards

What does keyup mean?

A keyboard key is released.

9
New cards

What does touchstart mean?

A finger first touches the screen.

10
New cards

What does touchmove mean?

A finger moves while touching the screen.

11
New cards

What does touchend mean?

A finger stops touching the screen.

12
New cards

What does addEventListener() do?

It tells JavaScript to listen for a specified event and run instructions when that event occurs.

13
New cards

What is a callback function in an event listener?

A function that runs when the specified event occurs.

14
New cards

What does event.offsetX represent?

The mouse pointer's horizontal position inside the canvas.

15
New cards

What does event.offsetY represent?

The mouse pointer's vertical position inside the canvas.

16
New cards

Why does Canvas need to redraw an object to move it?

Canvas draws pixels and does not automatically move previously drawn objects.

17
New cards

What is the usual animation interaction sequence?

Capture input, update the object's state, clear the canvas, redraw the object, and repeat.

18
New cards

What does clearRect() do?

It clears a rectangular area of the canvas.

19
New cards

What does requestAnimationFrame() do?

It asks the browser to schedule the animation function for another frame.

20
New cards

How can a circle follow the mouse?

Update its x and y coordinates using mouse event coordinates, then clear and redraw it in the animation loop.