Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Straight line ease into Math.sin/cos

  • Straight line ease into Math.sin/cos

    Posted by Shane Starnes on March 21, 2024 at 2:13 pm

    Consider the following position orbit expression:

    My question, how can I have this layer start from comp center and smoothly move into it’s position in the orbit over the course of n frames, starting at the layer’s inPoint?

    I think my biggest hang-up is that each layer that this expression is applied to has a slightly different position value at n time, and I’m unsure of how to grab the Math.sin/cos value at that specific time (if that’s even part of the method)

    oSpeed = thisComp.layer("orbitController").effect("orbitSpeed")("Slider");

    oWidth = thisComp.layer("orbitController").effect("orbitWidth")("Slider");

    oHeight = thisComp.layer("orbitController").effect("orbitHeight")("Slider");

    off = thisComp.layer("orbitController").effect("offset")("Slider");

    i = thisLayer.index;

    o = i*off;

    t = framesToTime(1)*o;

    x = Math.sin((time+t)*oSpeed)*oWidth;

    y = Math.cos((time+t)*oSpeed)*oHeight;

    [value[0]+x,thisComp.layer("orbitController").effect("yOrigin")("Slider")+y]

    Brie Clayton replied 2 weeks, 4 days ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    March 21, 2024 at 3:05 pm

    I think you could just replace the last line with something like this:

    p = [value[0]+x,thisComp.layer("orbitController").effect("yOrigin")("Slider")+y];
    n = 15; // ease frames
    ease(time,inPoint,inPoint+framesToTime(n),[thisComp.width,thisComp.height]/2,p)
  • Shane Starnes

    March 21, 2024 at 3:19 pm

    Wow Dan. This is great, and works exactly as I need. Probably going to replace it with the handy expoOut function for a smoother animation. Either way, thank you Dan!

  • Brie Clayton

    March 22, 2024 at 2:56 am

    Thanks for this solve, Dan!

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