menu_book Course Curriculum (Web Graphics) expand_more
SVG Essentials
SVG Interaction
Canvas Drawing
requestAnimationFrame
Learn requestAnimationFrame in Web Graphics with a focused explanation, a topic-specific example, and a mastery check.
12 min read
•
Intermediate
web-graphics-025.html
html
<canvas id="c" width="220" height="60"></canvas><script>const x=c.getContext("2d");let p=0;function frame(){x.clearRect(0,0,220,60);x.fillRect(p,20,20,20);p=(p+1)%200;requestAnimationFrame(frame)}requestAnimationFrame(frame);</script>
What to watch
Content source & attribution
Original Syntaxis Content · Original Syntaxis Content