Forum Replies Created

Page 38 of 65
  • Andrei Popa

    February 18, 2020 at 7:40 am in reply to: PropertyValueType not working as expected

    You can directly set the scale and position to a 2D vector.

    This code works:

    var a = app.project.item(1).layer("Shape Layer 1")("Transform")("Scale");
    var b = app.project.item(1).layer("Shape Layer 1")("Effects")("Point Control")("Point").value;
    a.setValue(b);

    It works with scale and position of a layer. Doesn’t matter if the 3d it’s turned on or not. The last element of the value is set to zero for position and 100 for scale(the default values).

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 18, 2020 at 6:53 am in reply to: PropertyValueType not working as expected

    Scale and position are 3d properties. It is only in the After Effects interface that the last is hidden if the layer is not 3d enabled. If you check the scale of a layer by script, you will get [100,100,100].

    So, in short, you are doing nothing wrong and the answer of .PropertyValueType is correct. They are just 3d properties, not 2d.

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 12, 2020 at 1:33 pm in reply to: Rename text layer name based on the text content.

    Sorry. I corrected this but then pasted the code from the clipboard. That one was not corrected ????

    crtComp = app.project.activeItem;

    for (var i=1;i<=crtComp.numLayers;i++){
    currentLayer = crtComp.layer(i);
    if(currentLayer instanceof TextLayer){
    crtComp.layer(i).name = crtComp.layer(i).text.sourceText.value;
    }
    }

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 12, 2020 at 1:17 pm in reply to: Rename text layer name based on the text content.

    Try this:

    crtComp = app.project.activeItem;

    for (var i=1;i<=crtComp.numLayers;i++){
    currentLayer = crtComp.layer(i);
    if(currentLayer typeof TextLayer){
    currentLayer.name = currentLayer.text.sourceText.value;
    }
    }

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 11, 2020 at 4:13 pm in reply to: Rename text layer name based on the text content.

    Script:

    crtComp = app.project.activeItem;

    for (var i=1;i<=crtComp.numLayers;i++){
    crtComp.layer(i).name = crtComp.layer(i).text.sourceText.value;
    }

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 11, 2020 at 4:09 pm in reply to: Autoscale when above a certain width

    certainSize = 500;
    thisWidth = sourceRectAtTime(time,false).width*scale[1]/100;
    (certainSize>thisWidth) ? value : [value[0]*certainSize/thisWidth,value[1]]

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 10, 2020 at 5:02 pm in reply to: Autoscale when above a certain width

    Try this:

    certainSize = 500;
    thisWidth = sourceRectAtTime(time,false).width*scale[1]/100;
    (certainSize>thisWidth) ? value : value*certainSize/thisWidth

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 10, 2020 at 4:56 pm in reply to: Using sourceRectAtTime to determine placement of nulls.

    Your way of doing it is correct. You just misspelled selectedLayers

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 10, 2020 at 7:10 am in reply to: attaching onClick events to checkboxes with for loop

    I am not sure if this would work, but maybe something like i = this.index; inside the function. Or if you name your checkboxes Light 1, Light 2 etc, you can use this:
    i = parseInt(this.text.split(" ")[1]);

    Andrei
    My Envato portfolio.

  • Andrei Popa

    February 10, 2020 at 7:05 am in reply to: Using sourceRectAtTime to determine placement of nulls.

    Try this


    var currentComp = app.project.activeItem;
    var myLayer = currentComp.layer(1);
    var myLayerPos = myLayer.transform.position.value;
    var myLayerRect = myLayer.sourceRectAtTime(0,false);
    var null1 = currentComp.layers.addNull();
    var null2 = currentComp.layers.addNull();
    null1.transform.position.setValue(myLayerPos + [myLayerRect.left, myLayerRect.top+myLayerRect.height]);
    null2.transform.position.setValue(myLayerPos + [myLayerRect.left+myLayerRect.width, myLayerRect.top+myLayerRect.height]);

    Andrei
    My Envato portfolio.

Page 38 of 65

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