Loading

Quipoin Menu

Learn • Practice • Grow

html / Animation in Canvas
mcq
Direction: Choose the correct option

Q1.

How do you create animations in canvas?
A. Using setInterval only
B. Using SVG animations
C. Using requestAnimationFrame to repeatedly draw and clear
D. Using CSS animations
Direction: Choose the correct option

Q2.

function animate() {
ctx.clearRect(0, 0, canvas.width, canvas.height);
// drawing code
requestAnimationFrame(animate);
}
Why is clearRect needed?
A. To remove previous frame's drawings before new frame
B. To make canvas white
C. To delete canvas
D. To reset colors
Direction: Choose the correct option

Q3.

What is requestAnimationFrame used for?
A. To create frames
B. To request user permission
C. To sync animations with screen refresh rate
D. To load images
Direction: Choose the correct option

Q4.

How do you update an object's position for animation?
A. Recreate object each time
B. Reload canvas
C. Change variables each frame (e.g., x += speed)
D. Use CSS transforms
Direction: Choose the correct option

Q5.

What happens if you animate without clearing the canvas?
A. Previous drawings remain, creating a trail
B. Canvas blanks
C. Only last frame visible
D. Animation won't work