ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Re: Remove all fills in a shape layer?

COW Forums : Adobe After Effects Expressions

FAQ   •   VIEW ALL   •   ADD A NEW POST   •   PRINT
Respond to this post   •   Return to posts index   •   Read entire thread


Xavier Gomez
Re: Remove all fills in a shape layer?
on Sep 3, 2015 at 9:15:20 am

The following will work in your case.
Choose handler=myHandler1 to remove all fills, and myHandler2 to set opacity to 0.
It's fairly generic, but you dont need to write it that way (with a separate handler function) if you only have one thing to do with those fills.

Xavier.

// handler : g should be a property group that can be added to a shape (empty group / path /stroke / fill / trim path etc)
function myHandler1(g){
if (g.matchName === "ADBE Vector Graphic - Fill") g.remove();
};
function myHandler2(g){
if (g.matchName === "ADBE Vector Graphic - Fill") g.opacity.setValue(0);
};

// main function : g is expected to be a shape layer or a shape group (shape "sublayer")
// handler : what to do with the addable content of g
// recursive, and recurses backwards, in case some children are removed...
// doesnt scout the transform group, only addable things
function scoutContent(g, handler){
var n, child;
if (!g.content) return;
g = g.content;
for (n=g.numProperties; n>0; n--){
child = g.property(n);
handler(child);
if (Object.isValid(child) && child.content) scoutContent(child, handler);
};
};

scoutContent(app.project.activeItem.selectedLayers[0], myHandler2);


Posts IndexRead Thread 


Current Message Thread:





© 2019 CreativeCOW.net All Rights Reserved
[TOP]