Recent topics
Recent Comments 
Simple logic: subtract 1 when # is greater than 1Sorry for the really simple question but I'm stuck on something I know many of you could bust out in moments. I'm making a color go back and forth between its "near" complement. Basically, instead of going to its direct complement (+.5 hue) I'm having it change +.4167 so that it can sort of bounce around the color wheel messing with eye fatigue. So basically I'm looking for the right way to subtract 1 when the hue is greater than 1. So as I make gestures the rising sequence should go: .4167, .8333, (1.251)=.25, .667, (1.08341)=.0834, etc. (I didn't include the entire composition as it is huge and will just complicate things). I hope the attached is enough to share. Thanks so much and again, sorry this is really basic.
More like this

here you go gabe. there are a ton of ways to do this. I'm giving you two examples. one with expression and one with patches. alternative you can do this in a java script patch if you want. just copy paste or use conditional multiplex logic or math expressions etc.....
its pretty much just like your wrote;
its sort of like how you would write but ":" means "else" so to predicate this expression or java script it would sort of be like "if number is greater than one subtract one from number else number is the same".
its arbitrary the expression can be
or with chickens and cows....
depending on how your getting your number stream you may have to reset your counter or something. or well a counter is 1 2 3 4 5 you want it floating point so if your using a counter divide by 10 or something so it will 0.1  0.2  0.3  0.4  0.5......N
Cool. Thanks Dust.
Wow dust, talk about overkill :D edit, just noticed your attached file  the expression version is pretty much the same as mine
All you need is the Range patch. Set the range to 0 to 1, and use the 'rolled over' output. It'll loop the value within that range.
Other ways to do it:
Do what dust suggested, but use the math expression patch instead of javascript, it's much simpler. You can use "x  (x > 1 ? 1 : 0)" meaning "x minus (is x over 1? then 1, otherwise 0)". Problem here is that it can fail: if x goes to 2.1 then it'll loop back to 1.1, which is out of your range. After that the number might never go back into the 01 range, breaking your comp.
Alternatively use the math expression, with "fmod(x, 1)". That has the same effect as the range patch, and loops after it passes 1. If x somehow goes to 10.5, it'll loop back to 0.5, so this one should be solid.
Example attached.
Thanks so much for the support. Turns out, my initial math was wrong. Once the input went over 2, subtracting 1 wasn't enough and the hue was locked at red because the input count just kept rising (obviously... or not so obviously to me). Appreciate your various options, learned a lot the final solution was using the Range Patch with the Rolledover value as the output.
Cool thought that would be an easy one to answer gabe. I thought there was something more to the patch. Particularly if your using hue patch who's values I think should be no greater than 1. There's always using the interpolate on external time that will always keep your number in a range as well. Psonice actually helped me figure out that trick one day as I one of my first initial qc questions was how to scale a number in the 1 to 1 range.