Forum Replies Created

Page 126 of 1081
  • Dan Ebberts

    December 11, 2020 at 1:18 am in reply to: ValueAtTime is not a function?

    Try switching this:

    .size[0].valueAtTime(1)

    to this:

    .size.valueAtTime(1)[0]

  • Dan Ebberts

    December 10, 2020 at 10:23 pm in reply to: How to get the same result as timeToFrames with scripting?

    So the straightforward approach like this doesn’t work for you?

    function timeToFrames(theTime,theComp){

    return Math.round(theTime/theComp.frameDuration);

    }

    function framesToTime(theFrames,theComp){

    return theFrames*theComp.frameDuration;

    }

  • Dan Ebberts

    December 7, 2020 at 8:33 pm in reply to: Absolute Camera Position, Orientation, and Rotation

    Try this for the precomp camera’s orientation:

    L = comp("Main Comp").layer("Camera 1");

    u = (L.toWorldVec([1,0,0]));

    v = (L.toWorldVec([0,1,0]));

    w = normalize(L.toWorldVec([0,0,1]));

    sinb = clamp(w[0],-1,1);

    b = Math.asin(sinb);

    cosb = Math.cos(b);

    if (Math.abs(cosb) > .0005){

    c = -Math.atan2(v[0],u[0]);

    a = -Math.atan2(w[1],w[2]);

    }else{

    a = (sinb < 0 ? -1 : 1)*Math.atan2(u[1],v[1]);

    c = 0;

    }

    [radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]

  • Dan Ebberts

    December 7, 2020 at 5:12 pm in reply to: Incorrect layer movement expression

    >for example, AE can’t let an expression to refer to its state in a previous frame or something like that?

    That’s correct. However, it looks like your expression is already set up to loop through all previous frames (which is one way to work around the expressions-have-no-memory issue). You can take advantage of the time parameter of toComp() to get the frame-by-frame position of the target layer:

    thisComp.layer("Target Layer").toComp(anchorPoint,framesToTime(cF))

    and use that to calculate on the fly how the layer with the expression should respond on a frame-by-frame basis.

  • Dan Ebberts

    December 6, 2020 at 7:56 am in reply to: This expression very hard to edit

    It has limitations, but try this:

    elev = degreesToRadians(75);

    v = 1900;

    e = .7;

    f = .5;

    g = 5000;

    nMax = 9;

    tLaunch = 1;

    repeatEvery = 3;

    nSegs = Math.floor((time-tLaunch)/repeatEvery);

    vy = v*Math.sin(elev);

    vx = v*Math.cos(elev);

    t = (time - tLaunch)%repeatEvery;

    tCur = 0;

    segDur = 2*vy/g;

    dSeg = 0; // x distance traveled

    nb = 0; // number of bounces

    while (nb <= nMax){

    dSeg += vx*segDur;

    vx *= f;

    segDur *= e;

    nb++

    }

    vy = v*Math.sin(elev);

    vx = v*Math.cos(elev);

    if (time >= tLaunch){

    t = (time - tLaunch)%repeatEvery;

    tCur = 0;

    segDur = 2*vy/g;

    tNext = segDur;

    d = 0; // x distance traveled

    nb = 0; // number of bounces

    while (tNext < t && nb <= nMax){

    d += vx*segDur;

    vy *= e;

    vx *= f;

    segDur *= e;

    tCur = tNext;

    tNext += segDur;

    nb++

    }

    if(nb <= nMax){

    delta = t - tCur;

    x = d + delta*vx;

    y = delta*(vy - g*delta/2);

    }else{

    x = d;

    y = 0;

    }

    value + [x + nSegs*dSeg,-y]

    }else

    value

  • Dan Ebberts

    December 5, 2020 at 5:46 pm in reply to: creating a LOOPED wiggle with RANGE SELECTION

    The best I could come up with is something like this. It will be approximate because you never know exactly what you’ll get min and max wise with wiggle. You’ll need to tweak ampAdjust (an amplitude multiplier) and offsetAdjust (to move the whole waveform up or down) after you see what you get if you need it to run exactly from minVal to maxVal.

    freq = 10;

    maxVal = 40;

    minVal = -35;

    loopTime = 3;

    ampAdjust = 1.25;

    offsetAdjust = -2;

    t = time % loopTime;

    amp = (maxVal - minVal)/2

    wiggle1 = wiggle(freq, amp, 1, 0.5, t) - valueAtTime(t);

    wiggle2 = wiggle(freq, amp, 1, 0.5, t - loopTime) - valueAtTime(t);

    w = linear(t, 0, loopTime, wiggle1, wiggle2)*ampAdjust;

    offset = (maxVal + minVal)/2;

    value + w + offset + offsetAdjust

  • Dan Ebberts

    December 5, 2020 at 5:11 pm in reply to: TEXT ALIGNMENT IN A BOX USING EXPRESSIONS

    I think this should work:

    L = thisComp.layer("Rect");

    L.toComp(L.anchorPoint);

  • Assume in your Master comp you have a layer named “Controls” with a point control named Box Position to control the position of the box in both precomps. You should be able to do it with an expression like this for each box position:

    L1 = comp("Master").layer("Controls");

    L2 = comp("Master").layer(thisComp.name);

    p = L1.toComp(L1.effect("Box Position")("Point"));

    L2.fromComp(p)

  • Dan Ebberts

    December 4, 2020 at 3:36 pm in reply to: Storing a list of properties in a variable

    Try it this way:

    $.writeln(testLayer.property(testProps[0]).numKeys);

    $.writeln(testLayer.property(testProps[1]).numKeys);

  • Add this to the end of your expression:

    createStyle().setFont(fontName).setText(layerTextOutput)
Page 126 of 1081

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