Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 725711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:22:05+00:00 2026-05-14T06:22:05+00:00

I have a rather interesting issue with SVG animation. I am animating along a

  • 0

I have a rather interesting issue with SVG animation.

I am animating along a circular path using Raphael

obj = canvas.circle(x, y, size);
path = canvas.circlePath(x, y, radius);                
path = canvas.path(path); //generate path from path value string
obj.animateAlong(path, rate, false);

The circlePath method is one I have created myself to generate the circle path in SVG path notation:

Raphael.fn.circlePath = function(x , y, r) {      
  var s = "M" + x + "," + (y-r) + "A"+r+","+r+",0,1,1,"+(x-0.1)+","+(y-r)+" z";   
  return s; 
} 

So far, so good – everything works. I have my object (obj) animating along the circular path.

BUT:

The animation only works if I create the object at the same X, Y coords as the path itself.

If I start the animation from any other coordinates (say, half-way along the path) the object animates in a circle of the correct radius, however it starts the animation from the object X,Y coordinates, rather than along the path as it is displayed visually.

Ideally I would like to be able to stop/start the animation – the same problem occurs on restart. When I stop then restart the animation, it animates in a circle starting from the stopped X,Y.

UPDATE

I created a page that demonstrates the issue:
http://infinity.heroku.com/star_systems/48eff2552eeec9fe56cb9420a2e0fc9a1d3d73fb/demo

Click “start” to start the animation.
When you stop and re-start the animation, it continues from the current circle coords in a circle of the correct dimensions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:22:06+00:00Added an answer on May 14, 2026 at 6:22 am

    The problem is that Raphael has no way of knowing that the circle is already part-way along the path. The “start” function means just that — start an animation. imo it would be broken if it did anything else.

    That said, your use case is a valid one, and might warrant another function — a ‘pause’ of some sort. Of course, getting that into trunk would take longer probably than you want to wait.

    From the Raphael source code, here’s what happens when you call ‘stop’.

    Element[proto].stop = function () {
        animationElements[this.id] && animationElements[length]--;
        delete animationElements[this.id];
        return this;
    };
    

    This decrements the total number of animations, and removes that animation from the list. Here’s what the ‘pause’ function might look like:

    Element[proto].pause = function () {
        animationElements[this.id] && animationElements[length]--;
        this._paused_anim = animationElements[this.id];
        delete animationElements[this.id];
        return this;
    };
    

    this saves the animation to be resumed later. then

    Element[proto].unpause = function () {
        this._paused_anim && (animationElements[this.id]=this._paused_anim);
        ++animationElements[length] == 1 && animation();
        return this;
    };
    

    would unpause. Given scoping conditions, these two functions might need to be injected right into the Raphael source code (it’s core hacking, I know but sometimes there’s no alternative). I would put it right below the “stop” function shown above.

    Try that, and tell me how it goes.

    ====EDIT====

    Ok, so it looks like you’ll have to modify the “start” attribute of animationElements[this.id]… something like:

    this._pause_time = (+new Date) - animationElements[this.id].start;
    

    in the pause, and then

    animationElements[this.id].start = (+new Date) - this._pause_time;
    

    on resume.

    http://github.com/DmitryBaranovskiy/raphael/blob/master/raphael.js#L3064

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a rather interesting problem. I have a parent page that will create
I have a rather interesting question that seems simple to answer, yet I have
Whilst developing a php class i have run into a rather interesting thing within
I have a rather interesting problem, and wondered if it could be done purely
I am using ASP .NET MVC 3 and I have an interesting problem to
I have rather large project that uses ICU regex classes. Basically it might run
Have a rather simple question. Does anyone knows if i can use jparallax both
I have a rather enormous project in which I'm trying to retrofit in-memory data.
I have a rather large SQL file which starts with the byte order marker
I have a rather huge query that is needed in several stored procedures, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.