I have 10 years’ experience as 2D animator, using Adobe Animate and Toon Boom Harmony. I taught myself how to write scripts, so don’t expect them to be/look very professional… they do what they’re supposed to do, and I’m happy with it :)

I do make bespoke scripts/tools for Toon Boom Harmony, so let me know if I can help you.

email: contact@toonboomscripts.com


  1. Hi,
    I’ve seen this being developed in other programs like Anime Studio Pro, Flash, and now After Effects, where scripts or expressions have been written to attach substitute drawings to controls in a rig. Anime Studio Pro has Smart Bones, you pull the bone/lever one way and substitute drawings are visible with each degree, giving the character the appearance of turning. Recently I saw this video of the animators of the Angry Birds Toons creating this sort of rig in After Effects:

    Is this possible to do in Harmony? Has anyone wrote a script that can do this? I don’t have experience scripting in Harmony, but I imagine it would mean making an arrow, and when that arrow moves it triggers the substitute drawings to play, or making these objects move across a masked/cutter object.

    1. This could be possible if the expressions in Toon Boom allowed some control over drawings… but as far as I know the expressions can only be used to control positions/scale values (x,y,z,rotation, skew).

      1. Hi! I’m educating myself with toon boom scripting at the moment. Maybe this thing could be done with regular drawings, not substitutes, hiding one with scale (x=0) and reveal another with the same method. Maybe it could work? I’ve played around with after effects

        Also I’m interested if there is anybody else in the world figuring the same stuff at the same moment. Maybe have a skype meeting, produce a clear problem and try to solve it together.

        At the moment I’m trying to figure out how to make a simple switch for blinks.

  2. Hi, I have a question about expressions. I would like Peg B to follow Peg A, then once Peg A goes beyond a certain point like 5, Peg B will go in the opposite direction.

    Given that:
    var pegValue = column(“PegA_Pos_x”);

    I tried to follow up with an if/else statement:
    if (pegValue >= “-5.0” && pegValue <= "5.0" ){
    } else {

    I thought this would make it so that Peg A's position within the range of -5 to 5 would make Peg B follow it, and then outside of that range go in the opposite direction.

    Instead, it just makes Peg B go in the opposite direction at all times.
    Can you help me out?

    1. Oh, I noticed also that you should have written :
      if (value(pegValue) >= -5.0 && value(pegValue) <= 5.0 )

      The variable 'pegValue' is only holding the name of the function, not its value.

  3. Hi William.I have a question.
    Is it possible to link an expression to a layer’s drawing value? It seems it’s impossible.

    If it’s not possible, could it be possible to link a layer’s rotation (say, in chunks of 90 degrees) to another layers value?

    (Example, if layer A rotation is somewhere between 0 and 90 degrees, make layer B port index value 0, if layer A rotation is greater than 90 degrees, make layer B port index 1)


    1. Hi, as far as I know it’s not possible to change drawings through expression – sadly. I’m not sure I understood what you mean by changing port index value… is it the port index value in the image switch node? It may be possible to link an expression to this value.

      1. Hi William, thanks for the answer. What I meant for Port Index is, for example, in the Image Switch module. The value that the switch takes.

        (What I tried to do is have the switch animated by another layer that is a little bit more graphical than just going to the timeline or the Node View and changing the Port Index Value by hand. In my case, I thought of a drawing layer that acted sort of like a gizmo for poses. You’d be able to select this layer and by changing the drawing value (that would have something like “FRONT” “3/4” “BACK” written on each drawing) change the Switch value.)

    2. You’ll have to write an expression like this:

      var peg = column(“whatever_peg”);

      if(value(peg) 90 && value(peg)< 180){

      * For some reason WordPress is not accepting my full comment.

  4. Hey man! Really cool site, apritiate what you’re doing here. I wanted to ask where you got started in scripting for tb? I want to learn but have no idea were to start. I dont even know if what I want to do is possible, I want to create a script than flips the frames as i draw if i hold a button. There is a feture in tvpaint that does it and it would be great to hsve that in tb.

    Ok thanks for your hard work man!

    1. Hi! Thank you! I first started writing jsfl scripts for Flash, but the sintax is very similar to the one used in ToonBoom. Toon Boom’s script language is just like Javascript, I learned the basics of it just enough to write the script I needed and I keep learning new things as I try to write new scripts.

      About your question.. to this moment I haven’t found a way to create a keyboard shortcut for a script, but you can create a button for it. When you say ‘flip’ you mean to ‘flip the image horizontally’ or as ‘flipping the animation pages’? To flip a single drawing horizontally, there is a button you can place in the camera view or drawing view. Hmm.. and I just found out that you can change the camera x scale to -1 and it will flip your whole camera view (you could put an extra peg above the camera module just for flipping). To switch from one drawing to the next/previous you could use Toon Boom’s default shortcut “F” and “G”.

      I hope this helps. Cheers!

      *I’m using Harmony 12.2

      1. Thank you for answering! Oh ok, ive dabbled in javascript and experienced in c#. Is there any kind of directory/guide of the different “words” used?

        I meant flipping through the animation like with the f and g keys. Now i have no idea how powerful the toonboom scripts are so what i want to do might not even be possible.
        If youve tried tvpaint there is a neat function that allowes you to draw a stroke and flip through frames at the same time creating kind of a realtime animation of the stroke.
        The idea was to do something like start a timer when you hold a key and put the pen down and then jump one frame forward every .1 sec or something. Ive only done game programming not software so have no idea what units to use ahah

        So it is a longshot but i would want to get into toonboom scripting regardless.
        Thanks again!

      1. Hi! That’s ok, and thank you for all of the help and your very informative site. In the latest Harmony Premium, you can sync 2 or more layers so that if you change the drawing substitution in one layer, the other synced layer will also change the drawing substitution.

        I was wondering if a script could be written to do that in Harmony 10, and how somebody would go about it?

  5. I don’t think it is possible to control drawing exposures with scripts/expressions. Maybe you could get the same result using timing columns and using it for more than one drawing. But I’m not sure if Harmony 10 had this feature.

    1. var nod = selection.selectedNode(0);
      var headNod = selection.selectedNode(1);
      var pasteCol = new Array();
      var startFrame = 1;
      var endFrame = frame.numberOf();

      var col = node.linkedColumn(nod,”DRAWING.ELEMENT”);

      if (headNod == “”){
      MessageLog.trace(“Pushing to head”);
      headNod = nod.substr(0,nod.lastIndexOf(“/”)+1)+”Head”;

      for (i = startFrame; i <= endFrame; i++){
      var fr = column.getEntry(col, 1, i);

      if (node.getName(headNod) != ""){
      var columnId = node.linkedColumn(headNod,"DRAWING.ELEMENT");
      var headCol = column.getDisplayName(columnId);
      MessageLog.trace(headCol + " Exists");
      for (i = 1; i <= pasteCol.length-1; i++){
      MessageLog.trace(column.setEntry(columnId, 1, i, pasteCol[i-1]));
      MessageBox.information("Cannot find \"" + headNod + "\", please check naming");

      – or something similar perhaps?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s