Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects How to use Scale:Velocity in expressions

  • How to use Scale:Velocity in expressions

    Posted by Dbmiller on February 18, 2006 at 11:25 pm

    I need an expression that will apply blur as a factor of Scale:Velocity. In other words, the faster the scale changes, the more blur is applied. If the scale isn’t changing, apply no blur.

    After Effects is already calculating Scale:Velocity (visible via Scale twirl down when Ease Ease is applied to Scale keyframes), but I can’t figure out how to access that velocity value in an expression…

    Thanks

    Dan Ebberts
    replied 20 years, 2 months ago
    4 Members · 3 Replies
  • 3 Replies
  • Colin Braley

    February 19, 2006 at 5:27 am

    Well if you want to really base blur level on the velocity of the scale property you have to apply an expression like this:

    //Begin Expression
    other = thisComp.layer(“square”);
    s1 = other.scale.velocityAtTime( time )[0];
    s2 = other.scale.velocityAtTime( time )[1];
    (s1 + s2)/2
    //End expression

    this expression takes the velocity of the x scale of “other layer” and the velocity of the y scale of “other layer” and averages them toghether. However, this may not be what you want because if scale is decreasing velocity will be a negative number, and you can’t have a negative blur factor. After effects will give you a value of zero instead for blur factor. In order to compensate for this you would use an expression like the following:

    //Begin
    other = thisComp.layer(“square”);
    s1 = other.scale.velocityAtTime( time )[0];
    s2 = other.scale.velocityAtTime( time )[1];
    (Math.abs(s1 + s2))/2
    //End

    in the second expression, it does not matter if scale is increasing or decreasing, all that matters is the speed scale is changing at (the speed)

    ~Colin

  • Spritemaster

    February 19, 2006 at 8:39 am

    I would recommend:

    Math.sqrt(s1*s1+s2*s2)

    instead. For one thing, it is more accurate physically, but that may not be so important; the main issue is that the expression you propose,

    (Math.abs(s1 + s2))/2

    can be zero if s1 is positive and s2 is negative, of the same magnitude. Namely, if a layer expands in x and contracts in y, you would get zero blur which may not be what you want. I suppose in most cases the scale values are linked (Xscale=Yscale) anyway and then it doesn’t matter much, but just in case…

    AA

  • Dan Ebberts

    February 19, 2006 at 5:12 pm

    Assuming x and y scale are linked, I’d do it like this:

    factor = 10;
    Math.abs(thisComp.layer(“scale_layer”).scale.velocity[0])/factor;

    Adjust factor to get the relationship you want between the velocity and blur.

    Dan

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