Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions set a slider to control expressions inside a comp and making it work on multiple instances of the comp

  • set a slider to control expressions inside a comp and making it work on multiple instances of the comp

    Posted by Iacopo Boccalari on December 4, 2015 at 12:49 pm

    I just followed an incredibly nice old tutorial on how to create an odometer like counter in AE.
    So far so good. Now I made a precomp that contains this odometer and a null with a slider that controls the odometer.
    so I have expressions that begin with
    slider = thisComp.layer("controller").effect("Slider Control")("Slider");
    The problem is I’d like to have multiple instances of this odometer and I want each instance to count to a different number. In order to do this, I have to duplicated the odometer comp and change the slider inside the null.
    This means if I need 100 counters I’ll have 100 different composition in the project browser and that is not optimal at all.
    How do I make this more flexible? It would be cool to have a slider in the effect controls panel of the odometer itself so that I could animate a value for each instance.

    I tried to do so, but pick-whipping the slider contained in the odometer comp effects gets referenced with an absolute path like follows:
    pippo = comp("lots_of_counters").layer("counter1").effect("Slider Control")("Slider")

    so this won’t work, I need some kind of relative path to the slider.

    I hope I’ve been clear enough so that you guys can understand!

    Iacopo Boccalari replied 10 years, 5 months ago 3 Members · 3 Replies
  • 3 Replies
  • Kalleheikki Kannisto

    December 4, 2015 at 12:57 pm

    It will work, you just need 100 sliders in order to control 100 odometers. You can have the sliders in the same comp, but make sure give them different names (they will automatically be renamed if you copy them: “slider 1”, “slider 2”, etc.)

  • Miguel De mendoza

    December 4, 2015 at 1:07 pm

    You can use a name sufix. For example, do you want to instantiate 100 odometer comps, you can create one odometer comp “Odometer_1”. Now you can write something like this:

    try {
    nameSplit = name.split("_");
    ind = nameSplit[nameSplit.length - 1];
    pippo = comp("lots_of_counters").layer("counter_" + ind).effect("Slider Control")("Slider");
    } catch (err) {
    }

    At this point you can duplicate the comp and do the same for the layers do you want to reference: “counter_1”, “counter_2″….

  • Iacopo Boccalari

    December 4, 2015 at 1:24 pm

    Thanks, this sounds interesting.
    It appears though as if there is no way to make this odometer universal and re-usable in different projects without having to edit its expressions.

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