Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Controlling Time Indicator with a slider

  • Controlling Time Indicator with a slider

    Posted by Glenn Tak on December 27, 2017 at 4:17 am

    I have created a faux interface for a movie player. I have a slider controlling the position of the fake control. I would like to have the same slider control the video that is in my precomp. So when I pull the slider, the video underneath follows.

    Is this possible?

    Thanks in Advance!

    TAK

    ______________________

    “Nothing is Easy”
    Jethro Tull

    Glenn Tak replied 8 years, 4 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    December 27, 2017 at 6:50 am

    >Is this possible?

    It should be. Just turn on time remapping for the video layer and use an expression to link the video time to the slider. Time remapping expects a value in seconds, so you need to do whatever math is necessary to convert the slider value to the desired video time in seconds. Shouldn’t be too tough.

    Dan

  • Glenn Tak

    December 28, 2017 at 6:52 am

    Well I’ve managed to get the slider to control the Time Remapped movie in a comp which works great if you have the Time Indicator placed at the last frame. But if you move the time indicator it changes the effect of the slider.

    And if you use this movie comp as a precomp in another comp then the Time indicator moves according to the Time indicator in the master comp and that changes the position of the Remap… which effects the relationship to the slider numbers.

    I suspect I need some line of code that tells the slider expression to always start from frame 0 of the comp no matter where the time indicator is.

    I have copied the expression I am using below. Any thoughts?

    spd = thisComp.layer("MOVIE SLIDER").effect("Slider Control")("Slider")
    n = spd.numKeys;
    if (n > 0 && spd.key(1).time < time){
    accum = spd.key(1).value*(spd.key(1).time - inPoint);
    for (i = 2; i <= n; i++){
    if (spd.key(i).time > time) break;
    k1 = spd.key(i-1);
    k2 = spd.key(i);
    v2 = spd.valueAtTime(k2.time-.001);
    accum += (k1.value + v2)*(k2.time - k1.time)/2;
    }
    accum += (spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;
    }else{
    accum = spd.value*(time - inPoint);
    }
    accum/100

    ______________________

    “Nothing is Easy”
    Jethro Tull

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