Forum Replies Created

Page 20 of 32
  • Xavier Gomez

    July 9, 2014 at 3:14 pm in reply to: finding a vector between to point in space

    normal of the plane parallel to v1 and v2 (up to sign): normalize(cross(v1, v2));
    v1.v2 : dot(v1,v2);

    To get all methods (math or not) available to expressions, enable the expression of a property, and click the triangle near the = sign.
    It opens up the menu.

    Xavier.

  • Xavier Gomez

    July 9, 2014 at 11:19 am in reply to: finding a vector between to point in space

    p1 = effect(“3D Point Control”)(“3D Point”);
    p2 = effect(“3D Point Control 2”)(“3D Point”);
    normalize(sub(p2,p1)); // unit vector

    If for some reason you need both the length and the unit vector
    v = sub(p2, p1);
    L = length(v);
    u = L==0 ? null : div(v,L);

    // you can use p2-p1 instead of sub(p2,p1), etc, AE supports it.

    Xavier.

  • Xavier Gomez

    July 4, 2014 at 6:40 pm in reply to: How to create sine curve

    This idea already appeared somewhere in the cow forums, but thanks for posting.

    On a side-note, it is hard to understand why the Write-on effect is so desperatingly s-l-o-w when lowering the (temporal) brush spacing. 0.001 corresponds to 1000 particles/sec, it is not that much. Paticular can handle 1000 x that and doesnt freeze like Write-on…

  • Xavier Gomez

    July 1, 2014 at 1:00 pm in reply to: Using a script to add an expression to a layer?

    app.project.activeItem.layer(1).effect("Both Channels")(1).expression = "smooth(0.2, 5, time);";

    See this: https://forums.creativecow.net/readpost/2/911517 to see how smooth works.

    Xavier

  • Xavier Gomez

    May 23, 2014 at 4:33 pm in reply to: Making a pie chart with expressions

    The .value is useless indeed.
    By bounding, i meant make sure that the result of the expression is between 0 and 100 (because completion is a number 0 and 100) but the effect takes care of it so there is nothing to do.

    Now for the other part, it depends what you actually want to do. Specifying slider=100 <==> completion=50 is not enough to write the expression… if you also specify slider=0 <==> completion=100, and that the values vary linearly, then :

    Math.max(100-0.5*slider, 50);

    (slider<=0 : 100, slider>=100: 50).

  • Xavier Gomez

    May 23, 2014 at 12:43 pm in reply to: Making a pie chart with expressions

    100-effect(“Slider Control”)(“Slider”).value;

    Normally you should bound the resulting value to [0, 100] but no need since the completion property deals with it.

    Xavier.

  • Hi Jacob,
    you just need to use the add/remove methods of your groups/dropdowns.

    var myDD = my_palette.grp.firstRow.g01.renderSettings;
    // remove all items:
    while (myDD.items.length) myDD.remove(myDD.items[0]);
    // add new
    myDD.add(“item”, “new menu item”);
    // etc

    Same for groups, but in that case, if you don’t specify the new widget location/size, or bounds, you need to run the autolayout after the change:
    myPalette.layout.layout(true);

    Xavier.

  • Xavier Gomez

    April 30, 2014 at 7:16 pm in reply to: Selecting a layer using Extendscript

    For the second way, to find a menu command ID, do

    app.findMenuCommandById(commandName) // returns an integer, (0 if not found)

    for “Deselect All” is gives 2004.

    Then you inject that number in app.executeCommand(commandId);

    You’ve got to be very sure of what panel is active and what item/layers/properties/etc are selected before using these… For “deselect all” a mistake is quite harmless, for “cut” it is another story.

    Xavier

  • Xavier Gomez

    April 30, 2014 at 4:09 pm in reply to: Selecting a layer using Extendscript

    // (comp should be a CompItem)
    var selLayers = comp.selectedLayers, n=selLayers.length;
    while (n–) selLayers[n].selected = false;

    // or, if you are sure that app.project.activeItem is a comp opened in a viewer
    app.executeCommand(2004); // “Deselect All”

    Xavier

  • Xavier Gomez

    April 29, 2014 at 9:02 am in reply to: easy ease

    Ease ease is still quite simple, other than that could be difficult to explain/manage…
    The KeyframeEase object requires 3 components (X,Y,Z), even in 2D, can’t figure out why.
    Also, you don’t need the speed, influence, easeIn, easeOut variables below, they are there just to tell the meaning of this things inside the parenthesis.

    Xavier.

    var BEZIER = KeyframeInterpolationType.BEZIER;
    var LINEAR = KeyframeInterpolationType.LINEAR;

    var speed, influence, easeIn, easeOut;
    var ease = new KeyframeEase(speed=0, influence=33.33333);
    var key1, key2;
    var myScale = app.project.activeItem.layer(1).property("scale");
    // set the values at times
    myScale.setValueAtTime(0,[0,0]);
    myScale.setValueAtTime(1,[100,100]);
    myScale.setValueAtTime(5,[130,130]);
    myScale.setValueAtTime(6,[0,0]);
    // get the key indices and set the rest
    key1 = myScale.nearestKeyIndex(1);
    key2 = myScale.nearestKeyIndex(5);
    myScale.setTemporalEaseAtKey(key1, easeIn=[ease, ease, ease], easeOut=[ease, ease, ease]);
    myScale.setTemporalEaseAtKey(key2, easeIn=[ease, ease, ease], easeOut=[ease, ease, ease]);

    // (optionnal) overwrite outter tangents (Bezier ---> Linear)
    myScale.setInterpolationTypeAtKey(key1, LINEAR, BEZIER);
    myScale.setInterpolationTypeAtKey(key2, BEZIER, LINEAR);

Page 20 of 32

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