Rotation Using <animateTransform>

Take a look at a simple rotation, using a grouping <g> element you used in an example in Chapter 3, “Creating Static Graphics Elements.” The rotation turns the rectangle through 360 degrees in a 9-second period, using its upper-left corner as the pivot point. The code for the transformation is shown here:

<animateTransform begin="1s" dur="10s" type="rotate" 
from="0 150 150" to="360 150 150" 
attributeName="transform"/> 

You should be familiar with the meaning of the begin and dur attributes. You must specify the attributeName property (in this case, transform) and the type attribute (in this case, rotate ). Notice that the from attribute contains three values, separated by spaces: 0 150 150. The first number ...

Get Designing SVG Web Graphics now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.