Code Theory

HTML5

Canvas

Drawing, transforms and pixel work on the 2D canvas context.

Canvas guides on Code Theory
Guide Length API status
Why clearRect Might Not be Clearing the Canvas Pixels

Sometimes the clearRect(x, y, width, height) method on the canvas context might not erase the previous graphics drawn.

291w Current
Scaling Your HTML5 Canvas to Fit Different ViewPorts (or Resolutions)

I am going to share a neat little trick that was learnt while working on an HTML5 game recently. The game is pretty much like our HTML5 Doodle Jump .

321w Current
Canvas Rotating and Scaling Images Around a Particular Point

Transforming objects in your HTML5 Game or Experiment requires a bit of understanding regarding how they work.

1180w Current
Canvas Text Gradients for Backgrounds and Strokes

Text gradients are super easy to achieve with HTML5 Canvas. Process Here’s the process: Step 1 Create your CanvasGradient object with createLinearGradient .

139w Current
Rendering Animations with Moving Objects on Canvas

Moving objects on HTML5 Canvas is really easy. I should have written on this topic before writing on gravity but it’s never too late!

576w Current
Moving/Scrolling/Sliding Background in HTML5 Canvas

Sometimes your game or canvas experiment might have one or more layers of animating backgrounds that are set in motion for the player’s movement or some…

479w Current
Different Tools for Our Sketching Application

It is important for our painting application to have different tools like: Line tool to draw straight lines. Rectangle tool to draw rectangles.

3177w Current
Controlling the Frame Rate with requestAnimationFrame

Limiting the frame rate while using requestAnimationFrame can be a common want especially when coding Games where you want your animations and mechanics to…

387w Current
Drawing Text on HTML5 Canvas

Writing Text on canvas is pretty straightforward. All we need to know about is certain properties and methods that are pre-defined on the canvas’s context.

277w Current
HTML5 Canvas Drawing Lines with Smooth Edges

In the previous post we kicked off with our painting application using HTML5 canvas.

934w Current
Calculate Control Point to Make Your Canvas Curve Hit a Specific Point

Creating curves in HTML5 Canvas is usually achieved with quadraticCurveTo() that has 1 control point or bezierCurveTo() that has 2 control points.

358w Current
Creating a Paint Application with HTML5 Canvas

Let’s build a simple painting (or sketching) application using HTML5 <canvas> element along with its Javascript API.

569w Current
20+ Best Canvas Tutorials and Examples That Will Make You A Canvas Master

Every now and then a new technology releases giving better features and advantages over the previous ones but learning them all without spending a lot of…

1228w Current

More in HTML5

All HTML5 →