Forum Replies Created

Page 54 of 65
  • Andrei Popa

    January 24, 2019 at 7:44 am in reply to: Control speed of text tracking

    What do you want your expression to do exactly? Because this seems bizarre. Is this applied to your tracking property? Because it increases it to 2 until it arrives to 2 seconds, then it is 0, then it grows during the last 1.55 seconds of your layer.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    January 19, 2019 at 2:31 pm in reply to: Layer Markers on Text Layer

    This should do it

    var myComp=app.project.activeItem;
    var myMarker = new MarkerValue("anything");
    var myLayer = myComp.selectedLayers[0]
    myLayer.property("Marker").setValueAtTime(myLayer.inPoint+2, myMarker);

    Andrei
    My Envato portfolio.

  • Andrei Popa

    January 18, 2019 at 3:04 pm in reply to: Locating and styling a specific word in a textfield.

    Update. On my system, this did not work if there were “enter” characters before the highlited word. Every “enter” would offset the highlight by 1. Seems like after effects uses “\r” character for new lines. So this is the final form of the expressions.
    For start:
    redWord = thisComp.layer("textB")("Text")("Source Text");
    newLines = thisLayer("Text")("Source Text").split("\r").length -1;
    if ( thisLayer("Text")("Source Text").indexOf(redWord) > -1){
    thisLayer("Text")("Source Text").indexOf(redWord)-newLines;
    }else{
    0
    }

    And for end:
    redWord = thisComp.layer("textB")("Text")("Source Text");
    newLines = thisLayer("Text")("Source Text").split("\r").length -1;
    if ( thisLayer("Text")("Source Text").indexOf(redWord) > -1){
    thisLayer("Text")("Source Text").indexOf(redWord)+redWord.length-newLines
    }else{
    0
    }

    Andrei
    My Envato portfolio.

  • Andrei Popa

    January 18, 2019 at 2:51 pm in reply to: Locating and styling a specific word in a textfield.

    redWord = thisComp.layer("textB")("Text")("Source Text");
    if ( thisLayer("Text")("Source Text").indexOf(redWord) > -1){
    thisLayer("Text")("Source Text").indexOf(redWord)
    }else{
    0
    }

    and
    redWord = thisComp.layer("textB")("Text")("Source Text");
    if ( thisLayer("Text")("Source Text").indexOf(redWord) > -1){
    thisLayer("Text")("Source Text").indexOf(redWord)+redWord.length
    }else{
    0
    }

    But still does not work well if you have enters in your text. Was trying for a solution because split(“\n”) did not seem to work. Will post here if i manage to find one.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    January 18, 2019 at 2:35 pm in reply to: Locating and styling a specific word in a textfield.

    Apply a color animator to your textA with the desired color for the word. Go to “Animator>Advanced” and change “Units” to “Index” and “Based on” to “Characters”

    Then, on range selector add this expressions.

    This to start:
    thisLayer("Text")("Source Text").indexOf(thisComp.layer("textB")("Text")("Source Text"))

    And this to End:

    redWord = thisComp.layer("textB")("Text")("Source Text");
    thisLayer("Text")("Source Text").indexOf(redWord)+redWord.length

    Andrei
    My Envato portfolio.

  • Andrei Popa

    January 18, 2019 at 7:08 am in reply to: Generate Markers from text file

    This should work. Select the layer you want to use the script on and then run it

    var myMarker = new MarkerValue("Insert Comment Here");//leave blank for empty
    var frameDuration = app.project.activeItem.frameDuration;
    var myFile = File.openDialog("Please select your marker file");
    var framesArray = extractDataFromFile(myFile);
    var timeArray = (framesArray!=null) ? framesToTime(framesArray) : [];//framesArray must be an array with the numbers from your file
    var myLayer = app.project.activeItem.selectedLayers[0];

    for (var i=0; i < timeArray.length; i++){
    myLayer.property("Marker").setValueAtTime(timeArray[i], myMarker);
    }

    function framesToTime(framesArray){
    var timeArray =[];
    for (var i=0; i < framesArray.length; i++){
    timeArray.push(framesArray[i]*frameDuration);
    }
    return timeArray;
    }

    function extractDataFromFile(myFile){
    if (!myFile) return;
    markerData = [];
    if (myFile.open("r")){
    while(!myFile.eof){
    var frameNumber = parseFloat(myFile.readln());
    markerData.push(frameNumber);
    }
    return markerData;
    }else alert("Could not open your file");
    }

    Andrei
    My Envato portfolio.

  • Andrei Popa

    January 14, 2019 at 9:37 am in reply to: Generate Markers from text file

    You should save all those frame numbers in an array.
    then, to put markers on the layer use this
    var myMarker = new MarkerValue("Insert Comment Here");//leave blank for empty
    var frameDuration = app.project.activeItem.frameDuration;
    var timeArray = framesToTime(framesArray);//framesArray must be an array with the numbers from your file

    for (var i=0; i < timeArray.length; i++){
    myLayer.property("Marker").setValueAtTime(timeArray[i], myMarker);
    }

    function framesToTime(framesArray){
    var timeArray =[];
    for (var i=0; i < framesArray.length; i++){
    timeArray.push(framesArray[i]*frameDuration);
    }
    return timeArray;
    }

    Andrei
    My Envato portfolio.

  • Andrei Popa

    October 11, 2018 at 7:40 am in reply to: Fade in and out on each marker

    Magic, again. Thank you very much.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 9, 2018 at 7:17 am in reply to: Attach anchorpoint to the center of the layer

    I don’t think you can. But you have some sort of workaround. Make a null, put it in the middle of your layer, parent your layer to it and apply the transformations you need to the null.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    August 3, 2018 at 2:57 pm in reply to: Png problem in script GUI on Mac computer

    Fixed it finally. Turns out i failed to test it without the files… Or something. Today i got the same error.

    Andrei
    My Envato portfolio.

Page 54 of 65

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