Skip to search.
svg-developers · SVG Developers

Group Information

  • Members: 5539
  • Category: Data Formats
  • Founded: Aug 16, 1999
  • Language: English
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Messages

  Messages Help
Advanced
animVal of an object moving along a motion path   Message List  
Reply Message #61804 of 65684 |
Re: [svg-developers] animVal of an object moving along a motion path

On Fri, 23 Jan 2009 17:37:06 +0100, tim.becker80 <timothee.becker@...>
wrote:

> Dear all,
> I'm trying to get the x - y values of an object moving along a motion
> path (SMIL animate...). I'm trying it using animVal. I get a negative
> result. Although the method works for simple animations, it seems it
> does not work for anim along a path...
> Is there a way of making it work?
> Below, find some code I adapted from one of Doug's examples.
> Try clicking the moving objects!

You aren't animating the cx and cy attributes, but rather you are using a
motionpath.

To calculate a position you will have to use a combination of the following:

- getCurrentTime and getStartTime[1]
- getTotalLength and getPointAtLength[2]

Also you'll have to use an mpath element to point at a path element since the
animateMotion element doesn't have a DOM interface for accessing the path
directly.

Hope this helps
/Erik

[1] http://www.w3.org/TR/SVG11/animate.html#InterfaceSVGAnimationElement
[2] http://www.w3.org/TR/SVG11/paths.html#InterfaceSVGPathElement

--
Erik Dahlstrom, Core Technology Developer, Opera Software
Co-Chair, W3C SVG Working Group
Personal blog: http://my.opera.com/macdev_ed





Mon Jan 26, 2009 8:44 am

erida539
Offline Offline
Send Email Send Email

Message #61804 of 65684 |
Expand Messages Author Sort by Date

Dear all, I'm trying to get the x - y values of an object moving along a motion path (SMIL animate...). I'm trying it using animVal. I get a negative result....
tim.becker80 Offline Send Email Jan 23, 2009
4:37 pm
Erik Dahlström
erida539 Offline Send Email
Jan 26, 2009
8:27 am

... You aren't animating the cx and cy attributes, but rather you are using a motionpath. To calculate a position you will have to use a combination of the...
Erik Dahlström
erida539 Offline Send Email
Jan 26, 2009
8:42 am

You could try retrieving the transformation matrix, which is appended due to the animateMotion, from element.transform.animVal which is an SVGTransformList....
Frank Bruder
redurbf Offline Send Email
Jan 29, 2009
2:04 am

... The spec only says that animateMotion adds a supplemental transformation to the target element CTM. Since 'rotate' also provides a supplemental rotation it...
Erik Dahlström
erida539 Offline Send Email
Jan 29, 2009
8:32 am

... DOM, or would it be easier to just be able to access the current point-on-the-path where the object is placed at a given time t? For me, "just be able to...
tim.becker80 Offline Send Email Jan 29, 2009
7:25 pm
Advanced

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help