ADOBE AFTER EFFECTS: Forum Expressions Tutorials Podcasts Creative Cloud

animating a hinge

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Stefan Haasanimating a hinge
by on Mar 23, 2015 at 6:58:34 pm
Last Edited By Stefan Haas on Mar 23, 2015 at 7:01:38 pm


I´d like to animate a hinge; I did a small sketch to show what I mean exactly. Would be great to have a solution, where I can pull on either end and the rest is moving accordingly. Thanks 4 now

Return to posts index

Joseph W. BourkeRe: animating a hinge
by on Mar 23, 2015 at 7:10:30 pm

I don't see any sketch, but when I think hinge, I think of two sides, with a rotational pin in the middle (like a door hinge). You could create your hinge with two layers in Photoshop, then move the axes to the center, between the two hinges (thinking of the hinge as a 3d layer). In After Effects, if you parent one part to the other, when you move the parent, the child will move with it. And with the axes in the same location for either side, you can rotate your "3D" hinge like a real one.

Joe Bourke
Owner/Creative Director
Bourke Media

Return to posts index

Bernd RottenbuchRe: animating a hinge
by on Mar 23, 2015 at 9:55:14 pm

thanks joseph, attaching this to make it a bit clearer what my problem is

Return to posts index

Kevin CampRe: animating a hinge
by on Mar 23, 2015 at 10:54:20 pm

an ik rig might work for what you are asking. dan ebberts's has a good tutorial/writeup about how to set that up using expressions in after effects:

if you are using creative cloud 2014, you can use the new sourceRectAtTime() function with shape layers to create something similar, but you would need to control it with the rotation property of one of the shape layers, rather than the position of an end point. setting that up is pretty straight forward...

select the shape tool and set it to rectangular and create the first hinge panel by drawing a skinny vertical rectangle. to make things a little more simple, twirl down the layer properties to contents>rectangle 1>transform:rectangle 1>position and set it to 0,0 to center it on the screen (**important, you want to use the contents>rectangle>transform position not the layer>transform properties).

now duplicate the shape layer and move the duplicate bellow the first shape layer and add the following expressions to that she layer:

expression for layer>contents>rectangle 1>transform:rectangle 1>position:
target = thisComp.layer(index-1);
rTarget = target.sourceRectAtTime(t = time, includeExtents = false);
r = sourceRectAtTime(t = time, includeExtents = false);
value + [r.width/2 + rTarget.width/2 + target.content("Rectangle 1").transform.position[0], 0]

expression for layer>contents>rectangle 1>transform:rectangle 1>rotation
target = thisComp.layer(index-1);
-target.content("Rectangle 1").transform.rotation

if you adjust the first shape layer's contents>rectangle 1>transform:rectangle 1>rotation property (**again not the layer>transform>rotation property), the second layer should hinge outward like it is connected to the first.

at this point i'd parent the second shape layer to the first (it will make it easier to move them around). and then you can simply duplicate the second shape layer for as many hinged panels as you need and they should expand and contract like an accordion as you change that tranform:rectangle 1>rotation property of the first layer.

Kevin Camp
Art Director

Return to posts index

Bernd RottenbuchRe: animating a hinge
by on Mar 25, 2015 at 2:16:00 pm

thank u very much kevin

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2016 All Rights Reserved