ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Opacity change with multiple layer markers

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Naoko Hara
Opacity change with multiple layer markers
on Jan 30, 2019 at 9:48:59 pm
Last Edited By Naoko Hara on Jan 30, 2019 at 9:49:44 pm

I want to trigger multiple (two in this case) opacity changes via layer markers on a single layer.

I used below to trigger one opacity change.
if (marker.numKeys > 0 && time >= marker.key(1).time){
thisComp.layer("N_Op_text").transform.opacity.valueAtTime(time-(marker.key(1).time));
}
else{value}

The expression looking at a null layer with opacity change. "N_Op_text" makes the opacity go from 100 to 50%.
If I want to manipulate this exp so it would be able to trigger another opacity animation (eg. it will look at a different null layer named "N_Op_out" that makes the layer go from whatever current value is to zero), how would I do that?

THANKS

if (marker.numKeys > 0 && time >= marker.key(1).time){
thisComp.layer("N_Op_text").transform.opacity.valueAtTime(time-(marker.key(1).time));
}
else{value}


Return to posts index

Kalleheikki Kannisto
Re: Opacity change with multiple layer markers
on Feb 3, 2019 at 12:58:17 pm
Last Edited By Kalleheikki Kannisto on Feb 3, 2019 at 1:01:31 pm

You could do it like this, if you need it to go to 0. If you need it to match the opacity of another layer, replace the "0" by pick-whipping the opacity of that other layer.

if (marker.numKeys > 1 ){
if (time >= marker.key(1).time){
thisComp.layer("N_Op_text").transform.opacity.valueAtTime(time-(marker.key(1).time));
if (marker.numKeys == 2 && time >= marker.key(2).time){0};
}else{value}
}else{value}


(Will only work properly if you have two markers on the layer.)

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

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