<canvas> should i continue learning this?

Hi, all im on the path to learning coding myself and have mostly finished HTML and CSS and finding building websites uninteresting however have stumbled upon canvas. Is this a rabbit hole worth pursuing or am i wasting my time building pointless graphics / games??

So far it has interested me the most in my coding journey.

I mean it’s really useful in some contexts, and anyway if it’s something you’ve found really interesting and want to dig into then it’ll only help in terms of learning.

Also it gives you experience in a specific, very widely used style of programming API.

For graphics, there are two major approaches to how APIs are designed. There is retained mode, where there is a graphics library that handles a model of what’s on-screen, and changes go through that. Most GUI stuff is retained mode: HTML is a good example. You write HTML declaratively - <p> or <img> or whatever – and a library included in a browser handles rendering it.

Then there is immediate mode, where you write instructions directly, and the application handles it. Canvas is immediate mode. You write instructions to draw some pixels. Then you clear those pixels and draw some more pixels. And so on. There is no indirection.

You normally wouldn’t want to write a UI in immediate mode (though there are some good reasons for doing so), you’d need to implement everything. But equally you wouldn’t want to write a game or a complicated data visualisation in retained mode, because it would be slow and janky

1 Like

Hey Dan,

Thanks for the info on the types of API and how it comes together, I understand a bit more on types and uses for what im learning. Half the battle I have ATM is where am I going with this, i dont really want to turn coding into my full time career but maybe make some money on the side while I have some quite moments in my current job. But i guess that is another story for another day


1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.