Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Math.sin wave cycle

  • Math.sin wave cycle

    Posted by Alex Andry on June 20, 2022 at 11:50 am

    Hello everyone,

    is it possible to make a cycle through the length of the composition from this expression?

    Thank you!

    S = effect(“Speed”)(“Slider”);

    A = effect(“Amp”)(“Slider”);

    F = effect(“Frequency”)(“Slider”);

    R = effect(“Resolution”)(“Slider”);

    W = effect(“Width”)(“Slider”);

    P = [];

    for (i=0; i<R; i++) {

    P.push([W/R*i, Math.cos(time*S+i / (R/F))*A]);}

    createPath(P, [], [], false)

    Alex Andry replied 11 months, 2 weeks ago 2 Members · 2 Replies
  • 2 Replies
  • Filip Vandueren

    June 20, 2022 at 12:41 pm

    Try this, with a slider “Cycles” instead of “Speed” that you set to how many cycles you want to occur in the comp’s duration, then:

    C = effect("Cycles")("Slider");

    S = (Math.PI*2*C)/thisComp.duration;

    A = effect("Amp")("Slider");

    F = effect("Frequency")("Slider");

    R = effect("Resolution")("Slider");

    W = effect("Width")("Slider");

    P = [];

    for (i=0; i<R; i++) {

    P.push([W/R*i, Math.cos(time*S+i / (R/F))*A]);

    }

    createPath(P, [], [], false)

  • Alex Andry

    June 20, 2022 at 1:03 pm

    Perfect!

    Thank you Filip!

    I tried to solve it in a different way and confused myself.

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