Forum Replies Created

Page 15 of 32
  • Xavier Gomez

    September 3, 2015 at 9:39 am in reply to: Mutual recursion: this.function is undefined. error.

    To see what happens, run the script step by step (using the down arrow button instead of the “play” button).

    if obj is a folder, this.getNames(folder) will do:

    –> this.crawl(this.getNames, folder)
    –> for all children of folder, execute handler(child), ie this.getNames(child).
    but now, inside this.getNames(child), this is no longer your spider object but the global object.

    If you replace everywhere “this” by “spider” it will work.

    Xavier

  • Xavier Gomez

    September 3, 2015 at 9:15 am in reply to: Remove all fills in a shape layer?

    The following will work in your case.
    Choose handler=myHandler1 to remove all fills, and myHandler2 to set opacity to 0.
    It’s fairly generic, but you dont need to write it that way (with a separate handler function) if you only have one thing to do with those fills.

    Xavier.

    // handler : g should be a property group that can be added to a shape (empty group / path /stroke / fill / trim path etc)
    function myHandler1(g){
    if (g.matchName === "ADBE Vector Graphic - Fill") g.remove();
    };
    function myHandler2(g){
    if (g.matchName === "ADBE Vector Graphic - Fill") g.opacity.setValue(0);
    };

    // main function : g is expected to be a shape layer or a shape group (shape "sublayer")
    // handler : what to do with the addable content of g
    // recursive, and recurses backwards, in case some children are removed...
    // doesnt scout the transform group, only addable things
    function scoutContent(g, handler){
    var n, child;
    if (!g.content) return;
    g = g.content;
    for (n=g.numProperties; n>0; n--){
    child = g.property(n);
    handler(child);
    if (Object.isValid(child) && child.content) scoutContent(child, handler);
    };
    };

    scoutContent(app.project.activeItem.selectedLayers[0], myHandler2);

  • Xavier Gomez

    September 2, 2015 at 6:12 pm in reply to: Changing color lightness using expression.

    Colors are in RGB format.
    You have to convert to HLS, lower the “L” then convert back to RGB.

    The problem is how much you want to lower.
    It can be by a flat amount, or by a percentage of the current value.

    amount = 0.2;
    c = value;// (or pickwhip a color property)
    // convert to HLS
    c = rgbToHsl(c);
    // lower the L
    c[1] = Math.max(0, c[1]-amount);
    // back to RGB
    hslToRgb(c);

    To lower by a certain percentage instead of a flat amount, replace the lowering part by:
    c[1] -= c[1]*amount;

    In both cases amount should be a number in the range [0,1].

    Xavier.

    Edit : A bit late, it doesnt bring more !!!

  • Ok sorry, i hadn’t tried the code and i mixed things up.
    Thanks for correction.

    Xavier.

  • Yes you can identify the current marker segment using maker.nearestKeyIndex(time) method.

    If you set the marker comments as “comp name – camera layer name”, normally the following should reproduce your example (i didnt check).

    try{
    K = marker.numKeys;
    if (time<=marker.key(1).time){ k1=k2=1; } else if (marker.key(K).time<=time){ k1=k2=K; } else{ k = marker.nearestkeyIndex(time); if (time===marker.key(k).time){ k1=k2=k; } else{ if (time

    Xavier.

  • Xavier Gomez

    August 14, 2015 at 3:30 pm in reply to: Scale expression

    Hi,

    sr is an array (eg [100,100]) and 200 a number.
    After Effects allows adding arrays and numbers, it gives a meaning to it, but maybe not the one you expect.
    For instance [0,0] + 1 = [1, 0].
    That is, AE converts 1 to [1,0] then adds the 2 vectors.

    I dont know what exactly you want to achieve but you might take this into account. Replacing 200 by [200,200] might be enough.

    Xavier.

  • Xavier Gomez

    August 13, 2015 at 12:52 am in reply to: Converting speed into pace and expressing it correctly

    You’d have to parse the speed text and extract the number, the way to do it depends on how the text looks like.

    I think it would be a bit easier if the speed value was carried by a slider (with your random expression on it), and then collected (=pickwhipped) by both text layers (the speed and the pace one).

    In the speed text:

    x = effect(“Slider Control”)(“Slider”).value;
    “Speed : ” + x + “km/h”;

    And in the pace text, the expression from the previous post with x taking the slider value.

    Xavier

  • Ah ok, i started where you had troubles.
    Full expression:

    // x : input speed (unit distance/hour)
    x = 5.67;
    // pace in min / unit distance
    pace = 60/x;
    // decompose min:sec
    min = Math.floor(pace);
    sec = Math.round((pace-min)*60);
    if (sec===60){sec=0; ++min;};

    // display text :
    “pace : ” + min + ” minutes ” + sec + ” seconds per unit distance”;

  • Xavier Gomez

    August 11, 2015 at 12:49 pm in reply to: Converting speed into pace and expressing it correctly

    Once you get your pace as decimal number in min/km, to decompose it in min:sec, you can do

    min = Math.floor(pace);
    sec = (pace-min)*60;

    This gives the seconds part as a decimal number.
    If you want a plain integer for the seconds, replace the second line by:

    sec = Math.round((pace-min)*60);

    Xavier

  • For your first question, a comp is a footage, and it will look the same everytime you use it, there is no way out.

    So, to get different blobs, you need to duplicate the comp as a composition in the project panel, not as a layer in the composition (4 different blobs ===> 4 different comps).

    Xavier.

Page 15 of 32

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