Copy link to clipboard
Copied
At first, my question was how to rotate the anchor point so that the z-axis faced the correct direction to hinge this folder face to be in the position below it. I read about creating a null layer and parenting to that. Honestly, that proved to be quite tedious (and unsuccessful), but also I wasn't able to set up the null positioning before parenting the layer without it then repositioning the child. (Both issues are shown below in the video.)
Then I thought that maybe I was going about this the wrong way, and that I should redraw the folders head on, rotate it from the head on perspective, then use a camera to show the 45° angle. Is this the correct way to appoach this? If so, I have two questions.
If this isn't the best method, is it possible to achieve this animation, of the folder hinging open, while maintaining the stroke with? Are there any other tricks or techniques? Thank you
I oversimplified things without thinking about it very much. The solution I gave kind of works with straight lines but fails to take into account the perspective changes, and I failed to remember that the start and end tangents are parented to the vertices when you use the extended version of the Create Nulls from Paths script. It's going to take some more complicated math to get this to work with curved lines. Instead of simply using an L.toWorld([0, 0, 0]) function to attach a 2D point to a la
...Copy link to clipboard
Copied
The folders you want to flip down must be drawn square to the camera. If you rotate in Y and then rotate in X, you will get weird motion along the X axis. Instead, change the Y orientation to put the illustration at an angle to the Acgive Camera the same way you would orient a folder on a real set. Then rotate in X to make the folder lie down.
3D layers are going to have perspective. To make the lines appear to have the same width, all you need to do is add a camera with a long lens to reduce the perspective shift. Perspective (vanishing point lines) is controlled by distance from the camera or camera position, framing is controlled by focal length. Try a 100 to 200-mm lens.
If you want the lines to appear to have the same thickness as the folder rotates toward the camera, you will have to turn on the C4D rendering engine and extrude the lines to the same depth as the thickness of the lines.
The only other option would be to keep the layer 2D and use the Create Nulls from Paths script from the Window Menu to create a null for each point on the math using the Points Follow Nulls button. Then, create a set of duplicate nulls and shift parent each one to the appropriate null created by the script to snap them to the same 2D position. Next, remove the parenting, and make all of your rotate nulls 3D.
You will have to use Create Nulls From Paths Extended if you want curves and also attach nulls to each vertex. With straight lines, the comp looks like this.
I have arranged the 3D nulls below each of the nulls created by the script and added this simple expression to convert 3D space to 2D space for the nulls controlling the path.
L = thisComp.layer(index+1);
L.toComp([0, 0, 0])
The expression just looks at the layer 3D layer below it and converts 3D space to comp space.
I have uploaded an After Effects 2023 project file for you to fiddle with.
Copy link to clipboard
Copied
Thank you so much for your thorough response. I redrew the folders and created nulls using the Points Follow Nulls from the Extended version.
Would you mind sharing a quick gif on how to duplicate the nulls? And then I shift-parenting each duplicate to its corresponding null created by the 'Create Nulls... Extended'? Do I add the position expression to each scripted-null once shift-parented, and then removed? Honestly, a quick gif of those last steps would help immensely. I apologize for my ignorance, but I feel I'm almost there there thanks to you.
Copy link to clipboard
Copied
I oversimplified things without thinking about it very much. The solution I gave kind of works with straight lines but fails to take into account the perspective changes, and I failed to remember that the start and end tangents are parented to the vertices when you use the extended version of the Create Nulls from Paths script. It's going to take some more complicated math to get this to work with curved lines. Instead of simply using an L.toWorld([0, 0, 0]) function to attach a 2D point to a layer's 3D space, I'm going to need to calculate the distance from and the angle to the camera to adjust the position of the points for accurate 3D. I will then also need to calculate the change in position of the in and out handles based on the relationship between the path points and the 3D nulls they are following. The math is going to take some research, and I don't have time for that now. Maybe Dan Ebberts, one of the best expressions and scripting men in the world, will see this post and provide a quicker solution for the expressions.
As far as the workflow to generate your 3D nulls for the Points with no curves, try this:
Selecting a label group and changing colors is done by right-clicking on the layer label.
You now have an orthographic 3D representation of a moving 3D layer. Orthographic means no perspective.
If I figure out how to compensate for the camera and give you perspective, or better yet, figure out how to fix the curves problems with the start and end handles generated by Create Nulls From Paths Extended, I'll post the solution and probably create a tutorial.
The expression for this workflow:
L = thisComp.layer(index -1);
L.toWorld([0, 0, 0]);
Here's what the workflow looks like:
I hope this helps a bit.
Copy link to clipboard
Copied
It does help immensely. Thank you so much for taking the time, Rick.
Copy link to clipboard
Copied
Curious why my folder isn't hinging correctly. Any ideas? Thanks again for all of your help.
Copy link to clipboard
Copied
It looks like your folder path is scaled and the nulls are not lined up with the verticies. Can you share the AEP file?
Copy link to clipboard
Copied
Copy link to clipboard
Copied
I found a solution that works from this forum post: https://community.adobe.com/t5/after-effects-discussions/create-nulls-from-paths-position-is-way-off....
It seems to be a bug that has to do with originally working in AI, despite creating shapes from layers in AE. This script did the trick: https://www.pablocuello.com/scripts/
Thanks again for all your help, Rick!
Copy link to clipboard
Copied
I wish I had known you were working with shape layers created from vector paths. You did not need a script. All you needed to do was select the Right Front layer, press the U key twice to reveal all modified properties, reset the Transform/Group 1/Position, the Anchor Point, and the Position values, and then use the Create Nulls from Paths/Points Follow Nulls script, and your nulls would like up with the path points perfectly.
Because of the bezier curves in the vector files, you're going to get some distortion when the path is rotated, but everything should line up just fine.
This was my complete workflow. No scripts are needed.
If I get some time, I'll try to work out the fix for the Bezier handles that you can apply to the nulls attached to the Handle Controls
so the lines don't get distorted in X when the Rotator is moved.