The scenario is that I animate a null that have several other layers linked (with expression) to it. And then those individual layers reaches a certain Y-value I want to "kill" them by setting the opacity to 0. But I want to do that on the frame after they reach this value. And it seems like the valueAtTime only works in scripts and not in expressions. Sooo... I thought that I just bounce a "control value" in a slider or so to get the behavior I want. Should be an easy thing but no matter how I do it I can get it to work. So starting to think that there is something funny going on here that I don't know about.
This is the first expression I tried:
Code: Select all
//Variables
//At what yposition do we "kill" the layer?
ykill = 410;
opacityBounce = effect("Opacity Fix Bounce")(1).value;
//opacityBounce = Math.floor(opacityBounce);
//variable for storing the Y-position of the layer
ypos = transform.position[1];
//If we have reached the killframe or are outside the frame
if( (ypos <= ykill) || (ypos > 600) ){
if(opacityBounce < 2){
effect("Opacity Fix Bounce")(1).value = 2;
}
else if (opacityBounce == 2){
effect("Opacity Fix Bounce")(1).value = 3;
}
}
//Text visible
else{
effect("Opacity Fix Bounce")(1).value = 1;
}
Soo... After slamming my head to the desk a couple of hours and trying variations of that expression i tried something like:
Code: Select all
//Variables
//At what yposition do we "kill" the layer?
ykill = 410;
opacityBounce = effect("Opacity Fix Bounce")(1).value;
//variable for storing the Y-position of the layer
ypos = transform.position[1];
//If we have reached the killframe or are outside the frame
if( ( (ypos <= ykill) || (ypos > 600) ) && (opacityBounce = 1) ){
effect("Opacity Fix Bounce")(1).value = 2;
}
else if( ( (ypos <= ykill) || (ypos > 600) ) && (opacityBounce = 2) ){
effect("Opacity Fix Bounce")(1).value = 3;
}
//Text visible
else{
effect("Opacity Fix Bounce")(1).value = 1;
}
Code: Select all
if(opacityBounce = 2){
Code: Select all
if(opacityBounce == 2){
Or is there an easier way to from Expressions set a "valueAtTime"...?