O'Reilly logo

Designing SVG Web Graphics by Andrew H. Watt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required