Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions argument 2 to createPath() must be 2 numbers

  • argument 2 to createPath() must be 2 numbers

    Posted by Blake Goulette on October 4, 2024 at 10:04 pm

    I’m really sorry to be posting this, but I’ve been banging my head against it for hours, and I’m still missing something. I have a path that needs to get its first however many points and tangents from a previous path; then I need to build a second path using all but the last point/tangents from that first path. It kinda sorta worked when I just grabbed, say, something like _prev.points()[0] (when knew I just wanted the first point), but with the code below, something’s gone haywire. I copied all of this to a text layer just to see what it was outputting, and it looks legit: each array has the same number of elements. I would really appreciate some help! Thank you!

    _dd = thisComp.layer("N exp controls").effect("Diverge distance")("Slider");

    _dcs = thisComp.layer("N exp controls").effect("Diverge curve strength (%)")("Slider");

    _mult = 0.5;


    _prev = thisComp.layer("Sh primary route").content("Group 1").content("Path 1").path;

    _knots = _prev.points().slice(0, -1);

    _knotIns = _prev.inTangents().slice(0, -1);

    _knotOuts = _prev.outTangents().slice(0, -1);


    _knot01 = [0, 3300 - 480]; // 3300 is (7680 * 0.5) - 540, which is where the "source" starts

    _knot02 = _knot01 - [_dd, _dd * 1.547] * _mult;

    _knot03 = [_knot02[0], thisComp.height * -1.0];


    _points = _knots.concat(_knot01, _knot02, _knot03);

    _ins = _knotIns.concat([0, 0], [0, _dd * _dcs * _mult], [0, 0]);

    _outs = _knotOuts.concat([0, _dd * -_dcs * _mult], [0, 0], [0, 0]);

    createPath(_points, _ins, _outs, false);

    Blake Goulette replied 1 month ago 1 Member · 1 Reply
  • 1 Reply
  • Blake Goulette

    October 5, 2024 at 11:40 pm

    Well hey, I figured it out. I was building my arrays for points, ins, and outs incorrectly. Shocker. When I changed my code to look like the following, it worked!

    _dd = thisComp.layer("N exp controls").effect("Diverge distance")("Slider");

    _dcs = thisComp.layer("N exp controls").effect("Diverge curve strength (%)")("Slider");

    _mult = 0.5;

    _prev = thisComp.layer("Sh primary route").content("Group 1").content("Path 1").path;

    _knots = _prev.points().slice(1);

    _knotsIn = _prev.inTangents().slice(1);

    _knotsOut = _prev.outTangents().slice(1);

    _knot01 = [0, 3300 - 480];

    _knot02 = _knot01 - [_dd, _dd * 1.547] * _mult;

    _knot03 = [_knot02[0], thisComp.height * -1.0];

    _knots.push(_knot01, _knot02, _knot03);

    _knotsIn.push([0, 0], [0, _dd * _dcs * _mult], [0, 0]);

    _knotsOut.push([0, _dd * -_dcs * _mult], [0, 0], [0, 0]);

    createPath(_knots, _knotsIn, _knotsOut, false);

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