Forum Replies Created

Page 1 of 3
  • James Ronan

    May 30, 2019 at 3:13 pm in reply to: Exclude last word from a sentence.

    Hey Dario

    How about this:


    text_array1 = thisComp.layer("\\FILENAME.csv")("Data")("Outline")("\\PLAYER")("\\PLAYER0").toUpperCase().split(" ");
    firstInitial = text_array1[text_array1.length-1].split("")[0];
    if (text_array1.length > 2){
    text_array1[0] + " " + text_array1[1] + " " + firstInitial;
    } else if (text_array1.length == 2) {
    text_array1[0] + " " + firstInitial;
    } else {
    text_array1[0];
    };

    It assumes that a surname will never be more than 2 words.

  • Ah thanks for the reply Alex! That makes more sense!

    So it’s still not working working for me unfortunately. It works in a text layer… I can see it counting up.

    But when used on a position property, rotation etc. it still doesn’t work and only shows the initial value written at the start.

    Any idea why? Thanks again!!!

    James

  • James Ronan

    February 11, 2019 at 1:32 pm in reply to: Ho to read layer name from slider control?

    Hey

    Try something like this:


    layIndex = parseInt(effect("Slider Control")("Slider").value);
    thisComp.layer(layIndex).effect("TOP")("Checkbox");

  • James Ronan

    September 25, 2018 at 8:41 pm in reply to: Accessing second layer parameter from script

    Yeah as Dan says I don’t think you can. but you could try saving a preset (.ffx) with it already set to Mask, and add that instead.

  • James Ronan

    September 22, 2018 at 8:18 am in reply to: Identifying a Video or image ExtendScript

    Here is a basic example of determining whether it’s an image or video:
    It didn’t omit odd file names for me.

    var targetFolder = File("/Users/avinashramanath/Desktop/Video");
    var compFolder = app.project.items.addFolder("Assets");

    if (targetFolder) {

    var files = targetFolder.getFiles();

    for (var i = 0; i <= files.length; i++) {

    try {

    var importOptions = new ImportOptions(files[i]);
    var newItem = app.project.importFile(importOptions);

    if (newItem instanceof FootageItem && !newItem.mainSource.isStill) { // Check if Video or image

    newItem.parentFolder = compFolder;

    }

    } catch (error) { /*alert(error.toString());*/ }

    }
    }

  • James Ronan

    September 21, 2018 at 2:19 pm in reply to: Identifying a Video or image ExtendScript

    If that’s all you want to do, you don’t need to loop through all the items in the project:


    var myPath = "/Users/avinashramanath/Desktop/Video/1.mp4";

    newFootageItem = app.project.importFile(new ImportOptions(new File(myPath)));

    var compFolder = app.project.items.addFolder("Videos");
    newFootageItem.parentFolder = compFolder ;

  • Ah I understand. Your original expression is working for me when used on the opacity property of layer A.

    Are you getting an error?

  • Your expression works for me, but it fades in based on “whatever1” inPoint, and fades out on another layer “whatever2” outPoint… Is that what you want?

    If you want you to fade in and out based only one other layers layers in and outPoints (e.g. “whatever1”) try this:


    fade = 1;
    x = thisComp.layer("whatever1");
    fadein = (time - x.inPoint)/fade;
    fadeout = (x.outPoint - time)/fade;
    if(time < x.inPoint + fade)(linear(fadein,0,1)*value)
    else if(time > x.outPoint - fade)(linear(fadeout,0,1)*value)
    else (value)

    Hope that helps.

  • James Ronan

    September 18, 2018 at 1:15 pm in reply to: Using object position to drive counter expressions.

    It should already allow you to add multiple keyframes, if thats what you mean.

  • James Ronan

    September 14, 2018 at 7:59 am in reply to: Using object position to drive counter expressions.

    This should remove the decimal after the last keyframe, and allow you to add multiple keyframes for pausing:

    try{
    var rA = [0,24,37,2,10,80,60,55,80,23]; // result Array
    var cursor = thisComp.layer("cursor"); // layer you choose to animate the x axis position
    var xPos = cursor.position[0];
    var startPos = cursor.position.key(1).value[0];
    var endPos = cursor.position.key(cursor.position.numKeys).value[0];
    var aryN = linear(xPos,startPos,endPos,0,rA.length);
    var aryNPrev = Math.floor(aryN);
    var aryNNext = Math.ceil(aryN);
    var txt = linear(aryN,aryNPrev,aryNNext,rA[aryNPrev],rA[aryNNext]);
    txt.toFixed(0);
    } catch (err){
    rA[rA.length-1].toFixed(0)
    }

    Ah no worries dude. Happy to help!

Page 1 of 3

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