I am trying to create a heart shape using an expression like this:

  • Start AE
  • New Composition + Ok
  • Layer, new shape layer
  • Expand to get the contents node and click add Path
  • Path -> Edit expression

Then I paste this expression:

var path = thisProperty;
var allPoints = new Array();
for (var a = 0; a < 360; a++) {
  var theta = degreesToRadians(a);
  x0 = Math.cos(theta);
  x = 300 * x0;
  y = 0.75 * 300 * (Math.sin(theta) - Math.sqrt(Math.abs(x0)));
path.createPath(allPoints, [], [], true);

and I see this on the screen

heart shape

But this will only be visible in the designer. If the object is deselected, it will become invisible.

There is no way to control the stroke width, color or fill.

How can I control those properties?

I am trying to add a stroke alongside the path, but they will not "connect".

  • I get an error when I apply that expression to a path: "property labelled cx in class Global is missing or does not exist"
    – tomh
    Feb 15, 2021 at 17:00
  • I am sorry, removing some left over variables. Correcting the code. @tomh Feb 15, 2021 at 17:20

1 Answer 1


Apologies if I've misunderstood, but you can just click on the Add triangle, and add a fill or a stroke to your shape: screengrab

The modifiers in the "Add" menu are hierarchical - so you have to add them below the path's hierarchical level.

  • Can I add a variable that I can tween at the timeline as well? Acessible through the script. Feb 22, 2021 at 18:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.