Trouble linking Slider to a Shape layer parameter

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
mark_st62
Posts: 2
Joined: June 27th, 2012, 9:08 am

Hi everyone, this is my first post here.

I’ve been using AE professionally for 10 years, but am only recently delving into scripting. It’s definitely not my forte, but I’ve managed to cob together a couple simple scripts.
Now I’ve started working on something more complicated and have run into trouble with one section.

I have a Shape layer (rectangle) selected and when I run the script, it adds a Null layer and adds a Slider control to the Null.
I want to use this slider to control the Roundness parameter of the Shape layer.
I’ve tried quite a few things, and always get various errors. And after a few hundred tries, I'm feeling defeated.

I’m sure I’m going about this all wrong, since this Java script stuff is so new to me and I find it very hard to understand.
Anyway, here’s the code I’ve got at the moment.
(btw, I'm using After Effects CS5.5 on a Mac)

Code: Select all


//start with a Shape layer that is selected


var picOrigComp = app.project.activeItem;
var curLayer = picOrigComp.selectedLayers[0];


//Create Null layer and rename CONTROLS
mySolid = picOrigComp.layers.addNull();
var controlNULL = mySolid;
controlNULL.name = "CONTROLS";

////Add slider controls

var ctrlLayer = picOrigComp.selectedLayers[0];

var slider = ctrlLayer .property("ADBE Effect Parade").addProperty("ADBE Slider Control")
slider.property(1).setValueAtTime(0, 0); 
slider.name = "Frame Roundness";

var slider = ctrlLayer .property("ADBE Effect Parade").addProperty("ADBE Slider Control")
slider.property(1).setValueAtTime(0, 0); 
slider.name = "Stroke Thickness";

var color = ctrlLayer .property("ADBE Effect Parade").addProperty("ADBE Color Control");
color.property(1)
color.name = "Stroke Color";

//define null and shape layers
var roundCtrl = app.project.activeItem.layer("CONTROLS").property("Effects").property("Frame Roundness").property("Slider");
var roundShape = app.project.activeItem.layer("Shape Layer 1");

//link slider to shape layer's roundness control....   hopefully?
var shapeOrig = roundShape.property("ADBE Root Vectors Group");
var shapeNew = shapeOrig.addProperty("ADBE Vector Group");
var shapeRnd =  shapeNew.property("ADBE Vectors Group").addProperty("ADBE Vector Shape - Rect");
shapeRnd.property("ADBE Vector Rect - Roundness").setValue(roundCtrl);

If anyone can point out my problem(s), I'd sure appreciate the help. :)

Thanks,
Mark
Dan Ebberts
Posts: 320
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

You need to create the link by setting an expression for the Roundness property that points to the slider. I'd create the expression by hand first, copy it, and paste it into a variable in your script:

var myExpr = "(expression goes here);

So instead of using .setValue(roundCtrl) you would use .expression=myExpr

Hope that helps.

Dan
mark_st62
Posts: 2
Joined: June 27th, 2012, 9:08 am

Thanks Dan. I'll give that a try.


Mark
Post Reply