ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

ScriptUI - NewPath() question?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
joshua faget
ScriptUI - NewPath() question?
on Nov 20, 2016 at 8:13:15 am


I want to create a UI element that is composed of a stroked path.
But I can't seem to figure out how its supposed to be done...

var Win = new Window("palette",'Window');
var grp = Win.add("group",[0,0,300,200]);

var PathPoints = [[0,0],[10,10],[0,10]] //example path.
var Path =;
var strokeBrush =, [1, 1, 1, 1],2);

Return to posts index

Xavier Gomez
Re: ScriptUI - NewPath() question?
on Nov 20, 2016 at 9:02:00 am

The path properties are not exposed to scripting apparently.
You need to use the moveTo() and lineTo() methods:

var g =;
var strokePen = g.newPen( g.PenType.SOLID_COLOR, [1, 1, 1, 1],2);
// to close: g.closepath();
g.strokePath(strokePen, g.currentPath);

Paths defined this way will only be drawn while the group is drawn. This requires to define grp.onDraw somewhere will all the instructions to draw the group, like above, that is :
grp.onDraw = function(){ /*some code involving*/};
and in CC it turns out that onDraw is a little bit buggy: sometimes custom graphics defined through onDraw disappear while the user opens a dialog, and are not redrawn afterwards. See also this thread: (harder bug in CC2015 and later). Overall, it seems that it is no longer a good idea to use custom onDraw with ScriptUI.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 All Rights Reserved