Creative COW SIGN IN :: SPONSORS :: ADVERTISING :: ABOUT US :: CONTACT US
Creative COW's LinkedIn GroupCreative COW's Facebook PageCreative COW on TwitterCreative COW's Google+ PageCreative COW on YouTube
ADOBE AFTER EFFECTS:HomeForumBasicsExpressionsTutorialsPodcastsAE TechniquesTrainingCreative Cloud DebateFAQ

Convert mask vertices to text...

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook
Barend OnneweerConvert mask vertices to text...
by on Jun 21, 2012 at 6:41:27 pm

Hi,

As part of a script I'm creating I'd like the script to draw a path on a solid or a shapelayer. Do do this I need to specify the vertices. I can easily draw a square or an ellipse but anything beyond becomes a rather tedious task. So ideally I'd prepare my shape in illustrator, paste it into After Effects and then somehow get the vertex data in text from the path...

Is such a thing possible? Or should I just stick to a circle...

Barend

Raamw3rk - independent colourist and visual effects artist


Return to posts index
Reply   Like  

Barend OnneweerRe: Convert mask vertices to text...
by on Jun 21, 2012 at 6:52:56 pm

Hmmm... I can of course paste the path into the position property to get an array of coordinates... but when I paste the position keyframes into a text file there's no tangent information.

Raamw3rk - independent colourist and visual effects artist


Return to posts index
Reply   Like  

Dan EbbertsRe: Convert mask vertices to text...
by on Jun 21, 2012 at 7:23:46 pm

That should work. Your script should be able to harvest the tangent arrays.

Dan



Return to posts index
Reply   Like  


Barend OnneweerRe: Convert mask vertices to text...
by on Jun 24, 2012 at 7:39:44 pm

Hi Dan,

So... a little later I actually 'got my nerd on' and managed to get the full vertex data including tangents to a text file.

Now I'm stuck getting the script to draw the shape as a shape layer.

I found examples for generic built-in Ellipses etc, but I can't figure out where exactly to put my vertex data... This must be one of the least travelled areas of AE scripting...

This is what I got for drawing a generic Ellipse:

var myEllipseSize = [100,200];
var myStrokeColor = [1,0,0];

var myShapeLayer= thisComp.layers.addShape();

var myShapeLayerContents = myShapeLayer.property("ADBE Root Vectors Group");
var myShapeGroup = myShapeLayerContents.addProperty("ADBE Vector Group");
myShapeGroup.name = "Circle";
var myEllipse = focusShapeGroup.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Ellipse");
myEllipse.property("ADBE Vector Ellipse Size").setValue(myEllipseSize);


And I get that I need to take out the Ellipse bits, but I'm missing something somewhere...

Any pointers would once again be much appreciated!

Raamw3rk - independent colourist and visual effects artist


Return to posts index
Reply   Like  

Dan EbbertsRe: Convert mask vertices to text...
by on Jun 24, 2012 at 9:23:20 pm

The shape stuff is pretty tricky. This should draw a squished oval:

var myVertices = [[0,-150],[-30,0],[0,150],[30,0]];
var myInTangents = [[145,0],[0,-60],[-145,0],[0,60]];
var myOutTangents = [[-145,0],[0,60],[145,0],[0,-60]];

var myComp = app.project.activeItem;
var myShapeLayer = myComp.layers.addShape();
var myShapeLayerContents = myShapeLayer.property("ADBE Root Vectors Group");
var myShapeGroup = myShapeLayerContents.addProperty("ADBE Vector Group");
var myShapeContents = myShapeGroup.addProperty("ADBE Vectors Group");
var myPathGroup = myShapeContents.addProperty("ADBE Vector Shape - Group");
var myPathObject = myPathGroup.property("ADBE Vector Shape");

var myPath = myPathObject.value;
myPath.vertices = myVertices;
myPath.inTangents = myInTangents;
myPath.outTangents = myOutTangents;
myPath.closed = true;
myPathObject.setValue(myPath)


Good luck. :-)


Dan



Return to posts index
Reply   Like  

Barend OnneweerRe: Convert mask vertices to text...
by on Jun 25, 2012 at 6:43:36 am

That works! Thanks so much!

Raamw3rk - independent colourist and visual effects artist


Return to posts index
Reply   Like  

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
Share on Facebook


FORUMSTUTORIALSMAGAZINESTOCKYARDVIDEOSPODCASTSEVENTSSERVICESNEWSLETTERNEWSBLOGS

Creative COW LinkedIn Group Creative COW Facebook Page Creative COW on Twitter
© 2013 CreativeCOW.net All rights are reserved. - Privacy Policy

[Top]