I am trying to animate an image along a path in SVG. The object does get animated along the defined path but away from its intended position. I am not able too see as to what's wrong with the code. Hope someone would come to my rescue. Thanks in advance.

<?xml version="1.0" encoding="utf-8"?>
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
     width="300px" height="400px">
<path id="fave" fill="#F57C00" d="M102.539,32.054c-0.107-4.268-3.523-7.711-7.775-7.863c-0.101-0.004-0.199-0.006-0.299-0.006
    <animateMotion  fill="freeze" calcMode="paced" restart="always" additive="replace" dur="0.5s" accumulate="none">
        <mpath  xlink:href="#favepath"></mpath>
<path id="favepath" fill="none" stroke="#000000" stroke-miterlimit="10" d="M64.075,138.9l23.467-85.896"/>

1 Answer 1


If you want it to animate along the path itself you need to change the d of #fave.

It wasn't clear how you wanted to do it, so I changed the initial two values of the Moveto (M) from M102.539,32.054 to M0,0 to get this result which animates it from the right edge. For more information about that attribute, check out this useful article.

You should read some specs on the properties and attributes of the SVG elements you're using so you can better understand what's going on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.