Search the Community
Showing results for tags 'expressions'.
Found 1 result
I was playing around with some noise effects to try and get this sort of noisy look and wanted the edges to update every 2 frames. I was using the following expression: currentFrame % 2 + currentFrame This ends up looking like this in the x-sheet: As you can see, it just increases the value every other frame. But I thought.. what if I want to make this go every 3 frames, because on 2's it's a bit too noisy? Not being a math wiz, I tried this: currentFrame % 3 + currentFrame; But of course that didn't work. I ended up with: which isn't at all what I wanted. And it makes sense... currentFrame %3 returns 1, 2, 0, 1, 2, 0, 1, 2, 0... What I really wanted was 0, 0, 0, 1, 1, 1, 0, 0, 0. So I thought about it a bit.. and came up with a cool way to do this. This code works so you can really use ANY number of frames. It's probably not the most mathematically efficient way, but hey, it's readable! holdFrames = 2; currentFrame - ( currentFrame-1)%(holdFrames); And you can see the results here.. we can go crazy with it! just change the holdFrames and it'll work perfectly.