W3C home > Mailing lists > Public > www-svg@w3.org > October 2010

Re: Accessing the animated position of an SVG element

From: Erik Dahlstrom <ed@opera.com>
Date: Wed, 27 Oct 2010 16:47:04 +0200
To: www-svg@w3.org
Message-ID: <op.vk8oonwvgeuyw5@localhost>
On Wed, 20 Oct 2010 05:47:38 +0200, Shane Stephens <shans@google.com>  
wrote:

> I have the following fragment of SVG:
>
> <svg>
>   <g transform="translate(300,30)">
>     <rect width="40" height="40"/>
>     <animateMotion dur="1s" repeatCount="1" rotate="auto" path="M
> 100,250 C 100,50 400,50 500,250"/>
>   </g>
> </svg>
>
> I want to access the animated position of the rect using javascript,
> but I can't figure out how to do it.  The transform, x and y values on
> rect are SVGAnimated values, but the rect is not directly animated.
> The transform on <g> is also an SVGAnimated value, but the animVal
> only ever contains the result of translate(300,30). rect.getCTM() and
> g.getCTM() seem to return the base value only (i.e. not the animated
> value).  Is there something I'm missing?
>
> Cheers,
>     -Shane

This is just to tag this thread as related to ISSUE-2204 [1].

The particular issue with animateMotion and access to the computed  
position / rotation has been discussed before on the svg-developers list  
(links are available in the issue).

Cheers
/Erik

[1] http://www.w3.org/Graphics/SVG/WG/track/issues/2204

-- 
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed
Received on Wednesday, 27 October 2010 14:47:45 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:46 GMT