Why my animation preset is applied on the wrong layer

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
mienda
Posts: 5
Joined: November 6th, 2010, 4:40 am

May 28th, 2014, 7:58 am

I wrote this script below :
I want to duplicate the selected layer twice and apply on the first copy a blending mode and an animation preset.
Then move both copies in a pre-comp.

Code: Select all

var comp = app.project.activeItem;
var ffx = "path/BlurLuma.ffx";

if(comp && comp.selectedLayers.length > 0){
	for(var i = 0 ; i < comp.selectedLayers.length ; i++){
		var selectlayer = comp.selectedLayers[i];
         selectlayer.duplicate();
         selectlayer.duplicate();
         var dupli2 = selectlayer.index - 1;
         var dupli1 = selectlayer.index - 2 ;    
         comp.layer(dupli1).blendingMode = BlendingMode.DIFFERENCE ;
	    comp.layer(dupli1).applyPreset( new File (ffx)); 
        comp.layers.precompose( [dupli1, dupli2], "FxSoftLine", true);
      
   };
}else{
	alert('aucun calque selectionné');
};
I don't understand why the BlendingMode is applied on the right layer "dupli1" but the animation preset is always applied on the first selected layer. Can you help me ?

Thanks
beginUndoGroup
Posts: 81
Joined: November 27th, 2012, 6:41 am

May 28th, 2014, 3:59 pm

mienda
Posts: 5
Joined: November 6th, 2010, 4:40 am

June 23rd, 2014, 8:39 am

Thank'a lot :)
Post Reply