Forum Replies Created

Page 1 of 65
  • Thank you Vasyl,

    That is exactly what I was looking for.

  • I dont think I need it to be there between the lines. I can create a rectangle that will follow the text size. I just want to find out if there is a way to make it round when it intersects the alpha mask.

    Thank you for your insight

  • Andrei Popa

    October 11, 2024 at 2:38 pm in reply to: Create a random Path on a checkerboard

    Here is a solution that I think works for no overlapping of segments.

    You can modify segmentLenght and segmentNumber to what you need. You can also linke these to slider controllers for changing then easier.

    var segmentLength = 10;
    var segmentNumber = 100;
    seedRandom(index, 1);
    var lastIndex = 0;
    Array.prototype.customIndexOf = function (element) {
    for (var i = 0; i < this.length; i++) {
    if (this[i][0] === element[0] && this[i][1] === element[1]) {
    return i;
    }
    }
    return -1;
    };
    function nextPoint() {
    var crtPoint = points[lastIndex];
    var movement = randomStr(freeDirections[lastIndex]);
    freeDirections[lastIndex] = freeDirections[lastIndex].replace(movement, "");
    doMovement(crtPoint, movement);
    }
    function doMovement(point, movement) {
    var newPoint = point + move[movement];
    myPath.push(newPoint);
    if (points.customIndexOf(newPoint) == -1) {
    lastIndex = points.length;
    points.push(newPoint);
    } else {
    lastIndex = points.customIndexOf(newPoint);
    }
    if (freeDirections[lastIndex] == undefined) {
    freeDirections[lastIndex] = "dulr".replace(opposite[movement], "");
    } else {
    freeDirections[lastIndex] = freeDirections[lastIndex].replace(opposite[movement], "");
    }
    }
    function randomStr(str) {
    return str[Math.floor(Math.random() * str.length)];
    }
    var move = {
    "d": [0, 1],
    "u": [0, -1],
    "l": [-1, 0],
    "r": [1, 0]
    }
    var opposite = {
    "d": "u",
    "u": "d",
    "l": "r",
    "r": "l"
    }
    //initialize the myPath
    //first point has all the directions possible
    freeDirections = ["dulr"];
    //first point is [0,0], this is paired in indexes with the freeDirections array
    var points = [[0, 0]];
    //the points through which we went so far
    var myPath = [[0, 0]];
    for (var i = 0; i < segmentNumber; i++) {
    nextPoint();
    }
    createPath(myPath.map(x => x * segmentLength), [], [], false);
  • Andrei Popa

    October 11, 2024 at 1:39 pm in reply to: Create a random Path on a checkerboard

    I think a path without crossroads is actually easier to make than one without overlapping.

    For your final purpose, do you need one without crossroads? Or maybe both?

  • Andrei Popa

    October 11, 2024 at 12:47 pm in reply to: Create a random Path on a checkerboard

    Should the segments touch the path? Can you, for example, have a cross-roads made up with this segments?
    If yes, you will have cases where the segments would go inside a dead end.

    LE.
    I don’t think they will overlap if we do not allow overlap. I will give this some thought and come back with the result.

  • Andrei Popa

    October 10, 2024 at 9:24 am in reply to: Make bars from text rows

    Hi John,

    Thanks a lot for the response. This is perfect. It looks a lot cleaner and it seems to take 10ms less per frame to render.

    I have only used the blur and level effects, since I use this as alpha, and don’t really care for inside colors.

    Thanks again for your response,

    Andrei

  • Hi Arie.

    I had the same problem with some arabic languages, while using the Noto fonts provided by google.

    I had to change the expression because the font was too high, so I subtract half of the font size from the entire height. This still counts badly if the first row consists in only characters with very small height, like “. _ ,”, but I think that case will be very rare. You can also choose at which point in time you want to calculate the number of rows. This is especially useful when you have text animators that alter the sourceRectAtTime height, so you want to put there the timestamp where your text is finished animating.

    //L=layer, T=time
    function getNumRows(L, T) {
    var H = L.sourceRectAtTime(L.sourceTime(T), false).height;
    var myStyle = L.text.sourceText.style;
    myFontSize = myStyle.fontSize;
    myLeading = myStyle.autoLeading ? myFontSize * 1.2 : myStyle.leading;
    return Math.ceil((H - myFontSize * 0.5) / myLeading);
    }
    getNumRows(thisLayer, 0)


    Andrei

  • Andrei Popa

    September 30, 2024 at 6:14 pm in reply to: Text animation line by line from top to bottom

    You should adjust the anchor point expression

    t = 0;
    l = thisLayer.sourceRectAtTime(sourceTime(t), false);
    [l.left, l.top + l.height];

    Instead of 0, you should give t the value that the time has where your text animation is fully finished. So if your text is fully animated at second 3, t = 3.

  • Hi Max,

    There are quite a few expressions to be used there.
    I have done a small template for this, I hope this helps.

    r2 is the parent for all the rectangles and its text;

    all the texts are parented to their rectangles

    all the texts have anchor expression to their center

    all the texts must be one index smaller in timeline. You can’t put any layers between them because they are referred by “index-1” when calculating the rectangle sizes.

    all the rectangles have a point control effect on them, named “Diff”, which dictates how much bigger than the text sourceRect they are

    Let me know if you have any questions.

    Cheers,

    Andrei

  • Andrei Popa

    September 23, 2024 at 3:54 pm in reply to: Text color without ponctuation

    I see 2 solutions for this problem.

    1. Just remove the ‘ character from the group of characters to ignore. (row 5 becomes var punctuation = “,.!?;:”;)

    2. I will alter a bit the expression to ignore punctuation that does not have a space after it. Keep in mind that this will also alter “2.3” for example, and the dot will be highlighted.


    function getCharIndicesFromWordIndices(str, wordIndices) {
    var words = str.split(/\s+/);
    var charIndices = [];
    var currentCharIndex = 0;
    var punctuation = ",.!?;:'";
    for (var i = 0; i < words.length; i++) {
    if (wordIndices.indexOf(i) !== -1) {
    for (var j = 0; j < words[i].length; j++) {
    if (!((punctuation.indexOf(words[i][j]) != -1) && j == words[i].length - 1)) charIndices.push(currentCharIndex + j);
    }
    }
    currentCharIndex += words[i].length + 1; // +1 for the space
    }
    return charIndices;
    }
    wordIndices = thisComp.layer("hilite").text.sourceText.split("+");
    var x = getCharIndicesFromWordIndices(text.sourceText, wordIndices.map(x => parseInt(x) - 1));
    x.indexOf(textIndex - 1) != -1 ? 100 : 0;


Page 1 of 65

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