Forum Replies Created

Page 20 of 277
  • Could you post a project ? I’m having a hard time imagining how the mattes are working and how the final sourceText is set up.

  • I’ve observed that with very heavy JSON or csv files (thousands of lines) importing and adding to a comp can take a very long time. (For example a multiyear multiregion COVID dataset, or huge GPS tracking data)

    In those cases parsing the data myself (either naively using .split() methods or with an external library like papaparse converted to work in expressions) was much faster.

    Importing a textfile without letting after effects take any time trying to parse it in import can be achieved by importing it as type “JavaScript” and then accessing the source text of the footage item.

    I doubt that there’s a lot of impact on smaller datasets with just a few colors and texts etc.

    Adding a data object to a composition actually just prefills everything with expressions that fill in the right coordinates in the dataValue() method, but it is a convenient way to inspect the structure of the data, get the number of rows, and to get the column names etc.

  • This sounds more like something Newton can do.

    When there are a lot of layers that all need to influence each other, and keep track of their states in time, expressions are not up to that and you need something that runs the simulation, then creates keyframes as a script.

  • Filip Vandueren

    January 25, 2023 at 2:57 pm in reply to: Can I get the color of a solid via expression?

    AFAIK it’s not accessable, but in a pinch you could ;sampleImage() preEffects

  • Try this: I reworked it a bit so we work around the quirk that textIndex is not 0 based, the result is a bit more symmetrical and works for even and odd copies of the text. (although I take it you are only working with odd numbers)

    const flip = effect("Flip")("Checkbox");
    const stggr = effect("Stagger")("Slider");
    const pos = effect("Position")("Point");
    const delay = effect("Time Delay")("Slider").value * thisComp.frameDuration;
    const tot = textTotal-1;
    const ind = textIndex-1;
    const range = tot/2;
    const offst = range - ind;
    const rO = offst/range;
    const mod = Math.cos(Math.PI*2 + rO*2) + 1;
    let sel = linear(ind, 0, tot, -100, 100);
    sel = ind > range && flip == 1 ? -sel : sel;
    if(stggr <= 0) {
    easeL = sel * mod;
    v = ease(stggr, -100, 0, easeL, sel);
    } else if(stggr >= 0) {
    easeH = sel / mod/2;
    v = ease(stggr, 0, 100, sel, easeH);
    }
    const p = ind < range ?
    pos.valueAtTime(time - delay*ind)
    :
    pos.valueAtTime(time- delay*(tot-ind));
    p*v/1000;
  • Something like this would work:

    const flip = effect("Flip")("Checkbox");
    const stggr = effect("Stagger")("Slider");
    const range = textTotal/2;
    const offst = Math.round(textTotal/2 - textIndex);
    const rO = offst/range;
    const mod = Math.cos(Math.PI*2 + rO*2) + 1;
    let sel = linear(textIndex, 1, textTotal, -100, 100);
    sel = textIndex > textTotal/2 && flip == 1 ? -sel : sel;
    if(stggr <= 0) {
    easeL = sel * mod
    v = ease(stggr, -100, 0, easeL, sel);
    } else if(stggr >= 0) {
    easeH = sel / mod/2
    v = ease(stggr, 0, 100, sel, easeH);
    }
    pos = effect("Position")("Point");
    delay = textIndex*thisComp.frameDuration*2;
    p = pos.valueAtTime(time - delay);
    p*v/1000;

    The expression control Point – Effect named “Position” will determine the position of the animator (along with the funky easing function you wrote), if its value is keyframed, the letters will move with 2 frames delay. (you can also hook that up to a slider of course, or finetune it in another way).

    Important: the value set in the position parameter of the animator needs to be fixed at 1000 (or something else like 100.000, but it needs to be the same as value the v/1000 in the last line of the expression) and it needs to be more than the maximum distance you would want to move the letters around.

    This is what makes it possible to use the expression-selector as sort of an absolute positioner which is what we need here to do the delay.

    If this value itself is keyframed, then it doesn’t work, because amount is limited form -100 to +100%, so say it becomes 50px, but 1 of the letters needs to be positioned still at 60 pixels because it is lagging, we can’t give it 120% to end up at 60.
    Using a very high fixed number for the position-value and then using small amount-percentages gives us all the flexibility.

  • Filip Vandueren

    January 21, 2023 at 3:13 pm in reply to: Trigger an action by luminance

    Hi Kashif,

    here’s a slight adaptation of an expression I posted a few days ago which will do what you need:

    // posterizeTime(0); // uncomment for still images
    includeEffects = false;
    l=thisComp.layer("Blob"); // your layer
    w=l.width;
    h=l.height;
    threshold = 0;
    width_bits = Math.ceil(Math.log(w)/Math.log(2));
    height_bits = Math.ceil(Math.log(h)/Math.log(2));
    left = 0; right = 0;
    seedRandom(index,true);
    for (i=0; i<1000; i++) {
    // do a limited loop, because Blob might be empty and we would be stuck in an infinte loop.
    randomPos = random([0,0],[w,h]);
    if (l.sampleImage(randomPos, [1,1], includeEffects)[3]>0) break;
    }
    for (b=width_bits-1; b>=0; b--) {
    slice_width = 2**b;
    if (l.sampleImage([left + slice_width/2, randomPos[1]], [slice_width/2, 1],includeEffects)[3]<=threshold) {
    left+=slice_width;
    }
    if (l.sampleImage([w - (right + slice_width/2), randomPos[1]], [slice_width/2, 1],includeEffects)[3]<=threshold) {
    right+=slice_width;
    }
    }
    right= w-right;
    top = 0; bottom = 0;
    for (b=height_bits-1; b>=0; b--) {
    slice_height = 2**b;
    if (l.sampleImage([randomPos[0], top + slice_height/2], [1, slice_height/2],includeEffects)[3]<=threshold) {
    top+=slice_height;
    }
    if (l.sampleImage([randomPos[0], h - (bottom + slice_height/2)], [1, slice_height/2],includeEffects)[3]<=threshold) {
    bottom+=slice_height;
    }
    }
    bottom = h-bottom;
    // choose a random direction
    switch (Math.floor(random(4))) {
    case 0:
    [randomPos[0], top];
    break;
    case 1:
    [randomPos[0], bottom];
    break;
    case 2:
    [left, randomPos[1]];
    break;
    default:
    [right, randomPos[1]];
    }
  • So what codec did you export to? Could it be the codec that’s introducing the edges because of chroma compression (mp4/h264)

  • Filip Vandueren

    January 19, 2023 at 2:06 pm in reply to: Trigger an action by luminance

    And where along the shape should it be ? Random ? At a certain angle ? At a certain X-position ?

  • Filip Vandueren

    January 19, 2023 at 11:48 am in reply to: Trigger an action by luminance

    By automated, do you mean that running auto-trace on the image and then using the resulting mask is not an option ?

    It would need to automatically fit on a shape if something new is dropped in the comp ?

Page 20 of 277

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