SVG Some learning references

Source: Internet
Author: User

Http://www.cnblogs.com/pingfan1990/p/4757934.html

Http://www.cnblogs.com/duanhuajian/archive/2013/07/31/3227410.html

http://www.zhangxinxu.com/wordpress/2014/08/so-powerful-svg-smil-animation/

Animatetransform the point in the upper-left corner of the SVG rotate to the element center point

Instance code:

<svg width= "400" height= "400" >    <rect x= "0" y= "0" fill= "green" rx= "4" width= "200" height= "200" >    <animateTransform attributeName= "transform" type= "rotate" form= "0" to= "360" begin= "0" dur= "5s" repeatCount= "indefinite" /></rect> </svg>

Example of the above code we let the 200x200 square element, do the rotation movement, but in SVG inside the rotate rotation for the point is the upper left corner of SVG. We want to do something about the center point of the element.

The usual solution:

<svg width= "400" height= "400" >    <g transform= "translate(200,200)" >      <rect x= "-100" y= "-100" fill= "green" rx= "4" width= "200" height= "200" >        <animateTransform attributeName= "transform" type= "rotate" form= "0" to= "360" begin= "0" dur= "5s" repeatCount= "indefinite" /></rect>    <g> </svg>We added a combo label <g transform= "Translate (200,200)" ></g> to move the coordinates starting point of the SVG to the center point of the container (the SVG placeholder position remains unchanged). Then the element is drawn from the new starting point, and the rotation is possible.

SVG Some learning references

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.