In this After Effects tutorial, we’ll look at a method for creating a dynamic iPad keyboard. You might use this in an app explainer video (like we did), or for UI animation or screen replacements – it’s licensed under a Creative Commons Attribution-ShareAlike 4.0 International License, so you can use it wherever you want (with some restrictions – have a look at the Creative Commons site if you’re unsure).
It works like this: from a text layer which is animated to appear as a slider moves between 0 and 100%, we look up the Unicode value of the most recently-typed letter. This references the position and scale of a shape layer from a series of Javascript objects which hold position and scale value pairs (which we’ve previously worked out by laboriously moving our shape layer around a screenshot of the keyboard, noting down the position and scale it needs to exactly cover each letter in turn). We’ve then got four layers representing each available keyboard layout, screengrabbed from an iPad running iOS 9.3.1, which turn themselves on and off depending on which layout the charater we’re typing is on. (Actually, their opacities flick from 0 to 100 and back again, but the effect is the same.)
Finally, we’re assuming you want to actually marry what’s being typed with some kind of text appearing somewhere, so there’s a copy of the original text layer which is precisely synched up with each keypress as it happens. (The original text layer will be a bit out of step, which is probably to do with some kind of rounding error. If you know why this is, I’d be interested to know!)
We’re assuming you’re already familiar with After Effects concepts like layers, layer properties and expressions. If you’re not, have a play around with these first (videocopilot.net is an excellent place for After Effects tutorials of all kinds).
PS: During the tutorial I’ve used a null with an expression control effect, which uses a slider to store a number that then references a particular layer. This actually isn’t the best way to do it. If you have a bunch of layers which you want to reference depending on where they are (see the After Effects tutorial I did on laying out a grid of logos, which relies on this), then you can create a layer that won’t render (eg an adjustment layer, or a null), and call it something unique, like __START__. Then, to reference a layer after this one, you can use something like this:
L = thisComp.layer("__START__");
i = L.index;
my_index = index - i;
// If the layer this expression is applied to is, say,
// three layers lower in the stack than the __START__
// layer, then my_index will *always* be 3, even if you
// add extra layers above __START__. This means that if
// you're referencing a property that not all layers have
// (the sourceText property of a text layer, for example),
// the expression won't break when you need to add extra
// layers. (I spent quite a few years doing this wrong,
// and having to go back and fix expressions every time.)
To download the After Effects project file, screenshots and Excel spreadsheet (go on, admit it – it’s the spreadsheet you want), follow this link:
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.