Hello,
I am designing a script with an interface that includes a slider, which should control interactively the opacity of a layer. I am able to create the slider...but I can't get it to control the opacity of my layer. Tried a bunch of different options...and looked through similar scripts' code. But I can't seem to get it to work. Any ideas?
Control Opacity Interactively With Slider
Moderator: Paul Tuersley
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
Here's an example that will change the opacity of the first layer in the active comp:
Code: Select all
{
var pal = new Window("palette");
pal.slider = pal.add("slider", undefined, 0, 0, 100);
pal.center();
pal.show();
pal.slider.onChanging = onSliderChange;
function onSliderChange() {
var activeItem = app.project.activeItem;
if (activeItem != null && activeItem instanceof CompItem) {
activeItem.layer(1).property("ADBE Transform Group").property("ADBE Opacity").setValue(this.value)
}
}
}
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
Those are what's called matchNames, which is the universal names that don't change no matter what language you're running AE in. It ensures the script will run correctly in all languages, not just English.
Paul
Paul