Forum Replies Created

Page 63 of 1081
  • I think this is actually a little (half a pixel) more precise:

    h = height/2;
    w = width/2;
    for (i = 0.5; i < width; i++){
    if (sampleImage([i,h],[.5,h])[3]>0) break;
    }
    left = i;
    for (i = width-0.5; i > 0; i--){
    if (sampleImage([i,h],[.5,h])[3]>0) break;
    }
    right = i;
    for (i = 0.5; i < height; i++){
    if (sampleImage([w,i],[w,.5])[3]>0) break;
    }
    top = i;
    for (i = height-0.5; i > 0; i--){
    if (sampleImage([w,i],[w,.5])[3]>0) break;
    }
    bottom = i;
    [(left+right)/2,(top+bottom)/2]
  • The only thing I can think of is the old brute-force sampleImage() method:

    h = height/2;
    w = width/2;
    for (i = 0; i < width; i++){
    if (sampleImage([i,h],[.5,h])[3]>0) break;
    }
    left = i;
    for (i = width-1; i >= 0; i--){
    if (sampleImage([i,h],[.5,h])[3]>0) break;
    }
    right = i;
    for (i = 0; i < height; i++){
    if (sampleImage([w,i],[w,.5])[3]>0) break;
    }
    top = i;
    for (i = height-1; i >= 0; i--){
    if (sampleImage([w,i],[w,.5])[3]>0) break;
    }
    bottom = i;
    [(left+right)/2,(top+bottom)/2]
  • Dan Ebberts

    December 21, 2022 at 6:22 pm in reply to: Round corner on shape layer

    I think if you convert the rectangle to bezier and use this path expression, you won’t need the position or size expressions:

    radius = 20;
    p = content("Rectangle 1").transform.position;
    L = thisComp.layer("more info");
    r = L.sourceRectAtTime(time,false);
    ul = fromComp(L.toComp([r.left,r.top]))-p;
    ur = fromComp(L.toComp([r.left+r.width,r.top]))-p;
    lr = fromComp(L.toComp([r.left+r.width,r.top+r.height]))-p;
    ll = fromComp(L.toComp([r.left,r.top+r.height]))-p;
    ur1 = [ur[0]-radius,ur[1]];
    ur2 = [ur[0],ur[1]+radius];
    t = radius*0.5525;
    it = [[0,0],[-t,0],[0,-t],[0,0],[0,0]];
    ot = [[0,0],[t,0],[0,t],[0,0],[0,0]];
    createPath([ul,ur1,ur2,lr,ll],it,ot,true)
  • I’m not 100% sure I understand what you’re asking for, but it might be something like this:

    L=thisComp.layer("3dNull");
    R=L.sourceRectAtTime(time,false);
    UL = fromCompToSurface(L.toComp([0,R.top,R.left]));
    UR = fromCompToSurface(L.toComp([0,R.top,R.left+R.width]));
    LR = fromCompToSurface(L.toComp([0,R.top+R.height,R.left+R.width]));
    LL = fromCompToSurface(L.toComp([0,R.top+R.height,R.left]));
    createPath([[UR[0],UR[1]],[LR[0],LR[1]],[LL[0],LL[1]],[UL[0],UL[1]]], [], [], true);
  • Dan Ebberts

    December 19, 2022 at 6:20 pm in reply to: error: Math.trunc() is not a function

    You probably have File > Project Settings > Expressions set to Legacy ExtendScript. Change it to JavaScript and the error should go away.

  • Dan Ebberts

    December 19, 2022 at 4:57 pm in reply to: Copying Text AND Styling from a ‘Master’ text layer

    Unfortunately, any time you apply a source text expression, all the characters are going to get the same styling.

  • I’m guessing this isn’t quite right, but it will probably be something like this:

    red = [.4,.0824,.1765,1];
    orange = [.851,.4784,.2,1];
    yellow = [.9255,.7176,.1922,1];
    s = scale[0];
    if (s <= 20)
    linear(s,0,20,red,orange)
    else if (s <= 50)
    linear(s,20,50,orange,yellow)
    else
    yellow
  • Dan Ebberts

    December 15, 2022 at 4:46 pm in reply to: Logical Operator "Or" and Drop Down Menus

    Yes, ternary operator. Yours should work if you balance a couple of mismatched parens I think.

  • I can’t imagine that the source code would be accessible. You might be able to reverse engineer something based on information that you do have access to, like the KeyframeEase object and cubic bezier formulas. Sounds like a bit of work though…

  • Dan Ebberts

    December 14, 2022 at 8:59 pm in reply to: Floating letters

    That looks like a fairly complex physical simulation. It looks like something you might be able to pull of with Newton or Pastiche (or a combination of both) from aescripts. I don’t have those tools, so I’m not sure, but you might want to check them out.

Page 63 of 1081

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