Skip to main content
Participant
October 7, 2015
Answered

How to apply animation preset to a selected or all layers through a script?

  • October 7, 2015
  • 1 reply
  • 3284 views

Hello all,

I have several layers and I want to apply a random animation preset to each layer through a script.

I know how to apply an effect, for eg. [somelayer].property("Effects").addProperty("Block Dissolve"),

but how to apply a whole animation preset (eg. Block Dissolve - digital or Card Wipe - 3D pixelstorm).

Thanks!

This topic has been closed for replies.
Correct answer Dan Ebberts

Once you have the file path to the preset, you can do it like this:

myLayer.applyPreset(File(myPresetPath));

Dan

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
October 7, 2015

Once you have the file path to the preset, you can do it like this:

myLayer.applyPreset(File(myPresetPath));

Dan

Participant
October 7, 2015

Thank you for such a fast answer!!!

P.S.

It works but only on a currently selected layer. If none of the layers are selected, AE simply creates a new Solid layer and applies preset on it:

var activeComp = app.project.activeItem;

var compLayers = activeComp.layers;

var preset = File('C:\\Program\ Files\\Adobe\\Adobe\ After\ Effects\ CS5.5\\Support\ Files\\Presets\\Transitions\ -\ Movement\\Card\ Wipe\ -\ 2D\ fractured.ffx')

for (var i = 1; i  <=compLayers.length; i++){

    compLayers.applyPreset(preset);

}

Participant
April 18, 2016

Yes, that's true--sorry I forgot to mention it.

Dan


I'm trying to apply this but cannot seem to get it working.

var preset = File('/Users/adamforbeslocal/Documents/Adobe/After Effects CC 2014/User Presets/Asterisk.ffx')

var layerName = "Asterisk";

var newPosition = [100,100];

var newScale = [00,100];

var myLayer = app.project.activeItem.layer(layerName);

myLayer.property("Position").setValue(newPosition);

myLayer.property("Scale").setValue(newScale);

myLayer.applyPreset(preset);

I have a layer names "Asterisk" I'm trying to apply an animation preset to it.  Right now I just have scale in position in there for testing purposes.

I want to make sure this works when even other layers are selected... I want it to find the specific layer asterisk in my project and apply a preset....

Right now it adjust the position of the asterisk layer then the scale, then it creates a new solid and adds the preset to that solid instead of adding it to the asterisk layer.

Can't quite figure it out. Is there a way to get it to add it to only the layer named asterisk, without selecting the layer asterisk?

Thanks

Adam