Forum Replies Created

Page 109 of 1081
  • Dan Ebberts

    September 2, 2021 at 3:53 pm in reply to: interpolate random position?

    It would help if you could explain what it is that you’re trying to do.

  • Try this:

    p = thisComp.layer("Control 1").effect("Control")("Checkbox");

    t = p.value ? time : 0;

    if (p.numKeys > 0){

    n = p.nearestKey(time).index;

    if (p.key(n).time > time) n--;

    if (n > 0){

    t = p.key(1).value ? p.key(1).time : 0;

    t += p.value ? time - p.key(n).time : 0;

    for (i = 2; i <= n; i++){

    t += p.key(i-1).value ? p.key(i).time - p.key(i-1).time : 0;

    }

    }

    }

    t.toFixed(1)

  • Dan Ebberts

    August 30, 2021 at 6:59 pm in reply to: Animating a trading candle with expressions

    It sounds like your expression may need to start at the current time and examine every previous frame of the slider value, to determine the maximum. You might be able to simplify it, depending on how the slider is animated. For example, you might be able to get the previous maximum just by examining previous slider keyframes (if that’s how you’re animating the slider).

  • Yes, in that scenario you might expect something like this to work:

    h = thisComp.layer("TITLE").sourceRectAtTime(time,false).height;

    n = text.sourceText.value.length;

    w = sourceRectAtTime(time,false).width;

    (h - w)/(n-1)

    and, in fact, if you apply that expression to the tracking amount and hover your cursor over the rotated text, the bounding box does appear to match the height of the main title, but the text doesn’t get redrawn, presumably because you’re using an expression that depends on and then tries to alter its layer’s own sourceRectAtTime. If you figure out a solution, please post it.

  • Dan Ebberts

    August 26, 2021 at 5:02 pm in reply to: Linking keyframes position X values to slider values

    If you have dimensions separated, then it would be like this:

    s = effect("Slider Control")("Slider");

    x1 = valueAtTime(key(1).time);

    x2 = valueAtTime(key(2).time);

    d = x2 - x1;

    xCur = value - x1;

    x1 + (xCur/d)*((x2+s)-x1);

  • Dan Ebberts

    August 26, 2021 at 1:38 am in reply to: Linking keyframes position X values to slider values

    There are a lot of variables in something like this and I don’t know that this will work for you, but if you set the slider up as an X offset from the 2nd keyframe, something like this might work for you (and should maintain any easing you have set up on the keyframes):

    s = effect("Slider Control")("Slider");

    x1 = valueAtTime(key(1).time)[0];

    x2 = valueAtTime(key(2).time)[0];

    d = x2 - x1;

    xCur = value[0] - x1;

    x = x1 + (xCur/d)*((x2+s)-x1);

    [x,value[1]]

  • Dan Ebberts

    August 25, 2021 at 9:46 pm in reply to: Adding points to a shape layer with expressions

    I think you could simulate an alpha wave by modulating your amplitude with a slower sine wave. Try replacing this:

    P.push([W/R*i, Math.sin(time*S+i /(R/F))*A]);}

    with this:

    amp = A*Math.sin((time*S+i /(R/F))/9.47);

    P.push([W/R*i, Math.sin(time*S+i /(R/F))*amp]);}

  • Dan Ebberts

    August 25, 2021 at 4:30 pm in reply to: [Help] automatically add "+" if value is positive

    Try replacing this:

    u = if(s>0) {"+"};

    with this:

    u = s>0 ? "+" : "";

  • Dan Ebberts

    August 24, 2021 at 8:30 pm in reply to: toComp… I just don’t get it

    toComp() takes a single point as its main parameter (with time as an optional, second paramter). The point can be either 2D (x and y) or 3D (x,y, and z) in array notation. If you’re only interested in one dimension of the result, then you would extract that from the result using [0] or [1] (or sometimes [2], which is usually ignored from toComp). I don’t know if that answers your question.

  • Dan Ebberts

    August 24, 2021 at 3:50 pm in reply to: Adding points to a shape layer with expressions

    Sorry, I don’t know what you mean by “tappering”.

Page 109 of 1081

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