Forum Replies Created

Page 53 of 65
  • Andrei Popa

    February 9, 2019 at 7:46 am in reply to: dima23071991@gmail.com

    You can’t. The best thing you can do is create 3 layers, and make only one visible, according to the selected checkbox. For that, you will need something like this to the opacity of every layer

    check = thisComp.layer("Control")("Font_Arial")("Checkbox");
    (check == true) ? 100 : 0;

    and to the checkbox value you need something like this :

    check1 = thisComp.layer("Control")("Font_Arial")("Checkbox");
    check2 = thisComp.layer("Control")("Font_Algerian")("Checkbox");
    (check1 == true || check2 == true) ? 0 : 1;

    This is for your last checkbox. In each, you write the other 2 as variable

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 9, 2019 at 7:37 am in reply to: Rotation counter

    In the “Source Text” property write this expression:

    rot=thisComp.layer("Shape Layer 1")("Transform")("Rotation");//here you can pickwhip the rotation property of the layer you need to count
    Math.floor(rot/360)

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 6, 2019 at 3:05 pm in reply to: Search for a layer in comp

    Here you go.

    var myLayer = searchLayer ("XYZ");

    function searchLayer(layerName){
    var myComposition = app.project.activeItem;
    if(myComposition instanceof CompItem){
    for (var i = 1; i<=myComposition.numLayers;i++){
    if (myComposition.layer(i).name == layerName){
    myComposition.layer(i).remove();
    return null;
    }
    }
    return myComposition.layers.addText(layerName);
    }else{
    alert("This is not a composition");
    }
    }

    The “myLayer” c=variable is null if it just deleted a text or it is the actual text layer if it just created one. You can change the “addText” function if you want to add different layers.

    Andrei
    My Envato portfolio.

  • Maybe you could make it very long in the first place. Think what max duration of your comp might be, and make the solid that duration. To do that without script, just click the time stamp in the left side of the timeline area. And there write the max duration you think it could have(in hours:min:seconds:frames. Ex: 1200 for 12 seconds,11200 fo one minute 12 seconds). Now, with your layer selected, hit ] on your keyboard. Now your solid is this length. If you make your comp bigger, the solid is already bigger.

    Andrei
    My Envato portfolio.

  • Are you sure you are searching for a script? Because a script would need you to press a button or some similar action to trigger the modification of the length of the solid. However, if a script is what you are searching for, this could help


    myLayer = app.project.activeItem.selectedLayers[0];//Make sure your layer is selected
    myLayer.outPoint = (app.project.activeItem instanceof CompItem) ? app.project.activeItem.duration : myLayer.outPoint;

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 6, 2019 at 11:52 am in reply to: Alternate change the x,y size.

    Precisely what i was looking for. Thanks, Dan.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 3, 2019 at 10:58 am in reply to: Check if folder exists

    Ok. So here is how i would do this. Haven’t tested it because i am not at the office. But i think this should work. As an advice, i think you should write your main code at the start and the functions at the end. That way, you can easily see what your code tries to do before going into depths.

    var fCompositions = getFolderByName("CNM");
    var comps = getCompositions(app.project);
    for (var i=0; i< comps.length;i++){
    comps[i].parentFolder=fCompositions;
    }

    function getCompositions(myProject){
    if (myProject == null) return;
    var allComps=[];
    for (var i=1; i<=myProject.numItems; i++){
    var currentComp = myProject.item(i);
    if (currentComp instanceof CompItem && currentComp.name.substring(0,4)=="CNM_"){
    allComps.push(currentComp);
    }
    }
    return allComps;
    }

    function getFolderByName(folderName) {
    if (app.project == null) return;
    var myProject = app.project;
    for (var i = 1; i <= myProject.numItems; i++) {
    if ((myProject.item(i) instanceof FolderItem) && (myProject.item(i).name == folderName)){
    return myProject.item(i);
    }
    }
    myFolder = myProject.items.addFolder(folderName);
    return myFolder;
    }

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 2, 2019 at 3:39 pm in reply to: selectedLayers change event

    You can not listen to events in the project with a script. onChange only works when something in the script changes(I meanin the UI of the script). I think in order to be able to do that you need to build a plugin, but those are completely other story. The best way to trigger events remains the use of a button.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 2, 2019 at 12:45 pm in reply to: Check if folder exists

    I happen to have this function in my library of useful functions;
    function getFolderByName(folderName) {
    var myProject = app.project;
    for (var i = 1; i <= myProject.numItems; i++) {
    if ((myProject.item(i) instanceof FolderItem) && (myProject.item(i).name == folderName)){
    return myProject.item(i);
    }
    }
    myFolder = myProject.items.addFolder(folderName);
    return myFolder;
    }

    use it as myFolder = getFolderByName("CNM");

    Andrei
    My Envato portfolio.

  • Andrei Popa

    January 30, 2019 at 11:47 am in reply to: Duplicating 1 character in a word

    For full modularity, use 2 sliders. Character Index and Repetitions.
    In the source text write this expression


    var sourceText = thisLayer("Text")("Source Text").value;
    var charIndex = thisLayer("Effects")("Character Index")("Slider")-1;
    var character = sourceText[charIndex];
    var repetitions = thisLayer("Effects")("Repetitions")("Slider")+1;
    sourceText.slice(0,charIndex)+Array(repetitions).join(character)+sourceText.slice(charIndex+1);

    Andrei
    My Envato portfolio.

Page 53 of 65

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