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

  • Home
  • SEARCH
  • 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 8326463
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T00:46:15+00:00 2026-06-09T00:46:15+00:00

This problem has driven me nuts and I’m looking for insight into best way

  • 0

This problem has driven me nuts and I’m looking for insight into best way to solve this problem.

I have a div $(“.sun”) that I want to move along the circumference of an ellipse, which I’ve generated with Raphael.js, so that the ellipse is as wide as the screen and horizontally centered, and as tall as half of the width, and is absolutely positioned at 0,0 (top left):

//draw ellipse that is as wide as the window and half as tall as the width
var paper = Raphael(document.getElementById("ellipse"), Wwidth, halfIt);
var c = paper.ellipse(Wwidth/2, halfIt/2, Wwidth/2, halfIt/2);
c.attr({'fill': 'transparent', 'stroke': 'red'});

jsfiddle here (changed values in jsfiddle for demo)

The ellipse is a stylized representation of the path a celestial body travels in the sky. This means that at 6am, the sun is at the far left side of the screen at the ellipse’s major axis. At 12noon the sun would be at the top center of the screen, and at 6pm the sun is on the far right of the ellipse’s major axis.

Put in terms of degrees, 6AM = 180 degrees, 12 noon = 90 degrees, 3PM = 45 degrees, and so on. Essentially, each hour between 6am and 6pm is separated by 15 degrees. Add in a calculation for the minutes:

var hours = new Date().getHours();
(removed code that converts the numerical hour to my stylized degrees for brevity)
var mins = new Date().getMinutes();     
var minsdegree = mins * .25;    
var skyangle = hourdegree + minsdegree;

So for example, if it were 11:39AM, skyangle would equal 114.75 degrees.

The Challenge:
How can I animate the sun along the path of the ellipse such that it corresponds to my custom angle depending on the time. Technically, I don’t need it to “animate” so much as simply correspond to the correct angle upon page load. However, it would be neat to have it animate along the path, if you kept the page open long enough.

  • 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-09T00:46:16+00:00Added an answer on June 9, 2026 at 12:46 am

    Here you go: http://jsfiddle.net/y47Cr/54/

    updates every second.

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

Sidebar

Related Questions

This problem has driven me crazy, it's been 5 days I'm trying to solve
This problem has bugged me so many times and i have now decided to
This problem has driven me mad for over a day now. I can create
I have a legacy (solve this problem for us issue) app that communicates with
this problem has driven me crazy and I really need you guys help. I
This problem has been bugging me for a long time. For example, the code
This problem has happened to me twice.Both times during programming with Borland C++.when i
This problem has been solved! Thanks a lot to Brad, Denis and junkie! You're
Premise This problem has a known solution (shown below actually), I'm just wondering if
EDIT: This problem has been solved. See below. Hey all. I'm building an iPhone

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.