Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Determining the coordinates of a point on a circle

  • Determining the coordinates of a point on a circle

    Posted by Adrien Menielle on January 26, 2024 at 4:40 pm

    Hello everyone,

    I’m currently working on an After Effects project and encountering a challenge with an expression. I would greatly appreciate your expertise in helping me identify and resolve the issue.

    Objective:I am trying to control the position of a point on a circle using an expression. The circle is part of a layer named “TraceArc,” and I’m adjusting the position based on a percentage control named “C1.”

    Current Code:

    poscentre = thisComp.layer("TraceArc").transform.position;

    rayon = (thisComp.layer("TraceArc").content("Ellipse 1").content("Tracé d'ellipse 1").size) / 2;

    curseur = (thisComp.layer("TraceArc").effect("C1")("Curseur")) / 100;

    angle = 2 * (Math.PI) * curseur;

    cosangle = Math.cos(angle);

    sinangle = Math.sin(angle);

    posx = poscentre[0] + rayon * cosangle;

    posy = poscentre[1] + rayon * sinangle;

    [posx, posy]

    Description of the Problem:
    Despite my efforts, I’m encountering an error, “Unable to apply set on more than one value.” I’ve tried various adjustments, but the issue persists.

    Request for Assistance:
    I would appreciate any insights or corrections you can provide on the code. If there’s a better approach to achieve my goal, please let me know.

    Thank you in advance for your help !

    Brie Clayton replied 1 month ago 3 Members · 3 Replies
  • 3 Replies
  • Dan Ebberts

    January 26, 2024 at 5:20 pm

    Try changing this line

    rayon = (thisComp.layer("TraceArc").content("Ellipse Path 1").size) / 2;

    to this:

    rayon = (thisComp.layer("TraceArc").content("Ellipse Path 1").size)[0] / 2;
  • Adrien Menielle

    January 29, 2024 at 3:51 pm

    Thank you, it work 🙂

    Here the code for information :

    curseur = (thisComp.layer("TraceArc").effect("C2")("Curseur"))/100;
    decalage = thisComp.layer("TraceArc").content("Ellipse 1").content("Réduire les tracés 1").offset;
    angle = 2 * Math.PI * curseur - (Math.PI / 2) + degreesToRadians(decalage);
    cosangle = Math.cos(angle);
    sinangle = Math.sin(angle);
    poscentre = thisComp.layer("TraceArc").transform.position;
    rayon = thisComp.layer("TraceArc").content("Ellipse 1").content("Tracé d'ellipse 1").size[0]/2;
    posx = cosangle * rayon ;
    posy = sinangle * rayon ;
    [posx,posy]

    Bye 🙂

  • Brie Clayton

    January 29, 2024 at 5:10 pm

    Thank you for solving this, Dan!

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