Creative Communities of the World Forums

The peer to peer support community for media production professionals.

  • Posted by Brendan Mccullough on June 9, 2009 at 9:15 pm

    I’m sure this is one of those cases where there is a simple answer I’m missing…

    I’ve been trying to come up with an expression that will accomplish the following pseudocode:

    start = layer’s in point;
    end = 15 frames later;
    duration = end – start;
    while time < (70% of duration) linear(time, inPoint, inPoint+70%ofduration, 0, value*1.15); then while time >= (the remaining 30% of duration) linear(time, inPoint+70% of duration, inPoint+duration, value*1.15, value);

    What I’m hoping will result is a smooth arc from 0 scale, to 115% of value, to value. Here’s where I am at this point:

    start = this.inPoint;
    dur = 30;
    end = this.inPoint + framesToTime(dur);
    segTotal = end - start;
    seg1 = segTotal*.8;
    seg2 = segTotal*.2;
    mult = 1.15;

    linear(Math.sin(time), this.inPoint, this.inPoint+seg1, value*0, value*mult);
    else { value*mult; linear(time, this.inPoint+seg1, this.inPoint+segTotal, value*mult, value); }

    This code probably has some more blatant errors, given that I’ve been trying a bunch of different things, but you can see where I’m going with it. The problem now is it scales up just fine, but back down to value is another story…

    Brendan Mccullough replied 16 years, 11 months ago 2 Members · 4 Replies
  • 4 Replies
  • Koby Goldberg

    June 9, 2009 at 10:47 pm

    Try this:

    start = this.inPoint;
    dur = 30;
    end = this.inPoint + framesToTime(dur);
    segTotal = end - start;
    seg1 = segTotal*.8;
    seg2 = segTotal*.2;
    mult = 1.15;

    t = time - inPoint;
    if (t < seg1) ease(t, 0, seg1, 0, mult) * value else ease(t, seg1, seg1+seg2, mult, 1) * value

    Koby.

  • Brendan Mccullough

    June 10, 2009 at 1:33 am

    Perfect. Thank you for your help.

    Like I said, there are some glaring errors with my code, as I was messing with various iterations right before I posted, so I definitely (at one point at least) had just time-inPoint in place of Math.sin(time).

    In fact, I’m fairly certain at one point I had your code, almost exactly, except for placing value outside of the ease() at the end. I’m not exactly sure what is accomplished by placing value outside of the ease statement, but it is apparently the secret sauce. Can you elaborate on what you accomplish by placing it outside the function?

    This is so simple I’m mad I couldn’t make it work 😉

  • Koby Goldberg

    June 10, 2009 at 6:24 am

    Hi Brendan,
    You could do the multiplication by “value” inside the ease function, and it would work the same. I wrote it outside just in order to write “value” fewer times… just a habbit of making the expression shorter…(check out the following code) I had it in an even shorter notation, but wrote it longer to make sure it is more understandable to all 🙂

    Check out this code, it will do exactly the same:

    start = this.inPoint;
    dur = 30;
    end = this.inPoint + framesToTime(dur);
    segTotal = end - start;
    seg1 = segTotal*.8;
    seg2 = segTotal*.2;
    mult = 1.15;

    t = time - inPoint;
    if (t < seg1) ease(t, 0, seg1, 0, mult*value) else ease(t, seg1, seg1+seg2, mult*value , value)

    Koby.

  • Brendan Mccullough

    June 10, 2009 at 2:52 pm

    Thanks, Koby.

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