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 9236215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:14:17+00:00 2026-06-18T07:14:17+00:00

I am trying to create a solar sistem in jQuery. I have 5 image

  • 0

I am trying to create a solar sistem in jQuery. I have 5 image planets that move on an ellipse path. When a planet reach the start point it should start again. I can’t make a while because there are 5 planets that must be moved and the browser will be blocked. I must call the function once again after a time (like 8 sec to make a cicle). The planets move slow after a period of time (a few minutes). There is a better way to do this ?

$(window).load(function() {
    solar(10, 1, "#i1", getDim($("#i1")));
    solar(200, 1, "#i2", getDim($("#i2")));
    solar(400, 1, "#i3", getDim($("#i3")));
    solar(400, 0, "#i4", getDim($("#i4")));
    solar(200, 0, "#i5", getDim($("#i5")));
});

function solar(start, dir, id, dim) {
    var nr = 0;
    var i = start;
    while (nr != 2) {
        if (dir == 1) {
            i += step;
            if (Math.abs(i - 2*aa) < step) 
                dir = 1- dir;
        } else {
            i -= step;
            if (Math.abs(i) < step) 
                dir = 1- dir;
        }
        if (Math.abs(i - start) < step) {
            nr++;
        }
        p = getElipsePoint(p, dim);
        $(id).animate(
            {"left": p.x, "top": p.y}, 
            { duration:1 }
        );
    }   
    window.setTimeout(function() { solar(start, dir, id, dim) }, 8000);
 }
  • 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-06-18T07:14:18+00:00Added an answer on June 18, 2026 at 7:14 am

    You can determine when the animation has finished using a callback. Something like this:

    $(id).animate(
                {"left": p.x, "top": p.y}, 
                { duration:1 }, function () { console.log("Begin animation again"); }
            );
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a solar system in WebGL. However i have no
I have the following problem: I'm trying to create a solar system in OpenGL
Trying to create a background-image slideshow and am getting this error... This is the
I'm trying create this function such that if any key besides any of the
I am trying create the image enlargement effect when you hover your mouse over
I'm trying to create a custom deployer in Tridion 2011 SP1 that can index
I'm trying create a gui using Tkinter that grabs a username and password and
I trying create empty white image with php, this s my code $bg =
I'm trying create an intermediate object to work with elsewhere that I can pass
I'm currently trying create a service that will return results of a OLAP cube

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.