Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions dynamically add slider values from every second layer to a master slider

  • dynamically add slider values from every second layer to a master slider

    Posted by Christopher Hesse on February 6, 2024 at 12:55 pm

    Hi crowd,

    I want to build a template for a diagram. The template is supposed to consist of a path on a shape layer with “trim paths” and a text layer that has a slider control to which the trim paths is parented. I want to be able to dynamically duplicate both, shape and text layers, so that each trim path of each new shape layer is automatically parented to the end-value of the shape layer before. That in itself is not my problem. What stymies me is that I need another slider sitting on a master control layer that adds up all values of all sliders on all text layers, which can be either 1 or n. These sliders though, sit only on every second layer (i. e. the text layers). Why? Because I want the text layers to automatically move in a way that they are always situated above the middle of their corresponding diagram parts. I know how to get that and can solve it for a predefined number of diagram parts, but not for n dynamically changing diagram parts.
    This is quite complex to describe an I hope I’ve more or less communicated my problem in an understandable way.

    Christopher Hesse replied 3 months, 2 weeks ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    February 6, 2024 at 4:59 pm

    This should be close, I think:

    sum = 0;
    for (i = index+1; i <= thisComp.numLayers; i += 2){
    sum += thisComp.layer(i).effect("ADBE Slider Control")("ADBE Slider Control-0001");
    sum + " %"
  • Christopher Hesse

    February 7, 2024 at 10:02 am

    Thank you very much!

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