Forum Replies Created

Page 154 of 1081
  • What you want is the velocity when the force is removed. For example, with this expression:

    easeIn(time,0,1,[0,0],[500,500]);

    You’d want to sample the velocity at 0.999 sec (right before the layer stops moving).

    Dan

  • You could, but the expression would have to know when to pick up the velocity. What determines when Null A stops its motion?

    Dan

  • Dan Ebberts

    February 27, 2020 at 12:37 am in reply to: Find and Replace the item from bin to comp.

    try it like this:


    function getItem(theName){
    for (var i =1; i <= app.project.numItems; i++){
    if ((app.project.item(i)) && (app.project.item(i).name == theName)){
    return app.project.item(i);
    }
    }
    return null;
    }

    function findComp(theName){
    for (var i =1; i <= app.project.numItems; i++){
    if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name == theName)){
    return app.project.item(i);
    }
    }
    return null;
    }

    function replaceFile(){

    var compName = "mycomp";
    var myComp = findComp(compName);
    if (myComp == null){
    alert("Can't find comp '" + compName + "'.");
    return;
    }
    var myLayer = myComp.layer('pink.png');
    var itemName = "blue.png";
    var myItem = getItem(itemName);
    if (myItem == null){
    alert("Can't find item '" + itemName + "'.");
    return;
    }
    myLayer.replaceSource(myItem,false);
    }
    replaceFile();

    Also, if you post code in this forum, please don’t preview your post. It messes things up.

    Dan

  • Dan Ebberts

    February 27, 2020 at 12:16 am in reply to: Find and Replace the item from bin to comp.

    You could add a function to find a comp, like this (not tested):


    function findComp(theName){
    for (var i =1; i <= app.project.numItems; i++){
    if ((app.project.item(i) instanceof CompItem) && (app.project.item(i).name == theName)){
    return app.project.item(i);
    }
    }
    return null;
    }

    If it returns null, the comp was not found.

    Dan

  • Dan Ebberts

    February 27, 2020 at 12:00 am in reply to: Find and Replace the item from bin to comp.

    Try this:


    function getItem(theName){
    for (var i =1; i <= app.project.numItems; i++){
    if ((app.project.item(i)) && (app.project.item(i).name == theName)){
    return app.project.item(i);
    }
    }
    return null;
    }

    function replaceFile(){
    var myComp = app.project.activeItem;
    if ((myComp == null) || ! (myComp instanceof CompItem)){
    alert("No comp active.");
    return;
    }
    var myLayer = myComp.layer('blue.png');
    var itemName = "pink.png";
    var myItem = getItem(itemName);
    if (myItem == null){
    alert("Can't find item '" + itemName + "'.");
    return;
    }
    myLayer.replaceSource(myItem,false);
    }
    replaceFile();

    Dan

  • This should work:


    inText = thisComp.layer("Same text, But without The final line").text.sourceText;
    splitText = inText.split("\r");
    outText = "";
    for (i = 0; i < splitText.length-1;i++){
    outText += (i == 0 ? "" : "\r") + splitText[i];
    }
    outText

    Dan

  • Dan Ebberts

    February 25, 2020 at 8:13 pm in reply to: Extendscript naming Dropdown Menu effect

    The dropdown control is an unusual implementation. You could try this:


    var dropdownItems = [
    "Left",
    "Center",
    "Right"
    ];
    var boxLayerDropdown = boxLayer.Effects.addProperty("ADBE Dropdown Control");
    var temp = boxLayerDropdown.property(1).setPropertyParameters(dropdownItems);
    temp.propertyGroup(1).name = "Align";

    Dan

  • As far as I know, they’ve always worked. There’s an issue with single-line if else statements and the new engine, but I think that’s it.

    Dan

  • Could be like this (depending on which one you want to have precedence.


    posA = [100,100];
    posB = [200,200];
    posC = [300,300];

    if (thisComp.layer("Layer 1").active)
    posA
    else if (thisComp.layer("Layer 2").active)
    posB
    else if (thisComp.layer("Layer 3").active)
    posC
    else
    value

  • Something like this maybe:

    linear(time,textIndex-.25,textIndex,0,100)

    Dan

Page 154 of 1081

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