Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Slider control with a looping expression?

  • Slider control with a looping expression?

    Posted by Amanda1122 on September 21, 2007 at 5:31 pm

    Can the slider control be used with a looping expression to pause the loop when needed?

    I’ve animated a bicycle with keyframes for each piece and then a looping expression to keep everything moving. But eventually the bike hits something and the pieces need to stop. Is there a way to do this without precomping or prerendering? Any suggestions would be great. Thanks.

    Bryce Jarrett replied 17 years, 5 months ago 5 Members · 9 Replies
  • 9 Replies
  • Mike Clasby

    September 21, 2007 at 7:34 pm

    There are probably several ways but I think if you bicycle involves Parenting and that loop expression, here’s what I’d do:

    1) Convert the Loop Expression to Keyframe
    2) Split and de-parent the children

    1) EE reveals expressions, select the property with the loop expression, Animation>Keyframes Assistant>Convert Expression to Keyframes. Now select the now keyframed loop, where you want the bike to fall apart, Right Click> Select Following keyframes, then delete them (OK< maybe you should have gone one frame forward first, as you might be deleting a frame before you want to). 2) Now Select and Split the Child layers (Edit>Split Layer) and then on the continuing child layer (created above each child), change the Parenting to NONE.

    Set Position keyframes for all there, then a few frames later, change position for them to fly apart.

    maybe there’s a better way, but this will work.

  • Kevin Camp

    September 21, 2007 at 7:59 pm

    if your loop was made using loopOut() this seems to work, the slider value is in number of seconds:

    loopDuration = key(numKeys).time – key(1).time;
    stopTime = effect(“Slider Control”)(“Slider”);
    if (time < stopTime) { loopOut() }else{ valueAtTime(stopTime - Math.round(stopTime / loopDuration - .5)) } if the slider is on a null, the change then add the name of the null before .effect("Slider Control")("Slider") you could also link it to a layer marker, then to stop, you would just hit the * key on the keypad at the point it needed to stop.... loopDuration = key(numKeys).time - key(1).time; stopTime = marker.key(1).time; if (time < stopTime) { loopOut() }else{ valueAtTime(stopTime - Math.round(stopTime / loopDuration - .5)) } Kevin Camp Designer – KCPQ, KMYQ & KRCW

  • Kevin Camp

    September 21, 2007 at 8:11 pm

    you could use the slider method, but then link the slider value to a marker on the null that the slider is applied to. paste as the expresion for the slider:

    marker.key(1).time

    then you could make adjustments by sliding the maker in the time line, rather than entering fractions of a second in decimal….

    Kevin Camp
    Designer – KCPQ, KMYQ & KRCW

  • Mike Clasby

    September 21, 2007 at 8:16 pm

    I love those expressions, but for me I get a little jump at the end (slider time and marker, respectively) to maybe 5-6 frames ahead of where it would normally be if the loop were running normally.

  • Kevin Camp

    September 21, 2007 at 9:09 pm

    oops, there seems to be a problem with the way i am trying to caluclate the stop position/state…. i think i didn’t see the problem, becasue the little loop i made was 1 second.

    i tried this one out a few times, and it seems to work (of course is thouh the last one did too)

    loopDuration = key(numKeys).time – key(1).time;
    stopTime = thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”);
    if (time < stopTime) { loopOut() }else{ valueAtTime(((stopTime / loopDuration) - 1) * loopDuration) } however, if the stopTime value is less than the loopDuration it will not work properly... but that could be fixed by another if/else or maybe a clever math way... Kevin Camp Designer – KCPQ, KMYQ & KRCW

  • Kevin Camp

    September 24, 2007 at 1:50 pm

    sorry guys, i’m playing around with this one again this morning, and it only seems to work to stop the loop in the right spot for the second loop, if it is any loop after that it stops at the last position of the loop….

    i seem to be having problems accounting for the number of loops prior to stopTime, then adding the fraction of the loop.

    i have some time today, i think i can get this…

    Kevin Camp
    Designer – KCPQ, KMYQ & KRCW

  • Kevin Camp

    September 24, 2007 at 2:38 pm

    ok, thanks to aharon’s odometer tutorial (and dan helping aharon), i learned a new function… ‘%’… returning just the remainder of a division problem… which gave me exactly what i need, so i did’nt need to account for the number of loops prior to stopTime….

    loopDuration = key(numKeys).time – key(1).time;
    stopTime = thisComp.layer(“Null 1”).effect(“Slider Control”)(“Slider”);
    if (time < stopTime) { loopOut() }else{ valueAtTime(stopTime % loopDuration) } i know i said it before, but this should work (...er... third times a charm, right...?) Kevin Camp Designer – KCPQ, KMYQ & KRCW

  • Gianclaudio De giovanni

    September 7, 2008 at 11:35 am

    Referring to Aaron Rabinowitz tutorial on the odometer, what is the espression to use in order to have the numbers click into place instead of having them moving continously. In certain cases they appear to go backwards.
    Thanks for any help

  • Bryce Jarrett

    November 26, 2008 at 5:00 pm

    Did you ever find a solution to this? I’m also wanting to know how to do this – thanks

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