Forum Replies Created

Page 94 of 1081
  • Dan Ebberts

    April 4, 2022 at 3:43 pm in reply to: Parented scale plus 10%

    Like this maybe:

    thisComp.layer("Layer 1").transform.scale*1.1
  • Dan Ebberts

    April 4, 2022 at 1:31 pm in reply to: increment text layer

    I’m having trouble figuring out where words vs. characters factors into this. Can you provide more info?

  • Dan Ebberts

    April 2, 2022 at 4:15 pm in reply to: Convert 40 Compositions into 40 AE Projects

    I haven’t tried it, but you should look at the Save Comp as Project 2 script at AEScripts.

  • Dan Ebberts

    April 1, 2022 at 7:23 pm in reply to: Editable text from CSV

    This is just a snippet to get you started. It assumes that your comp is active and the text layer is named “Text Layer 1”:

    var myTextLayer = app.project.activeItem.layer("Text Layer 1");

    var mySourceText = myTextLayer.property("ADBE Text Properties").property("ADBE Text Document");

    var myTextDoc = mySourceText.value;

    var myText = myTextDoc.text;

    myText = myText.replace(/\r?\n|\r/g, ' '); // replace new lines with spaces

    mySourceText.expressionEnabled = false;

    myTextDoc.text = myText;

    mySourceText.setValue(myTextDoc)

  • Dan Ebberts

    March 31, 2022 at 9:54 pm in reply to: Editable text from CSV

    The only thing I can think of would be to use a script to either apply the text from the CSV (instead of using and expression), or to run after you have everything set up and have the script harvest the CSV-generated text and apply it directly to the source text property (and turn off the exrpession). Don’t know if using a script fits your workflow though…

  • I’m still not sure I have it pictured exactly correctly yet, but this variation, applied to the controller null’s scale, should fit the shape to the “main” comp:

    L = thisComp.layer("Shape Layer 1");

    r = L.sourceRectAtTime(time,false);

    ul = L.toComp([r.left,r.top]);

    lr = L.toComp([r.left+r.width,r.top+r.height]);

    w = lr[0] - ul[0];

    h = lr[1] - ul[1];

    if (comp("main").width/comp("main").height > w/h)

    s = comp("main").height/h

    else

    s = comp("main").width/w;

    [s,s]*100

  • It’s hard to picture exactly how you have things set up, but if you have “Shape Layer 1” in a precomp named “shape”, a scale expression like this on the precomp layer “shape” in the main comp, it should fit the shape to the main comp’s size:

    L = comp("shape").layer("Shape Layer 1");

    r = L.sourceRectAtTime(time,false);

    ul = L.toComp([r.left,r.top]);

    lr = L.toComp([r.left+r.width,r.top+r.height]);

    w = lr[0] - ul[0];

    h = lr[1] - ul[1];

    if (thisComp.width/thisComp.height > w/h)

    s = thisComp.height/h

    else

    s = thisComp.width/w;

    [s,s]*100

    Sorry if that’s no help at all…

  • Dan Ebberts

    March 31, 2022 at 12:14 am in reply to: If ”not ” active

    Like this, I think:

    if(! thisComp.layer("Mention").active && y>50) 100
  • Dan Ebberts

    March 28, 2022 at 11:32 pm in reply to: Alternative to “\r”

    I think you just have to double escape it with a double back slash:

    var myProp = app.project.activeItem.layer(1).property("Text").property("Source Text");

    var myExpr = '"This is a\\rmulti-line test."';

    myProp.expression = myExpr;

  • Unfortunately, a lot of the code posted before this site did its most recent upgrade got mangled in the upgrade process. It’s usually where straight quotes get replaced with smart quotes and hyphens get replace with em (or en ?) dashes. In any case, try this cleaned up version:

    function convertToKeyframes(theProperty){

    if (theProperty.canSetExpression && theProperty.expressionEnabled){

    theProperty.selected = true;

    app.executeCommand(app.findMenuCommandId("Convert Expression to Keyframes"));

    theProperty.selected = false;

    }

    }

    var myComp = app.project.activeItem;

    if (myComp && myComp instanceof CompItem){

    var myLayer;

    var myProperty;

    app.beginUndoGroup("convert expressions");

    for (var i = 1; i <= myComp.numLayers; i++){

    myLayer = myComp.layer(i);

    try{

    myProperty = myLayer.property("position");

    convertToKeyframes(myProperty);

    }catch(err){

    }

    try{ myProperty = myLayer.property("anchorPoint");

    convertToKeyframes(myProperty);

    }catch(err){

    }

    try{

    myProperty = myLayer.property("rotation");

    convertToKeyframes(myProperty);

    }catch(err){

    }

    try{ myProperty = myLayer.property("scale");

    convertToKeyframes(myProperty);

    }catch(err){

    }

    try{

    myProperty = myLayer.property("opacity");

    convertToKeyframes(myProperty);

    }catch(err){

    }

    }

    app.endUndoGroup();

    }

Page 94 of 1081

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