Custom KBar Icons for After Effects (pt. 2)

UPDATE: I wrote a newer article on School of Motion about this topic.


If you haven't read the original post you can find it here. You can download all the icons and project file here.

I chose to use colors based on Google's Material Design.

I chose to use colors based on Google's Material Design.

I have added some more functions to my KBar and, of course, had to make some more icons.

Below, I'll go through the new icons and give some description on how each button works.

Parametric converter

This is another script from Kyle Martinez. It's called Parametric Converter. This allows you to convert a square shape path into a parametric rectangle, or a circular bezier path into a parametric circle, thus giving you more options than you normally have with a regular bezier path (ie; size). IMPORTANT: To use these with KBar you should use his standalone scripts found on his website.

PC Circle.png

Time reverse keyframes

This is simple. It just makes this function possible in a single click instead of using the 'right click' drop down menu. Just set the button to invoke menu item "3693".

Reverse Keyframes.png

Time Expression

This is just to apply the time expression to any layer attribute (ie; time*5)

Time.png

Stereo Fade

I've created an animation preset for quickly creating a fade on an audio track. It applies "stereo mixer" to a layer and then sets keyframes on both R and L channels to go from 100 to 0. The reason I use Stereo Mixer is because it gives a much better fade than if you keyframe Audio Levels. But it's a little tedious because you have to keyframe both chanels, so I made a preset. Here is the icon to go along with it.


Remove expressions (Updated April 25 2018)

Thanks to John Colombo I've finally got a great scriptlet for quickly removing all expressions from layers. It can be tedious to option click every single property, and I wish I could just do it in one click. This script will do that. It removes them from all selected layers and if you have none selected then it removes all of them within the comp. Super slick!

 (function removeExpressions(){

    var comp = getActiveComp();

    

    if (comp) {

        

    app.beginUndoGroup("Remove All Expressions");

    

    forAllSelectedLayersElseAll(comp, function (layer){

        removeAllExpressions(layer);

    });

    

    app.endUndoGroup();

    

    } else {

        alert("Please select a composition.");

    }

      

    function removeAllExpressions(propParent)

    {

      if (propParent)

      {

         var prop;

         for (var i=1; i<=propParent.numProperties; i++)

         {

            prop = propParent.property(i);

            switch (prop.propertyType)

            {

               case PropertyType.PROPERTY:

                  // do action

                   if (prop.canSetExpression && prop.expression) prop.expression = "";

                  break;

               case PropertyType.INDEXED_GROUP:

                  removeAllExpressions(prop);

                  break;

               case PropertyType.NAMED_GROUP:

                  removeAllExpressions(prop);

                  break;

               default:

                  break;

            }

         }

      }

    }

    

    function isComp (item) {

        return item instanceof CompItem;

    }

    

    function getActiveComp () {

        var thisComp = app.project.activeItem;

        if (thisComp === null || !(isComp(thisComp))){

            alert("Please select a composition!");

            return null;

        }

        return thisComp;

    }

    

    function forAllSelectedLayersElseAll (thisComp, doSomething) {

        if (thisComp.selectedLayers.length === 0)

            if (confirm ("You are about to remove all expressions in the active composition.\nAre you sure you want to continue?", false, "Expression Annihilation Imminent!")) {

                forAllLayersOfComp(thisComp, doSomething);

            } else {

                return;

            }

            

        else

            forAllItemsInArray(thisComp.selectedLayers, doSomething);

    }

    function forAllItemsInArray (itemArray, doSomething) {

        for (var i = 0, il = itemArray.length; i < il; i++){

            var thisItem = itemArray[i];

            doSomething(thisItem);

        }

    }

    

    function forAllLayersOfComp (thisComp, doSomething) {

        for (var i = 1, il = thisComp.layers.length; i <= il; i++){

            var thisLayer = thisComp.layers[i];

            doSomething(thisLayer);

        }

    }

})();


Center Composition

This is another one from Kyle Martinez. I don't use it terribly often, honestly, but I'm sure many people do. I have a habit of moving my comp around with spacebar (as I do is just about every other Adobe program). But sometimes it's nice to just click a button and have it snap to the center of the comp window. OCD with your workspace? This one's for you.

Custom KBar icons for After Effects (pt. 1)

UPDATE: I wrote a newer article on School of Motion about this topic.


This post is geared towards After Effects users. If you are familiar with scripts and expressions, then read on. If not, you might want to check out SOM's Expressions 101 and I'm sure there are great sources out there to learn about scripts as well.

I recently picked up the KBar script for After Effects (technically it's an extension). I really like it! It's a lot like ft_toolbar, but I hadn't gotten around to purchasing toolbar yet, so I was interested in either one. I decided to go with the newer of the two and purchased KBar while it was still on sale. KBar has the option to use your own PNG or SVG files for the buttons, so I got excited and a bit carried away and designed some icons for myself.

I chose to use colors based on Google's Material Design.

I chose to use colors based on Google's Material Design.

I have a couple functions that I love to use with KBar, so I wanted to share the icons I designed for them. You can obviously get away with not using icons, but I'm a visual person and I like designing things. You can download the icons here if you are interested.

Below, I'll go through the icons and give some description on how each button works.

Explode Shape Layers

This requires the script ESL to work, but basically, I just have it run that .jsx file when I click it. It's the same as using the normal ESL UI, but this way I can have a button for it and can clear up a bit of space on my screen.


Separate Dimensions

I'm separating x & y for position constantly. It's nice to have a quick button for it. A good thing to note is that if you "alt click" it will relink the dimensions. The script itself is from Kyle Martinez. He also has more awesome tools here.

try {
app.beginUndoGroup("Separate Dimensions");
var altKey = ScriptUI.environment.keyboardState.altKey;
var toggle = (altKey === true) ? false : true;
var comp = app.project.activeItem;
var layers = comp.selectedLayers;
if (layers.length > 0) {
for (var i = 0; i < layers.length; i++) {
layers[i].transform.position.dimensionsSeparated = toggle;
layers[i].selected = false;
}
}
} catch(err) {
alert(err);
} finally {
app.endUndoGroup();
}
Separate XY.png

Loop Out

LoopOut is a very common expression and I use it pretty often. Instead of having to type it out or copy/paste it, I decided to make some buttons for it.

loopOut("continue")

loopOut("continue")

loopOut("cycle")

loopOut("cycle")

loopOut("pingpong")

loopOut("pingpong")


Wiggle

Wiggle is another common expression. I typically just have a default of "wiggle(10,5)" but you can make it anything. I don't know if the design works well or not, but I loved the idea of using a car dealership guy for it. Those things are hilarious.

Wiggle.png

Maintain Scale

This is a technique I got from J.R. Canest and it's not as frequently used, but it's awesome. If you have a bunch of objects parented to the same null you can add the maintain scale expression to the scale of each of the child layers and they will expand outward without growing in size. Magic!

s = [];
ps = parent.transform.scale.value;
for (i = 0; i < ps.length; i++){
s[i] = value[i]*100/ps[i];
}
s

Squash & stretch

This is a technique I got from Joey Korenman at School of Motion. (I can't remember where I saw the tutorial, but if I find a link I'll add it in.) Basically what you can do is add a slider control to a layer (ie, a circle) and then you apply this expression to the scale property of the layer.

ssAmt=(effect("SS Value")("Slider")+100)/100;

if (ssAmt==0) {

[transform.scale[0],transform.scale[1]];

} else {

xs=transform.scale[0]*ssAmt;

ys=transform.scale[1]/ssAmt;

[xs,ys];

}

Make sure the name of the slider control matches what is in the expression (in this case it's "SS Value"). Now you can animate a nice squash and stretch with a single slider.