Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Assing value to slider through expressions

  • Assing value to slider through expressions

    Posted by Adrian Fach on November 21, 2017 at 9:28 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!

    Adrian

    Adrian Fach replied 8 years, 5 months ago 1 Member · 1 Reply
  • 1 Reply
  • Adrian Fach

    November 21, 2017 at 1:43 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 ;))

    Thanks,
    Adrian

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy