Andreas Neumann wrote:
> You could use <animateMotion /> to "animate" your symbol to 50% (using
> discreet values) and set fill "freeze" to make the symbol stay there.
> The advantage of this approach is that the symbol can be rotated
> automatically.

Very smart!

> See http://www.w3.org/TR/SVG11/animate.html#AnimateMotionElement or
> http://www.carto.net/papers/svg/samples/path_animation.shtml
> 
> The other alternative would be to use javascript. The methods
> .getTotalLength() and .getPointAtLength() help you to find the
> position at 50% of the path. The tricky part is to find the
> orientation: for finding that you would have to read the path geometry
> itself ...

I was about to write, after looking back at the example path, that since 
it is made only of straight lines, it should not be so hard to compute 
total length and then to iterate to find the middle.
My initial answer was about generic paths, with Bézier and all.

Now, your solution is much easier, using the viewer to do the hard 
computations...

As for the orientation, I think one could take the point at half way 
less 1% (or 0.1%) and the one at half way plus 1% (or 0.1%, to adjust to 
find which work best, that depends also on the complexity of the curve, 
ie. on the number of vertexes).
Draw a line between these two points, it gives (a good approximation of) 
the needed orientation vector.

> As Philippe said, there is no easy solution for that.

Joining minds is a powerful way of finding solutions! :-D

> Andreas
> 
> 
> --- In svg-developers@yahoogroups.com, raghu raman <[EMAIL PROTECTED]>
> wrote:
>> I need to draw a arrow head in middle of the given path. 
>> <path d="M 212747656,-190398966 L 212721062,-190451692 L
> 212437743,-190301694 L 212430133,-190282952 L 212258060,-190192589"/>
>> Kindly let me know your solutions

-- 
Philippe Lhoste
--  (near) Paris -- France
--  http://Phi.Lho.free.fr
--  For servers mangling my From and Reply-To fields,
--  please send private answers to PhiLho(a)GMX.net
--  --  --  --  --  --  --  --  --  --  --  --  --  --


-----
To unsubscribe send a message to: [EMAIL PROTECTED]
-or-
visit http://groups.yahoo.com/group/svg-developers and click "edit my 
membership"
---- 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/svg-developers/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Reply via email to