Impossible Geometry in After Effects - Shape Layer Animation Tutorial

Motion graphics
5 followers
4 Video Views·Apr 21, 2026
In this after effects tutorial, I break down my process for using shape layers to create animated impossible geometry in Adobe After Effects. This tutorial is suitable for beginners - intermediate users. Please leave a comment if you'd like me to explain anything I skimmed over.
…
Hi I'm Ben Marriott. I make weekly motion design and animation tutorials and today I'm going to
talk through how to animate that impossible triangle all from 2D shapes in After Effects.
Let's begin. First of all I created the shape in Illustrator after tracing over some reference
photos and all three components were duplicates of the same shape that I just rotated 120 degrees
because it was important that they all lined up exactly otherwise we'd run into a lot of
trouble in the animation. I imported that file into After Effects by selecting file import finding
it and importing it as composition retain layer sizes and let's name that triangle main. So in
this triangle main layer I'm going to duplicate triangle three with ctrl d bring that up to the
top and I'm going to right click that create shapes from vector layers and that just turns
this layer into a shape that I can edit with my pen tool here. I'm also going to print on these
layers below and just call them triangle ref and lower the transparency on that so I can just use
that as a reference layer. Although our background looks black here if we toggle our transparency
grid you can see that it's all transparent and it's only this shape here that is fully opaque.
I'm also going to change this color shape fill to a nice bright pink so we can clearly tell
the difference between it and the background and let's rename this shape segment one because we
always label our layers. Now I want our current segment one to transform into this next shape
which is the gray section of our triangle that we've got here. So let's toggle down in our panel
down here our contents our group our path and now let's keyframe the path here and about 20 frames
in we want it to be transformed into this next shape. I think it's useful here to only focus on
one section of this animation at a time because thinking about the actual physics of this shape
would get quite painful after a while. We're just going to take this sort of bottom sort of area
here and imagine we're working with just a rectangular prism that would be rotating along
one axis sort of like a rotisserie chicken. So our outside edge here is going to stay in the same
place and our inside edge here is going to sort of drift closer and sort of disappear as this sort
of edge is going to start turning away and facing away from us. So let's move these points of this
shape layer to get roughly where we want. Let's roughly take a look. There we are that's kind of
like what we want it's not perfect but let's do the other sections and come back to tweak the
details later. So it's good to throw down some rough keyframes to quickly tell whether the overall
animation will work rather than spending time to get it perfect and then figuring out that it won't
later on. And it's very tempting because that's the fun part with all the glory of getting the timing
and the easings of every keyframes to be exact. But it's good practice to get comfortable with
your animation looking a bit crap for a while before it starts looking good. So this next side
here is going to go up and fill this position of this longer edge here. So let's drag these keyframes
up here and take a look what we've got. Now we've run into a problem here where if we want to move
this sort of point on our shape layer it's going to drag up our shape and sort of cross paths here
and it's going to mess up the animation that we've got down below. Watch that. That's not what we want
but the way we can fix that is if we add another keyframe here and then drag that down here to act
as that corner point. Now if we watch that back that's kind of getting there. Let's actually move
this keyframe a lot closer. It's going far too slow. Much better. Let's zoom in here. All right
that's looking pretty close. Now we need to animate this side here that needs to come into existence
from nothing and fill up this shape. Because this bottom side here leaves the frame this one has to
sort of come into existence. So we're going to do that by adding another shape down to the shape
layer. So let's zoom in real close and I'm just going to draw the shape by clicking four times
and creating a little quadrilateral here. It's got a stroke on it which we don't want so I'm
just going to alt click our stroke until there's no stroke on there and let's adjust these points
so they line up our reference layer. All right and let's keyframe that shape's path and then
at the very beginning of the animation we want this to be reduced to nothing so we're going to
move those anchor points down here so it gets very very small and then nothing at all. There
that's in a good place for a rough. Now let's go in and tweak the positions of these points just
so they all line up and we don't get any of these jagged stepping motions in between the animation.
All right that's great. All right let's trim this shape layer down to our keyframe here by pressing
alt right square bracket dragging it to the very last frame and we're going to just pre-comp this
by pressing ctrl shift c. I'm going to call this try segment. I'm pre-comping this because this
will be a base building block for animation so if we need to make any adjustments to it later
having it in a single pre-comp will make it a lot easier than adjusting lots of shape layers
throughout the animation. We may not need to but just in case it's good to have. Now I'm going to
duplicate this twice with a ctrl or command d and I'm going to drag them into a sequence so they
play one after each other. There we are. We want the second composition to continue our animation
from its previous position so I'm going to rotate this at minus 120 degrees so I'm going to press
r to bring up a rotation and type in minus 120 and now I'm going to move it to line it up with
a bit of a tiny jump as we cut between them but we can nudge this shape a little bit with our
arrow tools into position and get that to line up a little smoother. There that's much better
and now our third one we're going to rotate this one to minus 240 degrees. All right now I've got
a nice looking loop here. I did try while I was making this trying to move the anchor point of
this composition into the exact center of the triangle so I wouldn't have to nudge and adjust
it so much but nothing really worked. Reposition anchor point tools and plugins won't work because
the center of an equilateral triangle is not the center of the bounding box that the shape makes
so going out of the old-fashioned way like our granddads used to with the arrow keys and elbow
grease was the most effective way that I found. Please let me know in the comments if you can
find another solution rather than just this constant nudging. Now let's pre-comp all of
these with ctrl shift c and call them tri-segment dash looped. Now let's duplicate that two more
times with ctrl d. Now let's rotate these and fill in the rest of the triangle. I'm gonna rotate this
first one minus 120 degrees again, drag that into place and rotate this top one minus 240, place
that there and do some good old-fashioned nudging to get them roughly into place. If we play that
back we can see uh nothing happening we can see a few of the gaps appearing inside our triangle
so let's address that but first we're going to add a fill effect to these shapes. I'm going to type in
fill up here, select the fill tool and I'm going to select a color palette I made previously in
illustrator up here in our project window and I'm just going to eyedrop some colors from that.
I'm going to change our background color as well from black to this nice yellow. Now let's play
back and look what glory we've created. All right okay now in this second rotation you can see
our shapes aren't quite properly aligned and we get this yellow line which is a visible background
in between these shapes and then on our third one we've got a little gap here as well so to adjust
that we could go into our composition and nudge this section a little to the left or a little to
the top but we're kind of flying blind and when we go back into our comp we can't really see
how much of what we've adjusted has made a difference. Now a great way to see both at the
same time is with this top comp open I'm going to toggle viewer lock up here which means this
comp will always be visible in this window and then if I click inside into this precomp it opens
up my precomp in a timeline in a composition window up here but we've still got our triangle
main option up here as well so we can simply drag that out to our right here and now we can see both
comps at the same time. So now we can move elements of this composition here and see how
it affects the top compositions that it's nested in so if we go and drag this wildly you can see
how it affects the top comp here so let's undo those so let's nudge this to get all these lines
to line up here so let's start just to the right a touch and we're kind of closing this gap here
as we do that then we're also opening up this gap so let's nudge that to the left down up I'm just
sort of trying random keys until it kind of lines up I don't want to go too far because then it's
going to open up other gaps in other places so I'm going to get it to where it's as close as I
think it can get now it does look like there's going to be some slight gaps here regardless
so one thing we can do is in this comp at each of these layers I'm going to add the effect
simple choker and set the check map to minus one which will just slightly expand the shape
I'm just going to copy that to both of these layers as well and that just means that each one
is going to be like one pixel thicker essentially and that will cover up any sort of gaps and errors
that we've got in this comp here now let's unlink this comp here and let's close one of them and
let's go back into our triangle main comp now if we play it back that loops nicely let me know down
in the comments if looping animations are something you'd like to learn more about and some more
techniques I have for how to get things to loop seamlessly now one thing that I'm noticing while
looking back at this loop is that the corners still don't feel quite right to me it it looks
as though this shape is kind of just filling in the shape that this one left by rather than actually
rotating so we can go in and edit that and we can go in by just going in and nesting down into our
original pre-comp here and this is exactly the reason why we pre-comp this in the first place
so we can make adjustments to this one pre-comp and it will affect all the others I think it's
this anchor point here or this point in our shape tool it sort of just remains in this one position
throughout the whole animation I think over here at the beginning it needs to line up with this
shape here so let's zoom right in and it's going to be difficult to grab the right shape because
we've got two points on top of one another so let's give one a go and let's hope that was the
right one looks like it was all right good and let's drag that over I'm going to hold shift as
I pull it across too so it doesn't vary on any other axis except the horizontal one and I'm going
to try to line it up to where this sort of point meets here let's play that back okay that's looking
it's looking all right I think now we can just tab back up and see what it looks like in the
main animation all right I think that's looking better but one thing that I'm not quite sure
now one thing I don't like the look of is this rest of the triangle here that point should be
pulling down as well so let's go in and adjust that too and that's this corner point so let's we
want to drag this anchor point over to the right as we get to the end here there we are that's
looking much better and that's looking more like a natural rotation even though it's a weird
impossible shape and that adds some more flavor to this animation let's make this whole shape rotate
so to do that I'm going to create a new null object layer new null let's rename that null
and we want to place that in the middle of this equilateral triangle now we can eyeball it where
the roughly the middle will be and that would probably be fine but if you do want to get a lot
closer what we can do is grab our ellipse tool draw a circle and let's take the circle's transparency
down because we're just going to use this as a guide and place that roughly in the middle I'm
going to reduce its scale because I just want it to nudge the edges here and with that in the middle
ctrl r to bring our rulers up and we're going to drag a ruler until it lines up with these
dots here and those dots here and now we can see that the center of this triangle is a little bit
more to the top here so we'll move that null in there in the middle and delete the shape layer
let's select our tri-segments loops parent those to the null object with the pick whip
I'm going to press r on our keyboard and on the first frame keyframe the rotation and then at
the end here let's keyframe it one full rotation and let's play that back now that's going way too
fast but we still want a full rotation so it loops seamlessly so we're going to extend our
tri-segment looped comps so let's select into our tri-segment loop comps press ctrl k to bring up
our composition settings and let's just double the duration to 4 seconds 24 zoom out and let's
we can just duplicate all these layers with ctrl d all of these comps rather and then slide this
over into a sequence so essentially that comp is just looping twice let's go back into our
top layer and let's drag this rotation keyframe over and now our rotation should happen twice as
slow you notice it does get a lot closer to the bottom of the composition than the top of the
composition up here so we can just nudge that up adjust that so it feels reasonably centered
now i've got three textures that i want to add to this animation to give it a bit more bit more
flavor so they're in my assets folder textures and we've got dimples cardboard which we're going to
drag down to the bottom and we're going to make this our background layer and i'm going to add a
curves effect to increase the contrast to make it really black and white there we go and i'm going
to add a tint effect so i can remap the black and white values and i'm going to use our palette for
that so now our white is mapped to this yellow and our black is mapped to this blue color now
the texture is going a bit too far that's a bit too hectic so let's right click dimple cardboard
go to time time stretch and we'll change it from 100 to 200 and now that plays back a nice bit
slower let's drop our light texture on top as well this is the texture that i always use and
i'm going to change its mode to screen and that just gives us these white little speckles that
will pop up throughout our composition and one more which is this tarmac texture here
i'm going to scale that down and i'm going to use the set matte effect to matte out one of the areas
of the triangle so we're going to take the matte from layer let's say number four now at the moment
our matte isn't really working at all and what we need to do is click this thing down here which
will continuously rasterize our tarmac dash and we also need to have that selected for our triangles
as well so now we'll line up now we've got the wrong triangle selected so let's select another
one that's the one we want and let's recolor that with the tint effect as well and let's parent this
comp to this rotation null as well so it'll move with that triangle and one last thing is i'm going
to create a new adjustment layer control y and add the posterize time effect and change the frame
rate down to 12 this will make the whole thing animate in 12 frames per second now it'll look a
lot choppier than we're used to seeing and this is just a personal stylistic choice i love things
being animated on twos especially when i've got so much texture and it just makes things look
a little less sort of you know super digital and computery which is really pronounced when you've
got this sort of impossible morphing shape here so it looks a lot smoother without this effect
but i really dig the choppiness here you can download this project file down in the description
if you use any techniques you've learned in this video in your own work please tag me on instagram
at at ben underscore mary underscore so i can check out your work i can't wait to see it please
let me know down in the comments what else you'd like to see from this channel if you enjoyed this
video please consider subscribing and don't forget to hit that bell icon like share and
check out this playlist of related videos i'll see you in the next one
