Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Link position speed to object scale frequency

  • Link position speed to object scale frequency

    Posted by Brad Pickford on November 7, 2013 at 4:14 am

    Hi everyone, hope you can help. I am looking to create an animation of a car. Instead of the wheels rotating they will scale up and down to the pace of the car. So the faster the pace the higher the frequency of the scaling. The scaling only has to be from 100 to 110%. I have looked into taking the position.speed of the layer and trying to use it to run the frequency of a sin wave but not having much luck. Any thoughts would be most appreciated.

    Cheers,
    Brad

    Brad Pickford replied 12 years, 6 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    November 7, 2013 at 6:27 am

    Unfortunately, it’s not simple:

    https://www.motionscript.com/articles/speed-control.html

    Dan

  • Brad Pickford

    November 7, 2013 at 2:12 pm

    Thanks Dan. I did look at that earlier but glazed over. I have created a workaround that is working. I am trying to create a delay in a secondary layer to offset its position value, but can’t get it to work. Would you have any suggestions? I need to offset the value of “d” by 2 frames.

    Cheers,
    Brad

    freq = thisComp.layer("controller").effect("sine value")("Slider");
    amp = thisComp.layer("controller").effect("max position height value")("Slider");
    n = freq.numKeys;
    if (n > 0 && freq.key(1).time < time){
    accum = freq.key(1).value*(freq.key(1).time - inPoint);
    for (i = 2; i <= n; i++){
    if (freq.key(i).time > time) break;
    k1 = freq.key(i-1);
    k2 = freq.key(i);
    accum += (k1.value + k2.value)*(k2.time - k1.time)/2;
    }
    accum += (freq.value + freq.key(i-1).value)*(time - freq.key(i-1).time)/2;
    }else{
    accum = freq.value*(time - inPoint);
    }
    d = value[1] + amp*Math.sin(accum*Math.PI*2);

    [value[0], d]

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