Forum Replies Created

Page 48 of 65
  • Andrei Popa

    July 17, 2019 at 10:49 am in reply to: Linking Velocity to Slider

    If you want to also consider the actual value of the property, you must add it. So the last line should be “value + ” whatever you have there.

    Andrei
    My Envato portfolio.

  • Or we can make it like this so it looks even better:

    var selection = app.project.selection;
    var mySelectedItems = findSel (selection);
    alert(mySelectedItems);

    function findSel(selection){
    var selAry = []

    for (var i=0;i<selection.length;i++){
    var currentItem= selection[i];

    if(currentItem.typeName != "Folder"){
    selAry.push(currentItem);
    }else{
    selAry.push(currentItem);
    folderSearch(currentItem);
    }
    }

    function folderSearch(myFolder){

    for (var i=1; i<=myFolder.items.length; i++){
    var curFolderItem = myFolder.items[i];

    if(curFolderItem.typeName != "Folder"){
    selAry.push(curFolderItem);
    }else{
    selAry.push(curFolderItem);
    folderSearch(curFolderItem);
    }
    }
    }

    return selAry;
    }

    Andrei
    My Envato portfolio.

  • Please try to use as few global variables as possible. With many of them, it’s easy to just see where they have gone sideways as value. Just declare values locally and pass them as function argumentts. Also, try to put var in front of the for variable. I will try to reproduce your code as i would make it.

    var selection = app.project.selection;

    function findSel(selection){
    var selAry = []

    for (var i=0;i<selection.length;i++){
    var currentItem= selection[i];

    if(currentItem.typeName != "Folder"){
    selAry.push(currentItem);
    }else{
    selAry.push(currentItem);
    folderSearch(currentItem);
    }
    }

    function folderSearch(myFolder){

    for (var i=1; i<=myFolder.items.length; i++){
    var curFolderItem = myFolder.items[i];

    if(curFolderItem.typeName != "Folder"){
    selAry.push(curFolderItem);
    }else{
    selAry.push(curFolderItem);
    folderSearch(curFolderItem);
    }
    }
    }

    return selAry;
    }

    var mySelectedItems = findSel (selection);
    alert(mySelectedItems)

    The mySelectedItems variable is the array that contains the selected items. Last alert is just for checking.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    July 16, 2019 at 10:01 am in reply to: Change Color of text inside parenthesis

    Hey. Thank you very much for the kind word, it really means a lot.

    Now. To make the letters also italic, just click the add(from where you added expression selector), select Property and then Skew. Now modify the Skew value to what you wish.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    July 12, 2019 at 2:43 pm in reply to: Change Color of text inside parenthesis

    Nvm, i got this. The kind of problem that does not go out of your head…

    var t = text.sourceText;
    var splitText = t.split("\r");
    var regex = /\(([^)]+)(?=\))/g;

    function indexMatched(index){
    var matched = false;
    var match;
    while ((match = regex.exec(t)) !== null){
    matched |= match.index<index & index<match.index+match[0].length;
    }
    return matched;
    }

    function placeInLines(index){
    i=0;
    maxIndex = 0;
    while(index>maxIndex){
    maxIndex += splitText[i].length;
    i+=1;
    }
    return i-2;
    }

    indexMatched(textIndex+placeInLines(textIndex)) ? 100 : 0;

    Still, i think there are better solutions. I would like to see someone solve this in a more elegant manner.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    July 12, 2019 at 2:21 pm in reply to: Change Color of text inside parenthesis

    That is because the amount selector does not count the enters at the end of the line. This works for multiple paratheses, as long as they are only on the first line or in a textbox. I can’t think of a solution right now. The best i can come up with is split into multiple layers so you don’t need to use enter before any paratheses.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    July 12, 2019 at 1:43 pm in reply to: Change Color of text inside parenthesis

    I am pretty sure you put the expression where it was not supposed to be.

    Here is a short screen rec.
    13527_tutorial.mp4.zip

    Andrei
    My Envato portfolio.

  • Andrei Popa

    July 12, 2019 at 11:48 am in reply to: Change Color of text inside parenthesis

    Without the i part…

    var t = text.sourceText;
    var regex = /\(([^)]+)(?=\))/g;

    function indexMatched(index){
    var matched = false;
    var match;

    while ((match = regex.exec(t)) !== null){
    matched |= match.index

    Andrei
    My Envato portfolio.

  • Andrei Popa

    July 12, 2019 at 7:20 am in reply to: Change Color of text inside parenthesis

    I’m not that good with regular expressions, but i remembered this post of Oleg Pirogov and after few searches on Stack Overflow i came up with this. Worked on my test. I used two occurences, one with space and one without.

    So add a text animator, fill color, rgb. To this animator add selector>expression. In the expression field write this:

    var t = text.sourceText;
    var regex = /\(([^)]+)(?=\))/g;

    function indexMatched(index){
    var matched = false;
    var match;
    var i=[];

    while ((match = regex.exec(t)) !== null){
    matched |= match.index

    Andrei
    My Envato portfolio.

  • Andrei Popa

    July 11, 2019 at 12:02 pm in reply to: Interpolating animation

    Depends if your y grows or dimishes. Did not think that through. If your y is smaller at the 3rd key, you should change the last 2 values of the linear function like this:

    if (time>key(2).time){
    x = linear(position[0], key(2).value[0], key(3).value[0], key(2).value[0], thisComp.layer("Control Null")("Transform")("Position")[0]);
    y = linear(position[1], key(2).value[1], key(3).value[1], thisComp.layer("Control Null")("Transform")("Position")[1], key(2).value[1]);
    [x,y]
    }else{
    value
    }

    Andrei
    My Envato portfolio.

Page 48 of 65

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