Jump to content

Trick for making an effect do something every x frames in Harmony

Recommended Posts

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. 🙂




Share this post

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By Jason
      I've recently updated my github repo with a new tool to make it easier to do breakdowns - check it out and enjoy! 🙂

    • By Jason
      I’m working on a script to blend between two values and for some reason I keep ending up with a number that doesn’t make any sense.
      It looks something like:
      var a = 1.00; var b = 0.0113; var sum = a+b;  
      the result is 1.00.0113;
      Shouldn’t I be getting 1.0113?
    • By Jason
      View File NC_CreateNote.js
      This script takes adding a Note layer to harmony from a multi-step process to a single button click!
      The script will:
      Automatically create a drawing layer called Note (or Notes_# if there's more than one) Colors the drawing layer so it stands out from the other layers in your scene Connects the notes layer to the top of your comp stack. Automatically switches you to the pencil tool so you can start drawing immediately.  
      NC_CreateNote.mp4 Submitter Jason Submitted 11/21/2018 Category Harmony  
    • By Jason
      I've put together a github repo that contains all the scripts I've written for ToonBoom Harmony - so you can get them all in a single place. 
      I'll keep posting them here as well, but if you're interested in helping out, making them better, or just pulling them all at once, feel free to grab them here!
  • Create New...