Mailing List AE-List@media-motion.tv — Message #51623
From: Dan Ebberts <debberts@comcast.net>
Subject: Re: [AE] expressions: parent/move layer based on proximity?
Date: Thu, 14 Nov 2013 16:14:30 -0800
To: After Effects Mail List <AE-List@media-motion.tv>
I think your combo expression simplifies to something like this:
 
p1=thisLayer.position;
p2=thisComp.layer("drag me").position;
distance=length(p1,p2);
n = linear(distance, 0, 40,20, 0);
value + (p2 - p2.valueAtTime(0))*n
 
But I don’t think it’s going to behave the way you want, based on your link.
 
Dan
 
Sent: Thursday, November 14, 2013 3:41 PM
Subject: [AE] expressions: parent/move layer based on proximity?
 
I'm trying to merge two expressions i've found, one that 'parents' a layer's position to a master layer, and another that modulates a value based on proximity. My goal is to have a master layer 'smear' the position of child layers depending on how close they are. Sort of like the way this AI tool works.
I believe the problem is in the syntax of the last three lines where I try to combine the proximity value to the parenting.
I get: ERROR: Class property has no method named value
Any ideas what I'm doing wrong?
 
// get proximity //
// Point1 is current layer, point2 is control layer
point1=this_layer.position;
point2=this_comp.layer("drag me").position;
// Find the vector between the 2 points
delta=sub(point1, point2);
// Now find the length
distance=length(delta);
//Use linear() to remap distance to range of 40 to 0
n = linear(distance, 0, 40,20, 0);

// parenting //
myParent = thisComp.layer("drag me");
myProp = myParent.transform.position;

// combine proximity and parenting //
x = transform.position[0] + (myProp[0].value - myProp[0].valueAtTime(0) * n);
y = transform.position[1] + (myProp[1].value - myProp[1].valueAtTime(0) * n);
[x,y]


 
 
Subscribe (FEED) Subscribe (DIGEST) Subscribe (INDEX) Unsubscribe Mail to ListMaster