ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Using a slider to turn video and audio On or Off

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Seth Vlach
Using a slider to turn video and audio On or Off
on Jan 4, 2019 at 11:52:55 pm

I'm trying to use a slider to select a video layer from many different video layers within a Comp and make only that one visible and audible.

This is building off of this tut where Ukramedia uses Essential Graphics' Master Properties to easily customize logos and lower thirds. I want to do the same thing but with video:





I'm able to change the opacity of video clips by sticking this in every video layer's opacity property:

main = thisComp.layer("Null 1").index;
pos = thisComp.layer("Null 1").effect("Position")("Slider");
if(pos == index-main) { 100 } else { 0 };


BUT it doesn't work for audio..

I changed the if/ else statement values to:

if(pos == index-main) {0} else {-100};


and put it in the layer's Audio Levels only to get the error 'expression result must be of dimension 2, not 1'

Cool, Audio Levels is 2 dimensional (left and right audio channels).

if(pos == index-main) {0,0} else {-100, -100};


Same error message.

I've scoured the internet and adobe's expression guide but every piece of information about audio in After Effects is about making layers react to audio.

How can I get the audio to mute when the layer is at 0% opacity and to be audible when the layer is at 100% opacity?

Thanks!

main = thisComp.layer("Null 1").index;
pos = thisComp.layer("Null 1").effect("Position")("Slider");
if(pos == index-main) { 0,0 } else { -100, -100 };


Return to posts index

Dan Ebberts
Re: Using a slider to turn video and audio On or Off
on Jan 5, 2019 at 12:36:46 am

Multi-dimension property values need to be formatted as arrays, so try this as your last line:

if(pos == index-main) { [0,0] } else { [-92,-92] };


Dan



Return to posts index

Dan Ebberts
Re: Using a slider to turn video and audio On or Off
on Jan 5, 2019 at 12:39:51 am

Sorry, that last value should have been [-192,-192].

Dan



Return to posts index


Seth Vlach
Re: Using a slider to turn video and audio On or Off
on Jan 5, 2019 at 12:50:27 am

Works like a charm! Thank you so much


Return to posts index

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