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.