Forum Replies Created

Page 21 of 32
  • Xavier Gomez

    April 23, 2014 at 1:58 pm in reply to: hue/saturation change

    Hi Ayas,

    darkness is not controlled by saturation, but by the lightness (3rd parameter in HSL). Since arrays are indexed from 0, that’s entry 2:

    lightness = 25; // pourcent

    hsl = rgbToHsl(thisComp.layer("first").effect("Fill").color.value);
    hsl[2] = lightness/100;
    hslToRgb(hsl);

    If you want to set a lightness offset that will auto update when you change the fill in the first layer:
    lightnessOffset = -5; //

    hsl = rgbToHsl(thisComp.layer("first").effect("Fill").color.value);
    hsl[2] = Math.max(0.0, Math.min(hsl[2]+lightnessOffset/100, 1.0));
    hslToRgb(hsl);

    Xavier

  • Xavier Gomez

    April 11, 2014 at 3:50 pm in reply to: Expression error trying to rotate z using index

    You can try with a switch over index%5 (equivalent, but simpler than index/5 % 1):
    switch (index%5){
    case 1 : t =-60; break;
    case 2 : t = 60; break;
    case 3 : t = -120; break;
    case 4 : t = 120; break;
    default : t = 0;
    };
    t;

    Xavier

    Edit : It is quite risky to compare non integral numbers…
    You can try this: open the javascript editor (File>Scripts>Open Scrip Editor), type the line:
    6/5 % 1;
    press ‘play’ (top right area of the editor window).
    The result appears in the bottom row of the window : 0.2
    Now replace that one line code by
    (6/5 % 1) == 0.2;
    and press play again. Result ….. false 😉

  • A screenshot of the plugin parameters would help.

    Meridian(back) should be Meridian(front) + 180.

    For the Globe tilt, may be Tilt(back) = – Tilt(front)

    (only trying to guess, hopefully it hit…)

    Xavier

  • Xavier Gomez

    March 14, 2014 at 9:26 am in reply to: Modify spiral expression to create a Spring

    Usually controlling sliders are on null objects but adjustment layer are fine too.

    I just made a try to check that what i had suggested could produce something correct and obtained this (see screenshots). I used your expression, linked z and radius to sliders, but also changed the angle rate to 1000 to get more loops and for that also had to set the particular > emitter > position subframe parameter to 10x(linear). Quite far from your picture but well… the principle is there;)

    Xavier

  • Xavier Gomez

    March 13, 2014 at 1:39 pm in reply to: Modify spiral expression to create a Spring

    The easiest way is to link the radius and z variables to sliders and keyframe those.
    In the graph editor give the radius and z curve the shapes you want.
    With expression it would be more complicated and hard to tweak.

    Xavier.

  • @Graham Thorne: the script doesnt have 2001 lines. If you copied it in the navigator and pasted it in a new jsx in ExtendScript, you might have copied more than the script code. For me it works fine.

    @Nick: Thank you for posting this.

    Regarding the snake/tentacle thing, it is not a straightforward modification…

    For a “snake”, there is only one motion path that is common to all elements in the trail. All elements follow that same path, but at different times.

    For a “tentacle”, if you want to do something interesting with it (ie animate it) you’ll need to animate the underlying curve itself, and there can be as many different curves as they are frames in the animation. It’s a lot more complicated (animation work). You can’t do this with an expression.

    Xavier.

  • Xavier Gomez

    January 28, 2014 at 11:23 am in reply to: Rewriting ValueAtTime with After effects Syntax

    Hi again,
    unless you want to do also 2D/3D props, you don’t need to calculate arclengths. Here are more details for 1D, without the part that solves the cubic equation (search google for that, propably on Wikipedia their is a detailed solution). I’m really wondering why you don’t want to use the built-in valueAtTime()…

    Xavier.

    function valueAtTime(prop, t0)
    {
    if ( !(prop instanceof Property) || prop.propertyValueType !== PropertyValueType.OneD || prop.expressionEnabled) return “hi”;

    var N=prop.numKeys, n, t, t1, t2, DT, easeIn, easeOut, p0,p1,p2,p3, a0,a1,a2,a3, roots, k, u0;

    if (N===0) return prop.value;

    n = prop.nearestKeyIndex(t0); if (prop.keyTime(n)>t0) n–;

    if (n===0) return prop.keyValue(1);
    if (n===N) return prop.keyValue(N);
    if (t0-prop.keyTime(n)<0.0005 || prop.keyOutInterpolationType(n) === KeyframeInterpolationType.HOLD) return prop.keyValue(n);

    t1 = prop.keyTime(n);
    t2 = prop.keyTime(n+1);
    DT = t2-t1;
    t = (t0-t1)/DT;

    easeOut = prop.keyOutTemporalEase(n)[0];
    easeIn = prop.keyInTemporalEase(n+1)[0];

    // time :

    // time control points (bezier):
    p0 = 0;
    p1 = easeOut.influence/100;
    p2 = 1-easeIn.influence/100;
    p3=1;

    // same, standard basis:
    a0 = p0; a1 = 3*(p1-p0); a3 = 3*(p2-p1); a2 = a3-a1; a3 = (p3-p0)-a3;

    // solve a0 + a1*u + a2*u*u + a3*u*u*u = t and call u0 the unique solution in [0,1]
    roots = solve(a0 + a1*u + a2*u*u + a3*u*u*u = t); // not provided
    for (k=0; k less than roots.length; k++) {u0=roots[k]; if (0<=u0 && u0<=1) break;};

    // value :

    // value control points (bezier):
    p0 = prop.keyValue(n);
    p3 = prop.keyValue(n+1);
    p1 = p0 + easeOut.speed * DT * easeOut.influence/100;
    p2 = p3 – easeIn.speed * DT * easeIn.influence/100;
    // same, standard basis:
    a0 = p0; a1 = 3*(p1-p0); a3 = 3*(p2-p1); a2 = a3-a1; a3 = (p3-p0)-a3;

    return a0+u0*(a1+u0*(a2+u0*a3));
    };

  • Xavier Gomez

    January 26, 2014 at 8:32 pm in reply to: Rewriting ValueAtTime with After effects Syntax

    AE is c++ based, has instant access to its own variables, can (and does) cache tons of things (as you can see when you open the graph editor: it’s all there), probably has some smart way to find cubic roots by refining some lookup tables, i have no idea of how it works internally, but what is sure, sorry, is that the principle for valueAtTime is written 2 posts above.

    Xavier.

  • Xavier Gomez

    January 26, 2014 at 7:39 pm in reply to: Rewriting ValueAtTime with After effects Syntax

    Yes for 1D properties it is 2D vector as you say, but its components time and values are both cubic functions of an invisible parameter, say u (the Bezier parameter), ie between keys n and n+1, time = cubic function of u, and value = another cubic function of u. The coefficients for time depends on the keys time and in/out temporalEase.influence, while for value they depend on the keys values and temporalEase.speed.

    To retrieve the property value at a given time t0, you need first to find the key interval (n, n+1), retrieve the keyTime(n/n+1), keyValue(n/n+1), keyOutTemporalEase(n), keyInTemporalEase(n+1), solve the cubic equation time(u) = t0, which gives you a value u0, then plug this u0 into the equation for the value.

    Man, if you intend to loop this over hundreds of keyframes with javascript, better get a cup of coffee every time you press the script button. With the built-in function it takes less than a millisecond.

    Xavier.

  • Xavier Gomez

    January 26, 2014 at 1:15 pm in reply to: Rewriting ValueAtTime with After effects Syntax

    The post-expression value seems completely out of reach.
    For pre-expression (keys) it is cubic Bezier (for both value and time). For 1D properties, it is not that difficult, but for 2D+ ones it not straightforward at all, since at a point or another you will have to compute the arclength parametrization of the path, and find out how the initial and final speed variables are interpreted to move on the entire path along time. If javascript is your language, it will be slow++.
    Not mentionning that it also seems impossible to know for Custom type properties, post and pre expression.

    Seems crazy project. Good luck;)

    Xavier.

Page 21 of 32

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