Forum Replies Created

Page 161 of 1081
  • A couple of things– instead of this:

    app.project.item(i).layers.length

    I’d use this:

    app.project.item(i).numLayers

    Also, your section that processes myTextLayer2 uses the text from myTextLayer3.

    Dan

  • Dan Ebberts

    December 28, 2019 at 8:04 pm in reply to: Random expression: force new number

    Since expressions have know way of accessing values they calculated on previous frames, you have to recreate the whole sequence, from frame 0 to the current frame, on each frame. Something like this should work, but you need to be aware that the expression has to do more calculation on each successive frame, so it may grind to a halt if your comp is too long:


    seedRandom(index,true);
    curVal = Math.floor(random(3))
    f = timeToFrames(time);
    for (i = 0; i <= f; i++){
    curVal += Math.floor(random(1,3));
    curVal %= 3;
    }
    curVal+1

    Dan

  • Dan Ebberts

    December 23, 2019 at 9:01 pm in reply to: Extendscript .getFiles function is undefined

    That’s the right function. Your code works fine for me–I’m not sure why it doesn’t work for you. Maybe a permissions thing? Do you have the preference set that allows scripting to access the network?

    Dan

  • Dan Ebberts

    December 23, 2019 at 1:32 pm in reply to: Control Text Repeater with sliders

    Unfortunately, once you apply an expression to source text, you’re limited to a single font.

    Dan

  • Dan Ebberts

    December 20, 2019 at 5:25 pm in reply to: X scale by time

    Try it this way:


    segMin = 1; //minimum segment duration
    segMax = 5; //maximum segment duration
    minVal = 100;
    maxVal = 130;

    end = 0;
    j = 0;
    while ( time >= end){
    j += 1;
    seedRandom(j,true);
    start = end;
    end += random(segMin,segMax);
    }
    endVal = random(minVal,maxVal);
    seedRandom(j-1,true);
    dummy=random(); //this is a throw-away value
    startVal = random(minVal,maxVal);
    s = ease(time,start,end,startVal,endVal);
    [s,value[1]]

    Dan

  • Dan Ebberts

    December 17, 2019 at 11:29 pm in reply to: sampleImage of 3D Layer

    Is there anything that’s not square pixels?

    Dan

  • Dan Ebberts

    December 17, 2019 at 6:50 pm in reply to: sampleImage of 3D Layer

    Hmmm… That’s exactly how it works for me. I can move the camera or 3DLayer, but the expression samples the layer at [100,500] in the camera view. I’m not sure why it doesn’t work for you.

    Dan

  • Dan Ebberts

    December 17, 2019 at 5:10 pm in reply to: sampleImage of 3D Layer

    I got this to work:

    myLayer = thisComp.layer(“3DLayer”);
    p = myLayer.fromCompToSurface([100,500]);
    myLayer.sampleImage(p,[0.5,0.5])

    Dan

  • Dan Ebberts

    December 17, 2019 at 4:40 pm in reply to: Using time data from an array

    You are correct about the expression not being able to hold the value, so your expression will need to loop through the “time” fields until it finds the most recent, previous value. If it’s a lot of data, you might be able to optimize it somewhat with a binary search, but that might be overkill.

    Dan

  • Dan Ebberts

    December 15, 2019 at 6:05 pm in reply to: Adding expressions to text animator

    Try this:

    L = thisComp.layer(“Box”);
    r = L.sourceRectAtTime();
    p = L.toComp([r.left + r.width/2,0]) – position;
    [p[0],value[1]]

    Dan

Page 161 of 1081

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