Join Joe Marini for an in-depth discussion in this video Rectangles, part of Learning HTML Canvas.
- [Instructor] In this example, we'll take a look…at how to draw some basic shapes.…Specifically rectangles.…It turns out that rectangles are the only…primitive shape supported by the Canvas.…Now, you can of course, create circles and other shapes,…and we'll see those later in the course.…But rectangles themselves are the only primitive.…So, there are three functions for operating on rectangles.…The first one is the clearRect function,…which erases the rectangle defined by…the parameters you give it.…So, in other words, it makes the area fully transparent.…It gets rid of the contents of the defined rectangle.…
The other two are strokeRect and fillRect.…SrokeRect outlines a rectangle with…whatever the current stroke style is.…And fillRect fills the rectangle with…whatever the current fill style is.…All three of these rectangle drawing operations…take a starting point of the upper left corner…of the rectangle that you want to draw,…and that's the point where the rectangle will start,…and then a width and a height.…
- Canvas examples
- Drawing shapes, arcs, paths, and curves
- Drawing text
- Drawing shadows, patterns, and gradients
- Using clipping paths
- Displaying images and video
- Transforming objects with scaling and rotation
- Manipulating raw pixels
- Applying transitions
- Creating animations
Skill Level Intermediate
1. Overview of Canvas
2. Basic Canvas Drawing Techniques
3. Complex Canvas Drawing
4. Advanced Drawing APIs
5. Practical Examples
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.