Math Expression help!!! Please!

cwilms's picture

I'm trying to streamline a very complex composition because it's running far to slow and making anything with motion all choppy. I've figured out something I think will make this composition much more efficient but need some help with a math expression to make it work. I openly admit I don't understand the new math expressions patch at all yet and will need to learn it when I'm not in such a time crunch.

What is explained in the following link looks to be exactly what I'd like the math expression to do but it was done in an earlier version of QC. There is no example file to look at either.

http://quartzcomposer.wikispaces.com/SignalToggleStructure "How It Works The counter Increases its count by one, every time it receives a "Toggle" signal (wired to "Increasing Signal"). The math patch then takes the count mod 2. In other words it subtracts 2 until the count is less than 2. Thus the resulting value will be 0 if count was even, and 1 if it was odd. When we count, the numbers go even, odd, even, odd, etc... so as the count increases the resulting value toggles back and forth between 0 and 1."

It looks like it would be fairly simple but I am at a loss for how to do it. I think you would use the fmod() parser correct?

If you can please help I'd appreciate it, I'm really on a deadline for this project now...

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

franz's picture
Re: Math Expression help!!! Please!

the modulus operation is % so number%2 would return 0 or 1

cwilms's picture
Re: Math Expression help!!! Please!

That worked great, thanks!