-
Finding the remainder of a division sum
I’m needing to get the remainder of a division sum.
I have a slider which has the values of 1 to 365 (DAYS_YEAR) and I need to cycle something that takes 29 days to cycle (MOON_PHASE) but using that DAYS_YEAR as its driver.
I have figured out that if I divide my DAYS_YEAR driver by the MOON_PHASE
(DAYS_YEAR)/(MOON_PHASE)
I get a result which all I need is the ‘remainder figure’ (the underlined figure beneath)
e.g.
(DAYS_YEAR) / (MOON/PHASE) (MOON_ROT)
……….1…………………..29…………..=………….0.0344827586206897
……….28………………….29…………..=………….0.9655172413793103
……….29………………….29…………..=………….1 (doh!)
……….30………………….29…………..=………….1.03448275862069… the remainder that I take from that I use as a percentage to drive the MOON_PHASE rotation…
If I can get that remainder figure then it would be
360*MOON_ROT
to give me the degrees it goes round
I searched through the forums and have found one of the hallowed Mr Ebbert’s posts on the %
https://forums.creativecow.net/readpost/227/7858
but I’m struggling to make it all work.
I has thought that I could use the % function but I’m getting rather bold single integers
((thisComp.layer(“DAYS_YEAR_DRIVER”).effect(“DAYS_YEAR”)(“Value/Offset/Random Max”))%thisComp.layer(“MOON_PHASE”).effect(“MOON_PHASE”)(“Slider”))
Where
DAYS_YEAR_DRIVER is a layer with the date as a single integer value
and
MOON_PHASE = 29as always, many thanks in advance for taking a look!!