Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Remapping Angles to Control Position

  • Remapping Angles to Control Position

    Posted by Sam Wycombe on October 8, 2020 at 5:14 am

    Hey All,

    I’m trying to remap an angle slider to control position. The idea being as the angle rotates, the position of an object is displaced outward along that line.

    I’m sure there’s an easier way to do this than the below (which is not working for semantic reasons I think). Help?

    Current exp for Y-axis (X-axis would follow)

    // Angle
    a=effect("Linear Wipe")("Wipe Angle");
    
    // Displacement 
    x=effect("Amp")("Slider");
    if (0<a<=90) {
    linear(a,0,90,0,-x);
    } else if (90<a<=180) {
    linear(a,90,180,-x,0);
    } else if (180<a<=270) {
    linear(a,180,270,0,x);
    } else if (270<a<=360) {
    linear(a,270,360,x,0);
    }

    Thanks tinkerers,

    Sam

    Stephen Dixon replied 5 years, 7 months ago 2 Members · 2 Replies
  • 2 Replies
  • Sam Wycombe

    October 8, 2020 at 5:24 am

    So, this worked:

    if (a>0 && a<90) {
    linear(a,0,90,0,-x);
    } else if (a>90 && a<180) {
    linear(a,90,180,-x,0);
    } else if (a>180 && a<270) {
    linear(a,180,270,0,x);
    } else if (a>270 && a<360) {
    linear(a,270,360,x,0);
    }

    Obviously a java thing I missed…

  • Stephen Dixon

    October 8, 2020 at 5:45 am
    Math.sin(a) * x

    would do the same thing (ish)

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