2

I'm newbie in After Effects. I've learned how to control slider from expressions. Now I need to get value of slider in script (jsx/extendscript). How can I achieve that?

I've tried (in *.jsx): var a = comp.layer("Slider 1").effect("Slider Control")("Slider")[0];

Result:

After Effects error: Unable to call "setValue" because of parameter 1. Value "NaN" of element 0 in the array is not a valid float.

It means that value of slider is not set yet?

Thanks

EDIT:

Here is a example:

var slider = comp.layers.addNull();
slider.name = "Slider";
slider.effect.addProperty("ADBE Slider Control")("Slider");
slider.effect("Slider Control").property("Slider").setValue(100);

var a = slider.effect("Slider Control").property("Slider");
var titleTriangle = comp.layers.addShape();
titleTriangle.name = ("Title Triangle");
var titleTriangleGroup = titleTriangle.property("Contents").addProperty("ADBE Vector Group");
var titleTriangleFill= titleTriangleGroup.property("Contents").addProperty("ADBE Vector Graphic - Fill");
titleTriangleFill.property("Color").setValue([0.68,0.29,0.29,1]);

// using 'a' here
titleTriangle.property("Position").setValue([a,188]);
  • Please paste all code here. It is difficult to understand, where can be problem, when you are seeing only part of code. – Shultc Apr 24 '16 at 12:31
  • @Shultc, thank you for response. I have added an example. – 49volro Apr 24 '16 at 14:38
  • Sounds like you need to know about Redefinery's RD_Gimme_Props script. It's a script that allows you to find the correct path for any composition element: bit.ly/1XTIzh0 There's a whole bunch of tools there for extendscript developers. – stib Apr 26 '16 at 4:57
3

I found out - .value after slider.effect("Slider Control").property("Slider") and it works.

var a = slider.effect("Slider Control").property("Slider").value

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.