Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Move nearby objects when an object expands

  • Move nearby objects when an object expands

    Posted by Jimmy Black on September 10, 2015 at 5:19 pm

    Hi – I have a few objects that I would like to interact with one another but never touch, essentially pushing away from each other when one moves. When one object increases in size, the others move accordingly, maintaining the same distance away from each other that they started with.

    Is there some expression that says “Object X always stays 25 pixels away from all other objects”? In my example, each of the 4 shapes will need to expand/contract at some point. See image below.

    Thanks!

    Jimmy Black replied 10 years, 8 months ago 3 Members · 3 Replies
  • 3 Replies
  • Miguel De mendoza

    September 11, 2015 at 10:36 am

    Try this:

    leadPos = thisComp.layer("leadObj").transform.position[1];
    leadSize = thisComp.layer("leadObj").height * (thisComp.layer("leadObj").transform.scale[1]/100);
    selfSize = height *(scale[1]/100);
    offset = 100;
    if(index < thisComp.layer("leadObj").index){
    y = leadPos - leadSize/ 2 - selfSize/2 - offset;
    }
    else{
    y = leadPos + leadSize/ 2+ selfSize/2 + offset;
    }
    [value[0], y];

  • Kalleheikki Kannisto

    September 13, 2015 at 5:00 pm

    Did something very similar here, although the boxes scaled along y-axis only:

    https://forums.creativecow.net/thread/2/1065542

  • Jimmy Black

    September 15, 2015 at 2:19 pm

    Thanks guys! I’ll be able to derive something from the second example. It’s very similar to what I’m trying to do, and I’m only scaling along the y-axis.

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