ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Adding 2 Presets to a Layer

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Vinay Parakala
Adding 2 Presets to a Layer
on Oct 22, 2019 at 6:36:35 pm

I'm new to After Effects and I'm trying to write a script to have a piece of text animate in at 6 seconds and disappear at 10 seconds using a script. I have this:

var proj = app.project;
var activeItem = proj.activeItem;
var myComp = activeItem;
textLayer = myComp.layers.addText("hello world");
textLayer.property("Position").setValue([50, 50]);
var entrance = new File("/Applications/Adobe After Effects CC 2019/Presets/Text/Animate In/Slow Fade On.ffx");
var exit = new File("/Applications/Adobe After Effects CC 2019/Presets/Text/Animate Out/Fade Out Slow.ffx");
activeItem.time = 6;
textLayer.applyPreset(entrance);
activeItem.time = 10;
textLayer.applyPreset(exit);


However, this only applies the last preset. It seems like in general when applying multiple presets to a layer, only the last one actually gets applied. Why is that and is there a way I can do this completely with a script?

Thanks in advance


Return to posts index

Dan Ebberts
Re: Adding 2 Presets to a Layer
on Oct 22, 2019 at 8:30:05 pm

Try it this way:


function select(theLayer){
var theComp = theLayer.containingComp;
for (var i = 1; i <= theComp.numLayers; i++){
theComp.layer(i).selected = false;
}
theLayer.selected = true;
}
var proj = app.project;
var activeItem = proj.activeItem;
var myComp = activeItem;
textLayer = myComp.layers.addText("hello world");
textLayer.property("Position").setValue([50, 50]);
var entrance = new File("/Applications/Adobe After Effects CC 2019/Presets/Text/Animate In/Slow Fade On.ffx");
var exit = new File("/Applications/Adobe After Effects CC 2019/Presets/Text/Animate Out/Fade Out Slow.ffx");
activeItem.time = 6;
select(textLayer);
textLayer.applyPreset(entrance);
activeItem.time = 10;
select(textLayer);
textLayer.applyPreset(exit);



Dan



Return to posts index

Vinay Parakala
Re: Adding 2 Presets to a Layer
on Oct 22, 2019 at 10:27:41 pm

Worked perfectly! Thanks so much Dan


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]