Forum Replies Created

Page 23 of 277
  • Filip Vandueren

    November 22, 2022 at 2:58 pm in reply to: Expression with 'carriage return' via script

    probably \\n ?

  • Filip Vandueren

    November 21, 2022 at 1:46 pm in reply to: Apply preset, set values

    Possibly, when you use the first applyPreset, or setValue, the other layers get deselected, so looping through selectedLayers stops.

    check if this works:

    var mySelectedLayers = app.project.activeItem.selectedLayers.slice();

    slicing the array should give a copy of the list of layers instead of a reference to the same object

  • Filip Vandueren

    November 21, 2022 at 1:39 pm in reply to: Insert Line Break every X number of characters

    The “bound paragraph” methos should still work if the text’s driven by markers.
    I think you’ll only need to change the first line of the sourceText parameter.

    But to be clear: that’s only if you absolutely need dynamic (moving) margins/width and reflowing.

    For subtitles, why not use a regular box-text and let that do the wrapping ?

  • Filip Vandueren

    November 18, 2022 at 3:02 pm in reply to: toFixed() for all iterations after “.join()

    Hi Kira,

    it depends.

    If it’s ok that “a” becomes an array of string-representations of the numbers with just 3 decimals:

    a=[];
    for (i=1; i<10; i++) {
    a.push(random(998+i).toFixed(3));
    }
    a.join("\r");

    if you need “a” to still have the numbers with full precision, but want a string list with 3 decimals:

    a=[];
    for (i=1; i<10; i++) {
    a.push(random(998+i));
    }
    a.map( n => n.toFixed(3)).join("\r");

    this will not alter the numbers in a.

  • Filip Vandueren

    November 17, 2022 at 9:31 am in reply to: Remove black background in Adobe video

    The Effect you’re looking for to do a Luma-based key is Keying > Extract.

    (Edit: Color Range in RGB-space with plenty of fuzziness, or Linear Color Key can also work, but Keyers based on Chroma won’t)

    Usually I follow it with Channel > “Remove Color Matting” to get rid of some black fringes.

    You’ll have to manually mask back in some black areas (like the pupils or shadowy mouth for example) that you don’t want to be transparant.

  • Filip Vandueren

    November 16, 2022 at 2:16 pm in reply to: Replace decimal zero’s with dash

    Yes, I didn’t put that in a code-block, so the wordpress layouter changed the quotes to curly brackets, this gives an error when copy-pasting…

    This is what it could have been:

    new Intl.NumberFormat('nl-NL', {
    style: 'currency',
    currency: 'EUR',
    useGrouping: true
    }).format(v).replace(",00",",—");
  • Filip Vandueren

    November 15, 2022 at 6:08 pm in reply to: animate the amount of text on a path (After Effects)

    Hey,

    add a slider to your Text Layer,

    the give the sourceText this expression:

    numChars = Math.floor(effect("Slider Control")("Slider").value);
    value.substr(0,numChars)+"\u200b";

    The slider now controls how many characters are visible.

    Adding the +”\u200b” (unicode character #200B = a zero width space), this makes the start and end characters line up with the same spacing as all the other characters along the path do.

    If you omit this, they will hug each other without any spacing.

  • Hey Thomas,

    It shouldn’t be a problem because just like your original code, this method only needs to look at the keyframes, and not every individual frame, the for loop never gets very long, and that’s the thing that would take up most time if it runs into the thousands.

  • Filip Vandueren

    November 14, 2022 at 10:48 am in reply to: Replace decimal zero’s with dash

    Dag Gerben,

    try this tweak:

    new Intl.NumberFormat('nl-NL', {
    style: 'currency',
    currency: 'EUR',
    useGrouping: true
    }).format(v).replace(/00$/gi,"—");

    Don’t worry about the $, in this case it doesn’t mean a dollar, but 00 “at the end of a string”, so € 100,00 doesn’t become 1–,–.

    just using .replace(“,00”, “,–”) could work too actually.

  • Hi Thomas,

    I think the problem is that inside of the expression, you want to keep track of the result of the same expression at a different time with valueAtTime, and that’s not how expressions work; they can find out the expression result of a different property at any time, but when looking at their own valueAtTime, they only see the originally-set or keyframed value before expressions.

    Because of this, starting/stopping or variably controlling the speed of something using expressions is not straightforward at all.
    Dan has written an excellent article about that many years ago: https://www.motionscript.com/articles/speed-control.html

    IF your cycle duration and angle A are not also keyframed, then this variation on the hold keyframe method described in the article should work:

    spd = thisComp.layer("Spotlight Control").effect("Play (1st key)")("Checkbox");
    n = spd.numKeys;
    cyc = 360/thisComp.layer("Spotlight Control").effect("Cycle Duration (sec)")("Slider").value;
    if (n > 0 && spd.key(1).time < time){
    accum = spd.key(1).value*(spd.key(1).time - inPoint)*cyc;
    for (i = 2; i <= n; i++){
    if (spd.key(i).time > time) break;
    k1 = spd.key(i-1);
    k2 = spd.key(i);
    v2 = spd.valueAtTime(k2.time-.001);
    accum += cyc*(k1.value + v2)*(k2.time - k1.time)/2;
    }
    accum += cyc*(spd.value + spd.key(i-1).value)*(time - spd.key(i-1).time)/2;
    }else{
    accum = cyc*spd.value*(time - inPoint);
    }
    thisComp.layer("Spotlight Control").effect("Angle A")("Slider") + accum;

    If those parameters (cycle duration and startangle) could be keyframed, especially with easing, then stuff gets a lot more complicated.

    Then we’d wind up using the slower brute-force method of stepping through every previous frame by frame to calculate a correct running total (accum) of checkbox.valueAtTime*cyc.valueAtTime + angleA.valueAtTime.

Page 23 of 277

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