Forum Replies Created

Page 26 of 32
  • Xavier Gomez

    July 11, 2013 at 9:46 am in reply to: Remove all keyframes by script

    Thank you, it works very well. Deletion is instant!

    Make sure that the property (and no other) is selected, that the property has keys, then app.executeCommand(21) remove all its keys instantly.

    Xavier.

  • Xavier Gomez

    July 1, 2013 at 8:27 am in reply to: easeIn/easeOut expression question.

    If what you are after is expressions and not graph editor, there is this script:https://aescripts.com/ease-and-wizz/. It has a good collection of ease functions other than the AE default ones. But i’m not sure it will let you have presonnalized treatment for each keyframe…

    Xavier

  • Xavier Gomez

    June 30, 2013 at 7:34 pm in reply to: script mask shape to motion path

    Hello,
    assuming that your script has successfully identified a source [path property] and a target [2D point property] (that actually carry keyframes, not their parents with customizable names etc), here are the rough steps. Actually the hardest part is not to read/write the source/target but to correctly handle already existing keyframes on the target (for instance if you apply the script for the second time on the same target) especially if you want to set the keyframes roving. The sketch below doesnt handle that.

    *** slt means strictly less than ***

    to read the path content, do:
    var shape = source.value,
    verts = shape.vertices,
    inTan = shape.inTangents,
    outTan = shape.outTangents,
    numVerts = verts.length;

    or use valueAtTime if you want to read the path at a specific time;
    vertices is an array of 2D points, in and out tangents arrays of 2D vectors (which in pratice is the same).
    If the path is closed and you want to have a motion that takes it into account, do:
    if (shape.closed) {verts.push(verts[0]); inTan.push(inTan[0]); outTan.push(outTan[0]); numVerts++;};
    Then you also must inject 2D tangents into 3D because tangents for a motion path are always 3D (even for 2D):
    for (var k = 0; k slt numVerts; k++) inTan[k][2] = outTan[k][2] = 0;
    Finally you have to specify a collection of numVerts times to write the keys. This is a matter of choice. You can choose a 2 seconds time interval from the current comp time (like AE does), or what ever you want.
    Once you have chosen these times, assuming they are arranged into an array:

    target.setValuesAtTimes(times, verts);
    for (var idx, k=0; k slt numVerts; k++)
    {
    idx = target.nearestKeyIndex(times[k]);
    target.setSpatialTangentsAtKey(idx, inTan[k], outTan[k]);
    }

    To set roving:
    for (var idx, k=0; k slt numVerts-1; k++)
    {
    idx = target.nearestKeyIndex(times[k]);
    target.setRovingAtKey(idx, true);
    }

    Xavier.

  • Indeed, much more compact and adaptable !

  • If you have some folders named “layer”+number, the number in question needs not be equal to the item index.

    Xavier.

    (the r in the string is actually a carriage return (backslash r). Couldn’t figure out how to print it correctly in the code window)

    var tag = "layer", N = tag.length;
    var s = "", layerFolders = [];
    for (var i=1; i<=app.project.numItems; i++)
    {
    if (app.project.item(i) instanceof FolderItem && app.project.item(i).name.indexOf(tag) === 0)
    {
    if (isNaN(parseFloat(app.project.item(i).name.slice(N)))) continue;
    s += "item " + i + " is a folder with name " + app.project.item(i).name +"r";
    // alert("found layer folder: item " + i + " has name " + app.project.item(i).name);
    layerFolders.push(i);
    }
    }
    s = "Found " + layerFolders.length + " items:rr" + s;
    alert(s);

  • Xavier Gomez

    June 12, 2013 at 5:38 pm in reply to: Random Function in ExtendScript?

    You mean you have some #include instructions (#include “file.jsxinc”)? If so, the simplest thing to do is to physically include external .js file in the main one and send just one file, unless you want to hide some part of the code…
    Sorry, not sure i understand.

    Xavier

    (Hmm, just realized that ‘#’ automatically creates a link. Not intentionnal.)

  • Xavier Gomez

    June 12, 2013 at 4:30 pm in reply to: Random Function in ExtendScript?

    Math.random()

    – has no arguments
    – returns a number in [0,1[
    – there is also no counterpart of AE’s seedRandom() (hopefully wrong)

    Xavier

  • Xavier Gomez

    June 12, 2013 at 11:30 am in reply to: Use expression to ‘tween’ Shape object (path).

    Hello,
    it is an interesting problem, but i have several questions.

    It looks like all your sliders can only take values 0/1 and only one slider can have value 1 at a given time. So it might be a lot easier to have only one slider taking integral values from 1 to 10. It makes the sorting much easier (and faster).
    And also, are you using shape paths or mask paths ?

    I’ve just written a script that sorts this for mask paths, it’s working pretty well, but it’s maybe not the right setting for you.

    Xavier

  • Hello, i haven’ looked into much details, but i think what prevents to modify Transform Group is the line:
    if (prop.name.indexOf(stringKey) != -1 && prop.parentProperty.matchName.indexOf("ADBE Vector Shape") != -1) I thought it was what you wanted at that time. To include transform group, replace this line by
    if (prop.name.indexOf(stringKey) != -1) this amount to removeing the condition that excludes transform groups.

    If you use this thing a lot it might be worth learning a bit of scripting because it can be a lot improved with a UI, for instance make it able do everything a a time instead of editing the script, changing Position to Anchor Point, relaunching etc… (!)

    Xavier

  • Xavier Gomez

    June 5, 2013 at 5:18 pm in reply to: Wiggle in one dimension with a floor

    To clamp below, you can use:

    floor = 0;
    y = Math.max( wiggle(6,250)[1], floor);
    [value[0],y,value[2]]

    Clamping a wiggle doenst work very well because while out of the bounds the final value (y-coordinate) will be constant.

    Provided yours key values always stay above the floor, you can use instead:

    floor = 0;
    maxWiggle = Math.min(250, value[1]-floor);
    w = wiggle(6,maxWiggle);
    [value[0],w[1],value[2]]

    Xavier

Page 26 of 32

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