ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

using an expression on a slider to control visibility of layers inside a precomp

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
alex uragallo
using an expression on a slider to control visibility of layers inside a precomp
on Sep 21, 2017 at 10:57:22 am

Hello

I'm very new to writing expressions. I have a project where I have over 100 pictures that need to animate in. To save time and incase the client changes their mind i wanted to use an expression to turn on and off each layer via opacity.
The heirachy is as follows,
--Main Comp - Contains Precomp B and an adjustment layer with a slider attached
--- Precomp B - Contains Precomp A which has been animated in this comp
-----Precomp A - Contains All the images.

My plan was to use the slider 0-100 numbers to select which picture i would like to see, so basically use the slider as a selector which i can animate

I cant seem to find much online about it and would love any help anyone has to offer!

cheers


Return to posts index

Scott McGee
Re: using an expression on a slider to control visibility of layers inside a precomp
on Sep 21, 2017 at 11:29:03 am

Precomp A - Inside Precomp A, set all images to 1 frame each
Main Comp - Add Null object, doesn't really matter what you add, but a Null is invisible. Then add a slider to the Null.
Precomp B - Add time Remap to Precomp A, with the following expression below.

sliderPos = comp("Main Comp").layer("Null").effect("Slider Control")("Slider");
framesToTime((Math.round(sliderPos)))


I'm going based off memory at the moment, but that should work for you.


Return to posts index

alex uragallo
Re: using an expression on a slider to control visibility of layers inside a precomp
on Sep 21, 2017 at 1:28:36 pm

Thanks Scott!

this works! however another issue has arisen.

if i then key frame the slider. and duplicate Precomp B the pictures then restart as the sequence when actually i want them to continue with what i have key framed.

This obviously makes sense however is it possible to make them not 'restart the timeline'

I hope this makes sense

all the best

al


Return to posts index


Scott McGee
Re: using an expression on a slider to control visibility of layers inside a precomp
on Sep 21, 2017 at 8:56:42 pm

If you use true comp duplicator, then its a bit easier.

all i can advise thinking off top. Animate Precomp A instead, unless there is a reason. Add slider to Precomp A. So when you duplicate so does the slider control. time remap expression will always look to the attach slider. so you can change these individually.

if you want to control each of these from the master, just pick whip the duplicate to a new slider in the master comp. A little messy but get around the duplication issue.


Return to posts index

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