ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Assing value to slider through expressions

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Adrian Fach
Assing value to slider through expressions
on Nov 21, 2017 at 9:28:39 am

Hello everyone!
I'm very new to expressions, so please excuse if this is a stupid question.
I need to have a varibal that updatates automaticly based on its layers position in the comp. So e.G.:

LayerIndex 1 : Var NewX = 5
LayerIndex 2 : Var NewX = 4
LayerIndex 3 : Var NewX = 3
LayerIndex 4 : Var NewX = 2
LayerIndex 5 : Var NewX = 1

I read somewhere that I can't just access NewX of the layer below call it PrevX, add 1 and call it NewX again. So I tried to work around that and tried this with a slider control;

PrevX = thisComp.layer(Index-1).effect("Einstellungen für Schieberegler")("Schieberegler"); /*this is just German for
slidercontrol (slider of
the layer below) */
NewX = PrevX + 1;
effect("Einstellungen für Schieberegler")("Schieberegler").value = NewX; /* Slider of current layer

This doesn't produces any errors but the slider of the NewX Layer doesn't update. I hope my explanation isn't to confusing and sorry for any errors. English is not my first language.

I'm thankful for any help!


Return to posts index

Adrian Fach
Re: Assing value to slider through expressions
on Nov 21, 2017 at 1:43:13 pm

Ok figuered it out myself! My idiotic self thought I could change a value of a property in another layer than the expression is in...

Ofcourse I have this on my slider now (I have a slider with the same name on every layer):

thisComp.layer(index+1).effect("Einstellungen für Schieberegler")("Schieberegler") + 1;

and this on the positon:

timeToStop = effect("Einstellungen für Schieberegler")("Schieberegler");
xOffset = easeIn(time,timeToStop,timeToStop+1,0,250);
thisComp.layer(index+1).transform.position.valueAtTime(time-1) + [xOffset,0];

The last two lines don't have anything to do with my problem really, but I included them anyways.

This works great for me now. Maybe this will help another beginner so he/she doesn't have to spend hours trying to figure it out (even though that is half the fun ;))


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved