Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Control speed of comp (time remapping) base on speed of position property

  • Control speed of comp (time remapping) base on speed of position property

    Posted by Frederic Antoinette on April 22, 2018 at 3:48 pm

    Hi, as the subject says.
    I have a fish tail animation inside a comp, and I’d like it to speed up and slow down to normal speed, based on the the velocity at which the fish is moving.
    I did found this post that pretty much does it but with the exception that if the body stop moving it also freezes:
    https://forums.creativecow.net/docs/forums/post.php?forumid=227&postid=7523&univpostid=7523&pview=t

    I readapted the code to this, but I’d like to keep going at normal speed if there speed is 0

    p = transform.position
    dampen = 5000;
    //--
    dur = this.source.duration;
    finalTime = 0;
    for( i = 0; i < time; i+= thisComp.frameDuration ){
    xVeloc = p.speedAtTime( i )+1;
    finalTime += xVeloc/dampen;
    }
    if( finalTime < 0 )
    (dur + finalTime) % dur
    else
    finalTime % dur

    Frederic Antoinette replied 8 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    April 22, 2018 at 5:09 pm

    Try changing this line:

    xVeloc = p.speedAtTime( i )+1;

    to:

    xVeloc = p.speedAtTime( i ) + dampen*thisComp.frameDuration’

    Dan

  • Frederic Antoinette

    April 22, 2018 at 7:27 pm

    That did it.
    Thanks Dan

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