/* File: ..//src//afterEffects//crossfade.jsx Date: Sat Dec 27 15:17:32 MYT 2008 Author: David Van Brink This script is part of the omino adobe script suite. The latest version can be found at http://omino.com/pixelblog/. I write these because I like to. Please enjoy as you see fit. Questions to poly@omino.com, subject line should start with "plugins" so my spam filter lets it in. This file has been preprocessed to be standalone. I develop them against some reusable libraries -- such as for dialog layout -- but for distribution it's nicer to have just one file. dvb 2007. */ /* Description: This After Effects script modifies a composition such that each layer crossfades into the next. This can be a useful starting point for slideshows and such. :: */ //#include "../shared/ominoDialogMaker.jsx" var fadeTime = .2; var holdTime = 1.7; function removeKeyFrames(property) { var numKeys = property.numKeys; var i; for(i = 1; i <= numKeys; i++) { property.removeKey(1); } } myComp = app.project.activeItem; if(!(myComp instanceof CompItem)) { alert("please select a composition."); } else { app.beginUndoGroup("crossfade the layers"); var myLayers = myComp.layers; var m = myComp.name + " layers: "; for(i = 1; i <= myLayers.length; i++) { m += "\n" + i + ": " + myLayers[i].name; } alert(m); var t = 0; for(i = 1; i <= myLayers.length; i++) { l = myLayers[i]; l.startTime = t; l.inPoint = t + 0; l.outPoint = t + holdTime + 2 * fadeTime; var o = l.property("opacity"); removeKeyFrames(o); if(fadeTime) o.setValueAtTime(t,0); o.setValueAtTime(t + fadeTime,100); o.setValueAtTime(t + fadeTime + holdTime,100); if(fadeTime) o.setValueAtTime(t + fadeTime + holdTime + fadeTime,0); //var o = l.property("scale"); //removeKeyFrames(o); //o.setValueAtTime(t,[120,120]); //o.setValueAtTime(t + fadeTime + holdTime + fadeTime,[100,100]); t += fadeTime + holdTime; } app.endUndoGroup(); }