Page 1 of 1

Why my animation preset is applied on the wrong layer

Posted: May 28th, 2014, 7:58 am
by mienda
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

Re: Why my animation preset is applied on the wrong layer

Posted: May 28th, 2014, 3:59 pm
by beginUndoGroup

Re: Why my animation preset is applied on the wrong layer

Posted: June 23rd, 2014, 8:39 am
by mienda
Thank'a lot :)