FORUMS: list search recent posts

Expression Referencing pre-expression value of another layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Sean McClintock
Expression Referencing pre-expression value of another layer
on May 3, 2013 at 4:24:32 pm

Hello,

I have some expressions set up to aid the animating of a wave pattern. Everything was working until I went to add some functionality to control the offset of the wave. Since each bar is using the other bar's position property and the valueAtTime function to determine it's position I'm trying to control each layers anchor point to achieve this. The problem I'm running into is that when I adjust this property it starts to break down. At around the 12 or 13 bar in the chain the successive bars stop reading the post expression value and instead read the reference layer's original value (set to 20 in the example file). Any idea why this might be happening? If it helps on using CS5 on a PC.

Here's that file:
https://dl.dropboxusercontent.com/u/1881942/ReferenceError.aep


If you adjust r_1's anchor point y value you can see it break. Even have a simple text layer that you can see is directly linked to the layer's y value where it stops working and it display's 20 instead of the value you can see results after it's expression.

c = thisComp.layer("// Controller").effect("Columns")("Slider");
n = Math.floor(name.slice(2));

if ( n &lt;= c){

startLeft = thisComp.layer("// Controller").effect("Start From Left")("Checkbox");
startRight = thisComp.layer("// Controller").effect("Start From Right")("Checkbox");
startMiddle = thisComp.layer("// Controller").effect("Start From Middle")("Checkbox");
startOutside = thisComp.layer("// Controller").effect("Start From Outside")("Checkbox");

startTop = thisComp.layer("// Controller").effect("Start From Top")("Checkbox");

delay = thisComp.layer("// Controller").effect("Delay")("Slider")

startPos = 1;

if ( startLeft > 0 ) startPos = 1;
if ( startRight > 0 ) startPos = 2;
if ( startMiddle > 0 ) startPos = 3;
if ( startOutside > 0 ) startPos = 4;



//n= 1

leader = false;

targetName = "Not Set";

if ( startPos ==1 ) {
// Left
if(n==1) {
leader = true;
targetName = "Position Ref";
}else{
targetName = "r_" + (n-1);
}

} else if ( startPos == 2) {
// Right
if(n==c) {
leader = true;
targetName = "Position Ref";
}else{
targetName = "r_" +(n+1);
}

} else if ( startPos == 3) {
// Middle
if(n==Math.ceil(c/2)) {
leader = true;
targetName = "Position Ref";
}else{
leaderNum = Math.ceil(c/2);
if ( n &lt; leaderNum ) {
targetName = "r_" + (n+1);
} else {
targetName = "r_" + (n-1);
}
}

}else if ( startPos == 4) {
// Outside

if(n==1 || n==c) {
leader = true;
targetName = "Position Ref";
}else{
middleNum =Math.ceil(c/2);

if ( n >= middleNum ) {
targetName = "r_" + (n+1);
} else {
targetName = "r_" + (n-1);
}
}
}


target = thisComp.layer(targetName);

tarY = Math.round(target.transform.yPosition.valueAtTime(time-delay)*100)/100;

if (targetName == "Position Ref"){
if (startTop > 0 ) {
tarY = linear(tarY, 0, 1080, -1080, 0);
}else{

tarY = linear(tarY, 0, 1080, 1080, 0);
}

}

}





Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]