我正在制作一个After Effects脚本,为孩子们生成简单的形状和动画,我试图避免将矢量形状从Illustrator导入After Effects来为它们设置动画。这与简单的形状如正方形和圆形完美配合。
是否有任何解决方案可以在Extendscript Toolkit中生成复杂的形状,一个没有导入的纯代码或定位一些.txt文件,只需设置形状的顶点,位置和颜色,并通过运行将其作为蒙版应用于新的实体After Effects里面的脚本?
如果我想手动完成,我会添加一个新的实体,从Illustrator复制第一条路径,然后返回到后效果以将其粘贴到该实体上,然后我将添加另一个实体,回到插图画家,复制另一条路径,回到效果后,将其粘贴在固体2上,我将重复该过程,直到最终结果出现。
我想结束软件1和2之间的这种切换,并将图形保存为[vertices],[in-tangents]和[out-tangents]的数组,并随时调用它!
谢谢!
我这样做了,它可以用于导入任何类型的镜头
var path = "File Path";
var input = new ImportOptinputns(File(path));
if (input.canImportAs(ImportAsType.FOOTAGE));
input.importAs = ImportAsType.FOOTAGE;
或者,如果要导入图像序列,可以这样做
// or if your footage is an image sequence
input.sequence = true;
input.forceAlphabetical = true;
imageSequence = app.project.importFile(input);
imageSequence.name = 'My automatically imported foorage";
theComp = app.project.activeItem; //import in to currently selected composition
theComp.layers.add(imageSequence);
我知道如何通过脚本创建简单的矢量对象,但我不确定它是否适合您的工作。两组矩形的示例
var shapeLayer = newComp.layers.addShape(); // adding shape layer
shapeLayer.name = "bannerLayer"; // name the shape layer
var shapeGroup1 = shapeLayer.property("Contents").addProperty("ADBE Vector Group"); / creating a group1
shapeGroup1.name = "Banner"; //name the group1
myRect= shapeGroup1.property("Contents").addProperty("ADBE Vector Shape - Rect"); // adding rectangle to the group1
另一个更复杂的形状示例,一个三角形添加到现有的形状图层,您可以使用此代码作为基础并创建更复杂的形状。
var shapeLayer = newComp.layers.addShape(); // adding shape layer
shapeLayer.name = "bannerLayer"; // name the shape layer
var shapeGroup1 = shapeLayer.property("Contents").addProperty("ADBE Vector Group"); // creating a group1
shapeGroup1.name = "Banner"; //name the group1
myRect = shapeGroup1.property("Contents").addProperty("ADBE Vector Shape - Rect"); // adding rectangle to the group1
// construct a Shape object that forms a triangle
var myTriShape = new Shape();
myTriShape.vertices = [[-50,50], [50,50], [0,100]];
myTriShape.closed = true;
// add a Path group to our existing shape layer
myTriGroup = shapeLayer.property("Contents").addProperty("ADBE Vector Group"); // adding rectangle to the group1
myTriGroup.name = "Triangle";
myTri = myTriGroup.property("Contents").addProperty("ADBE Vector Shape - Group");
// set the Path property in the group to our triangle shape
myTri.property("Path").setValue(myTriShape);
您可以在此页面上找到更多信息。我自己搜索了一下。