From the course: Learning SVG
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Rotate SVG shapes
- [Instructor] Going through all of these different shapes you've probably noticed there's an obvious piece of the puzzle that's missing. How do we rotate a shape? Say you have a rectangle but you want it to be displayed at a 45 degree angle, the rect element gives you the rectangle but it's square with the view box. Same with pretty much all the other shapes, maybe with the exception of line because line is just a line and you can place it anywhere you want. Rotating a shape falls under the domain of the transform attribute along side translating, scaling, and skewing. The transform attribute applies to an element and it's children. So it can be used on an SVG shape like a rectangle, or a g element, or a symbol, etc. In this movie we'll look at how to use transform to rotate a simple rectangle. In the exercise files for this movie I've set up an SVG with a rectangle aligned to X and Y 20. To make it clear where the anchor point for the rectangle is as we start off. I've highlighted…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
SVG shapes overview2m 31s
-
(Locked)
Draw a line2m 52s
-
(Locked)
Draw a rectangle4m 24s
-
(Locked)
Draw a circle1m 27s
-
(Locked)
Draw an ellipse1m 59s
-
(Locked)
Draw a polyline2m 44s
-
(Locked)
Draw a polygon2m 12s
-
(Locked)
Draw a path3m 59s
-
(Locked)
Add text to an SVG9m 4s
-
(Locked)
Convert text to outlines4m 42s
-
(Locked)
Add an external image to an SVG4m 4s
-
(Locked)
Rotate SVG shapes5m 18s
-
-
-
-