Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert var time = new Date().getTime() * 0.0002 into client time #1

Open
5ervant opened this issue Apr 3, 2019 · 2 comments
Open

Comments

@5ervant
Copy link

5ervant commented Apr 3, 2019

How do you convert var time = new Date().getTime() * 0.0002 into client time?
I've tried the following but have no luck:

const d = new Date();
const time = `${d.getHours()}.${d.getMinutes()}`;
@dirkk0
Copy link
Owner

dirkk0 commented Apr 4, 2019

I assume you want to change the code so that the sun is in sync with your local time?

One way to do this would be to calculate the percentage of daytime and sync that with the sun:
https://codepen.io/dirkk0/pen/OGNyJP
But of course this depends on where you are - the codepen would be on the equator (i.e. no shadows on high noon).

@5ervant
Copy link
Author

5ervant commented Apr 16, 2019

I assume you want to change the code so that the sun is in sync with your local time?

Yes, you're right!

Thanks for the help but upon observing since implementing that, like for example, right now it's already 11 PM here but the scene is pretty bright, it looks not matching a client time, you can view your codepen sample. And also almost all shadows are now gone every time I check my work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants