ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Slider expression not working when keyframes added

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Del Agnew
Slider expression not working when keyframes added
on Sep 20, 2018 at 4:46:32 pm

Hi guys!

Long time lurker, first time poster. Apologies in advance if this has been covered elsewhere (I've scoured other threads but haven't found a solution)

I have a Slider expression that is set up to control the opacities of 3 layers. The Slider Value Scale is set between 0 - 100.

Basically the expression states that if the value of Slider A is between a certain range then the opacity for that given Layer is 100 else 0.
So let's the call them "Layer A" "Layer B" "Layer C"

The expressions for each are:

"Layer A" : if(comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')<=25)100 else 0

"Layer B" : if(comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')>=26 && comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')<=50))100 else 0

"Layer C" : if(comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')>=51 && comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')<=75)100 else 0


The expressions themselves check out. When I adjust the value of the Slider scale the layers' opacities adjust accordingly. However as soon as I try to keyframe the slider values, the expression freezes to whatever the first keyframe value is. So basically if "Layer B" is visible when I start key-framing, only "Layer B". will be visible from that point forward, no matter the change in Slider value.

I hope I've explained this thoroughly enough. I'm very confused as to why the keyframes would be the issue. I thought initially that I might have too many compositions and too many expressions, however I stumbled across a thread where someone said they have "600 comps and 8000 expressions" and everything works fine.

Is there some setting that I'm missing here? It's only been a problem within this composition.

Any help would be much appreciated. Thanks in advance!

-Del

"Layer A" : if(comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')&lt;=25)100 else 0

"Layer B" : if(comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')>=26 && comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')&lt;=50))100 else 0

"Layer C" : if(comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')>=51 && comp("Comp A").layer("Layer 1").effect("Slider A")("Slider')&lt;=75)100 else 0


Return to posts index

Dan Ebberts
Re: Slider expression not working when keyframes added
on Sep 20, 2018 at 6:02:45 pm

This will happen when you're referencing a keyframed in (or from) a precomp and the precomp doesn't start at time zero in the main comp. You have to compensate for that offset in your expression by using valueAtTime() with an offset equal to the start time of the precomp layer in the main comp. The exact code depends on how you have things set up.


Dan



Return to posts index

Kalleheikki Kannisto
Re: Slider expression not working when keyframes added
on Sep 20, 2018 at 6:21:44 pm
Last Edited By Kalleheikki Kannisto on Sep 20, 2018 at 6:24:57 pm

All three lines had typos in them that had to be fixed before this worked at all. Single quotes and missing parenthesis. Once fixed, I had no problem keyframing them.

Layer A
if(comp("Comp A").layer("Layer 1").effect("Slider A")("Slider")<=25)100 else 0
Layer B
if(comp("Comp A").layer("Layer 1").effect("Slider A")("Slider")>=26 && comp("Comp A").layer("Layer 1").effect("Slider A")("Slider")<=50)100 else 0
Layer C
if(comp("Comp A").layer("Layer 1").effect("Slider A")("Slider")>=51 && comp("Comp A").layer("Layer 1").effect("Slider A")("Slider")<=75)100 else 0

Or, if that doesn't do it, what Dan said.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

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