Re: animateMotion - specifying a start position along a path that is not the beginning of the path

On Sat, 11 Dec 2010 00:38:09 +0100, Ryan Arnold <ryan.arnold@gmail.com>  
wrote:

> Hello,
>
> Erik Dahlström asked me to email this mailing list regarding a
> potential deficiency with animateMotion.
>
> I'm tinkering with a train engine + couplings + cars following a track
> (path) demo:
>
> http://rsasandbox.appspot.com/anim.svg
>
> This appears to do what I want but there's a gross hack in it.  It
> abuses animateMotions's begin="" feature to add new cars and couplings
> to the path behind the engine after the previous engine or car has
> passed by the start of the path.
>
> This hack is not programmatically scalable.  Changing the
> animateMotion duration to 10s, for example, will result in incorrectly
> spaced cars.  I can't even figure out how to determine the begin=""
> values for each element.  In my current example they were specified
> manually.
>
> What I want is to be able to programatically place cars on the path
> one after the other and then have them all begin their animated motion
> at the same time.  It'd be nice if negative offsets worked with closed
> paths.

Negative offsets used to be disallowed in startOffset, but are valid in  
1.1F2, see [1]. However, the textPath layout rules [2] says to not render  
characters whose midpoint-on-the-path are off either end of the path, so  
all glyphs that are before the accumulated distance-along-the-path reaches  
0 will not be seen.

It's quite possible the use-cases are different for the animateMotion  
element though.

> I also want to be able to start the chain of cars' motion at an
> arbitrary place on the track.  There doesn't seem to be a way to do
> this.  I notice that textpath has a startOffset.  Is there a reason
> something like this couldn't work for paths?

No, there's no real reason there couldn't be a startOffset attribute on  
animateMotion that worked in a similar (if not exactly the same) way to  
textPath+startOffset. In your example it would make sense to just shift  
the path to the startOffset, and if startOffset was positive let the  
animation run the [0..startOffset] part of the path when the path reached  
the end, and conversely for a negative startOffset. The convinience would  
be to not have to specify multiple paths, or use the begin-time or  
keyTimes to position the shapes along the path.

Cheers
/Erik

[1]  
http://www.w3.org/TR/SVG11/text.html#TextPathElementStartOffsetAttribute
[2] http://www.w3.org/TR/SVG11/text.html#TextpathLayoutRules

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

Received on Monday, 13 December 2010 09:40:50 UTC