Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to make animated molecule(ball & stick) model

  • How to make animated molecule(ball & stick) model

    Posted by John Baum on March 21, 2007 at 9:38 pm

    I’m trying to make an animated molecule model, you know the tinker toy type made of balls connected by sticks. I don’t want it to look 3d, just move in 3d. So the balls can be circles auto oriented toward the camera, parented to a null which they orbit around. That part is easy enough and look correct.

    The problem is getting the “sticks” to move correctly so they look like they are connecting the balls. Can’t figure out a parent child combo that will work so I thought it may be doable with an expression.

    When it comes to expressions I can sort of follow along if someone explains how one works, but creating one from scratch is pretty much impossible for me.

    Can this be done simply? Any suggestions?
    Thanks for any help

    John Baum replied 19 years, 1 month ago 3 Members · 9 Replies
  • 9 Replies
  • Filip Vandueren

    March 21, 2007 at 10:43 pm

    Try the solution from this thread and let us know if you run into any problems:

    https://forums.creativecow.net/readpost/227/7111?pview=t#head

  • Mike Clasby

    March 22, 2007 at 1:46 am

    I think this oldie but goodie does what you want:

    Expressions Without the Math by Doug Bassett

    https://www.creativecow.net/articles/bassett_doug/connections/index.html

  • Mike Clasby

    March 22, 2007 at 5:23 am

    Methinks the Bassett tut is easier, but… it doesn’t work when you parent the Molecules to a Null, the children lose their position to the parent.

    Since you’re parenting the Molecules to a Null you need to get the toWorld position of the Molecule layers ( the “object” layers in the tut, the children to the null). So in the Basset tut, when you pickwhip the Starting Point and Ending Point (this for the layer “connect 4 to 1”) to the Object’s position you get an expression:

    thisComp.layer(“object 4”).position

    and

    thisComp.layer(“object 1”).position

    But making them children messes things up, so you need to add these expressions to the Beam’s Starting Point and Ending Point:

    L = thisComp.layer(“object 4”);
    L.toWorld(L.anchorPoint);

    L = thisComp.layer(“object 1”);
    L.toWorld(L.anchorPoint);

    This is just to get their absolute position in 3D space.

    Also, I’d just change both Starting Thickness and Ending Thickness of the beam to 10 (or whatever, just both the same), so that your sticks are of a uniform thickness.

  • John Baum

    March 22, 2007 at 2:28 pm

    Does the fact I am trying to do this in AE’s 3d space change anything? Because when I pickwhip the start point of the beam to the position of a molecule I get this:

    temp = thisComp.layer(“center molecule”).transform.position;
    [temp[0], temp[1]]

    And I understand what you are saying about the parenting to the null means the position values of the molecules aren’t going to give me the numbers I need, but since what I have looks so different then the examples you gave I’m not sure of the proper syntax to make the correction you suggested.

  • John Baum

    March 22, 2007 at 4:35 pm

    Well I went ahead and pasted your code in anyway and it sort of works.
    I have the molecules as solids with a circle mask and set to auto orient to the camera.
    While the stick definitely tracks the molecule it is not staying connected.
    I think I may be expecting too much here..trying to get a 3d look from 2d planes. Things look good from some angles but alot of the time the illusion gets broken.

  • Mike Clasby

    March 22, 2007 at 9:42 pm

    What are your molecules? Small solids with a circular mask?

  • John Baum

    March 23, 2007 at 12:28 am

    Yes.
    One thing that i found that helped maintain the illusion is to back the camera waaaaaaaaaaaaaayyy back and then zoom in. Since I had auto orient on I noticed in a top view they were all at different angles till I did this.

    Now it actually look good as a silhouette, not sure if it will ever be convincing when the various parts are different colors.

  • Mike Clasby

    March 23, 2007 at 5:01 am

    You know, I think it might just be that I was using solids for my Beam connectors, your sticks, that are comp size (as per the tut), and maybe you need bigger solids if the movement of your molecules is larger than the comp dimensions. So try resizing the solid layers with the Beam to bigger than the farthest spread of the molecules. Worth a try.

  • John Baum

    March 23, 2007 at 1:39 pm

    It seems to have been a combination of the comp size issue and the auto orient as I mentioned earlier. I used the grow bounds effect to fix the composition size problem.
    The part there seems no getting around though is when the sticks track to the back of a molecule they jump, since its only a 2d circle.

    So I altered my design idea and am using the shape as a silhouette. Looks perfect this way.
    Oh, and thanks for the help.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy