From the course: Learning HTML Canvas

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Using translate

Using translate

From the course: Learning HTML Canvas

Start my 1-month free trial

Using translate

- [Instructor] Up to this point in the course we've seen how to draw various kinds of content onto a canvas. In this chapter we're going to look at the various kinds of transformations that the canvas provides. Transformations are operations that affect how drawing operations take place on the canvas. They don't necessarily perform any drawing themselves but they do control how drawing is performed. There are three basic kinds of transformations that the canvas makes available. There's translate, scale and rotate. You can also define your own custom transformations. Transforms affect all of the drawing operations on the canvas that come after them and they are additive. In other words, each transform is added to the one that came before it. So let's start by taking a look at the simplest transformation, which is translate. The translate operation just moves the origin of the canvas by the distances specified by the arguments. So let's imagine for a moment you have a canvas. At the…

Contents