Sunlitt/SunKit

Sun azimuth at current time

E-Lizzy opened this issue · 7 comments

Hello,

thank you for your awesome work.

As the sun moves from sunrise to sunset in a given location you provide the azimuth of the sun on sunrise and sunset.
I have a question: is it possible to have the data of the current position of the sun. For example if it is 10h30 to see the position of the sun on the map between sunrise and sunset, and if the time evolves you see the sun on a map moving?

is this possible?

Hello there! We are glad that you like SunKit.

Current sun data is already present in your Sun object. For instance, you can check the current sun azimuth by simply accessing Sun's azimuth parameter. You can set the desired time of the day using setDate(_ newDate: Date) and azimuth will be updated to match the newly set date.

I hope I helped you.

how do you convert sun.azimuth to the current time? It is not clear to me

You first set the time using the setDate method. The method will then update the azimuth value automatically.

Is it possible to provide an example ? It would be appreciated

Oh course, you can find it in the README file.

Thank you very much for your help. I succeeded :-)

You're welcome!