2

Progress bar for nighttime/darkness duration

I'm using the formula for the progress bar (level time) formula:

$if(ai(isday)=1,100/tf(ai(sunset)-ai(sunrise),S)*tf(ai(sunset),S),if(df(hh)>12,100/tf(ai(nsunrise)-ai(sunset),S)*tf(ai(nsunrise),S),morning))$

However I'm struggling to adapt it to nightime... Any ideas? 

5 replies

Good that you find a solution😃👍. I put this formula too, because no many users know that they can set the Min and the Max of a Progress Bar with formulas or codes, and don't need to divide and multiply by 100 every formula.👍👌

·

Thanks a lot for your help. 👍

Hi I think that the most simple way to make this is using the light and the darkness in minutes ,and make the progress with the minutes to the Sunset and Sunrise. 

With this in mind,I think this codes can work.

You need to create a progress bar, Custom, and put this :

Min -0

Máx

$if(ai(isday)=0 , tf(ai(sunrise, a1d) - ai(sunset), M),tf(ai(sunset) - ai(sunrise),M))$

Level 

$if(ai(isday)=0,tf(ai(nsunrise), M),tf(ai(sunset), M))$ 

Section- 100

This are going to put in the Max the time of light and darkness, the level are moving by the time remaining to sunrise and sunset, because this is in reverse, you can adapt the progress bar by rotating it or playing with the colors.👍

·

Thank you for your reply. 

Meanwhile I've been using the below formula successfully, for the level value. . With min 0 and max 100 along with hidden the layer during daylight and seems working well. 

$100 / (ai(nsunrise) - ai(nsunset, r1d)) * (dp(a0d) - ai(nsunset, r1d))$

I'm using the previous formula to see the progress bar of the sun.

However trying to obtain a same progress bar, but for the nighttime ONLY. So the bar will progress sincedsundown until the sunrise.

The issue is that if I try to reverse thw formula I get negative numbers ... 

Basically what I'm asking is anyone can re-engineer this formula to get a night time until sunrise in the form of 0 to 100? 

If you can explain a bit what you want to see in the progress, in day and night, is best to try to help with this. You can create a Custom progress bar to see the progress of the light to  darkness, but what you want is important to help.