Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Oh… and… Using expression to offset time-remap from a slider

  • Oh… and… Using expression to offset time-remap from a slider

    Posted by Jim Lefevre on August 31, 2011 at 9:44 am

    Following on from my previous post about setting up a ‘Tree’ with a load of leaves going through different seasons…

    I have a ‘tree’ with a lot of leaves (LEAF.COMP). Within this comp is animation that takes the leaf through SPRING SUMMER AUTUMN and WINTER.

    I have currently laid out the leaves around the tree and want to offset groups of them so that the animation is staggered.

    I have a layer with an expression slider (SEASONS SLIDER).

    With this I want to the LEAF.COMP to take the slider value as its time-remap value but also be able to offset it it to different degrees.

    I will have about 5 groups of leaves each with differing offset values (groupA LEAF.COMP offset by 4 frames, groupB LEAF.COMP offset by 7 frames etc…).

    The expression which I am using is below

    thisComp.layer("SEASONS SLIDER").effect("Slider Control")("Slider").valueAtTime(time)

    BUT (even without any offset) when the SEASON SLIDER is a certain value it seems to be

    SEASON SLIDER LEAF.COMP time-remap value
    10 250

    so I am dividing it by 25

    thisComp.layer("SEASONS SLIDER").effect("Slider Control")("Slider").valueAtTime(time)/25

    However I am having a stupid mental block about offsetting it as

    thisComp.layer("SEASONS SLIDER").effect("Slider Control")("Slider").valueAtTime(time)/25-10

    obviously doesn’t work and

    thisComp.layer("SEASONS SLIDER").effect("Slider Control")("Slider").(valueAtTime(time)/25)-10

    (adding brackets around the valueAtTime(time)/25 bit) gives me an error…

    Can anyone advise me on how to offset this!

    http://www.jimlefevre.com

    Dan Ebberts replied 14 years, 8 months ago 2 Members · 1 Reply
  • 1 Reply
  • Dan Ebberts

    August 31, 2011 at 6:38 pm

    I’m not sure exactly what you’re doing, but it looks like you may want your slider value to be frames, but time remapping expects seconds. So you probably need a conversion like this:

    f = thisComp.layer(“SEASONS SLIDER”).effect(“Slider Control”)(“Slider”);
    offset = -10; // offset in frames
    t = framesToTime(f+offset); // time in seconds

    Dan

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