Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Layer follow problem

  • Layer follow problem

    Posted by Sam Moulton on August 27, 2007 at 1:55 pm

    Ok so I’ve got this company timeline with kind of a tool tips window that follows along as a pointer moves. The problem is that I need to have the tool tips window stay put until the pointer gets to where it’s going. I control the X position of the pointer with a slider.

    Here’s the position code so far:

    y = value [1];
    val = thisComp.layer(“XSlider”).effect(“Slider Control”)(“Slider”);
    follow = val%100;

    if (follow > 9 < 10) { ease (follow, 9, 10, 0, 10) } else if (follow > 19 < 20) { ease (follow, 19, 20, 10, 20) } // a bunch of other else statements go here for 29 to 30 and so on up to 40 x = value + (follow * 10); [x, y] The problem I'm having is that the else statements don't seem to be working. my tool tips layer hangs at 0 until I get to 9 then smoothly moves from 9 to 10, but when the slider control gets to 19 nothing happens. The marks on the timeline are 100 pixels apart so I multiply the follow distance by 10 I'm probably missing something simple. Maybe this requires a logical operator.

    Sam Moulton replied 18 years, 8 months ago 4 Members · 8 Replies
  • 8 Replies
  • Dan Ebberts

    August 27, 2007 at 2:36 pm

    Play around with this:

    y = value [1];
    val = thisComp.layer(“XSlider”).effect(“Slider Control”)(“Slider”);

    period = Math.floor(val/10);
    x = ease (val%10 +1, 9, 10, period*100, period*100 + 100);
    [x, y]

    Dan

  • Dan Ebberts

    August 27, 2007 at 2:47 pm

    Oops,

    I that one had an error. Try this:

    y = value [1];
    val = thisComp.layer(“XSlider”).effect(“Slider Control”)(“Slider”);

    period = Math.floor(val/10);
    x = ease (val%10, 9, 10, period*100, period*100 + 100);
    [x, y]

    Dan

  • Sam Moulton

    August 27, 2007 at 3:04 pm

    Thanks, I’ll give that a try.

  • Sam Moulton

    August 27, 2007 at 3:36 pm

    here’s what I came up with

    val = thisComp.layer(“Control”).effect(“XPosition”)(“Slider”);

    period = Math.floor(val/10);
    offset = ease (val%10, 9, 10, period*10, period*10 + 100);

    x = linear (offset, 0, 100, 600, 0)

    I’ve redesigned the project a bit and am using the offset filter instead of position because of some 3D and scale issues.

    Everything works except that I can’t go above 100 on the slider.

    Thanks again for your help…

  • Mike Clasby

    August 27, 2007 at 6:04 pm

    Can you right click the slider number and reset the Max on the slider?

  • Sam Moulton

    August 27, 2007 at 7:18 pm

    got it figured out. Used the remainder function (%) to loop the slider value at 100.

    Now if I could just get the thing to work with negative numbers…. but that’s another project.

    here’s the working code.

    val = thisComp.layer(“PositionController”).effect(“xPosition”)(“Slider”)%100;
    period = Math.floor(val/10);
    offset = ease (val%10, 9, 10, period*10, period*10);

    x = linear (offset, 0, 100, 1, 6000)
    y = value [0];

    [x, y]

  • Lord Scales

    August 28, 2007 at 4:22 pm

    It has an error…

    x = linear (offset, 0, 100, 1, 6000)
    y = value [0];

    [x, y]

    The variable y should be value[1], like this

    x = linear (offset, 0, 100, 1, 6000)
    y = value [1];

    [x, y]

  • Sam Moulton

    August 29, 2007 at 3:39 am

    yup…. Just a type-0…

    Nice catch though

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