home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************
-
- ADOBE SYSTEMS INCORPORATED
-
- Copyright 2002 Adobe Systems Incorporated
-
- All Rights Reserved
-
-
-
- NOTICE: Adobe permits you to use, modify, and distribute this
-
- file in accordance with the terms of the Adobe license agreement
-
- accompanying it. If you have received this file from a source
-
- other than Adobe, then your use, modification, or distribution
-
- of it requires the prior written permission of Adobe.
-
- ***************************************************************/
-
- /***************************************************************
-
- Author: Mary Obelnicki
-
- ***************************************************************/
-
-
-
- /***************************************************************
-
-
-
- There are four types of functions that compose this include. Each of these
-
- function affect the distribution of start/end frames of an array of LMObjects.
-
-
-
- alignStartFrames(arrayObjs, moveKeyFrames, alignToCTI)
-
- alignEndFrames(arrayObjs, moveKeyFrames, alignToCTI)
-
- This utility will take an array of objects and align their
-
- start/end frames depending on the set parameters.
-
-
-
- Arguments:
-
- arrayObjs (array) - the array of LMObjects to align the lifetimes of
-
- moveKeyFrames (boolean) - If set to true, move the key frames with
-
- the lifetime. If set to false, the key frames in place.
-
- alignToCTI (boolean) - If set to true, place the first object's
-
- start/end frame at the current position of the CTI. If set to false,
-
- the start/end frame of the first object will be left in place.
-
-
-
- Example:
-
- alignStartFrames(application.currentComposition.selection, true, true);
-
-
-
-
-
-
-
- distributeStartFrames(arrayObjs, moveKeyFrames, alignToCTI, maintainOrder, topDown)
-
- distributeEndFrames(arrayObjs, moveKeyFrames, alignToCTI, maintainOrder, topDown)
-
- This utility will take an array of objects and distribute their start/end times
-
- across the timeline. This will not affect the lifetime of the objects.
-
-
-
- Arguments:
-
- arrayObjs (array) - the array of LMObjects to align the lifetimes of
-
- moveKeyFrames (boolean) - True: move the key frames with the lifetime.
-
- False: the key frames in place.
-
- alignToCTI (boolean) - If set to true, place the first object's
-
- start/end frame at the current position of the CTI. If set to false,
-
- the start/end frame of the first object will be left in place.
-
- maintainOrder (boolean) - True: maintain the order of start/end key frames.
-
- False: the start/end order will be automatically sorted as determined by topDown.
-
- topDown (boolean) - True: the order of sorting will be dependent upon the LMObject's
-
- position in the array. The stagger order will be from the first object
-
- in the array to the last object in the array. False: the stagger order will be
-
- from the last object in the array to the first object in the array
-
- .
-
-
-
- Example:
-
- distributeEndFrames(application.currentComposition.selection, true, false, false, false);
-
-
-
-
-
-
-
- staggerStartFrames(arrayObjs, moveKeyFrames, alignToCTI, stagger, maintainOrder, topDown)
-
- staggerEndFrames(arrayObjs, moveKeyFrames, alignToCTI, stagger, maintainOrder, topDown)
-
- This utility will take an array of objects and distribute their start/end frames
-
- by staggering each successive one a preset amount as set by the programmer.
-
-
-
- Arguments:
-
- arrayObjs (array) - the array of LMObjects to align the lifetimes of
-
- moveKeyFrames (boolean) - True: move the key frames with the lifetime.
-
- False: the key frames in place.
-
- alignToCTI (boolean) - If set to true, place the first object's
-
- start/end frame at the current position of the CTI. If set to false,
-
- the start/end frame of the first object will be left in place.
-
- stagger (integer) - the number of frames between each LMObject's start frame
-
- maintainOrder (boolean) - True: maintain the order of start/end key frames.
-
- False: the start/end order will be automatically sorted as determined by topDown.
-
- topDown (boolean) - True: the order of sorting will be dependent upon the LMObject's
-
- position in the array. The stagger order will be from the first object
-
- in the array to the last object in the array. False: the stagger order will be
-
- from the last object in the array to the first object in the array
-
-
-
- Example:
-
- staggerStartFrames(application.currentComposition.selection, true, true, 3, true, false);
-
-
-
-
-
-
-
- startFrameHelper(arrayObjs, moveKeyFrames, first, stagger, maintainStartOrder, topDown)
-
- endFrameHelper(arrayObjs, moveKeyFrames, first, stagger, maintainStartOrder, topDown)
-
- These utilities are the main engine behind all of the above functions.
-
- Depending upon the parameters, these functions can stagger an array
-
- of LMObjects' start/end frames.
-
-
-
- Arguments:
-
- arrayObjs (array) - the array of LMObjects to align the lifetimes of
-
- moveKeyFrames (boolean) - True: move the key frames with the lifetime.
-
- False: the key frames in place.
-
- first (integer) - the frame number where the first start/end frame will
-
- be placed.
-
- stagger (integer) - the number of frames between each LMObject's start/end frame
-
- maintainOrder (boolean) - True: maintain the order of start/end key frames.
-
- False: the start/end order will be automatically sorted as determined by topDown.
-
- topDown (boolean) - True: the order of sorting will be dependent upon the LMObject's
-
- position in the array. The stagger order will be from the first object
-
- in the array to the last object in the array. False: the stagger order will be
-
- from the last object in the array to the first object in the array
-
-
-
-
-
- ***************************************************************/
-
-
-
- /***************************************************************
-
- DO NOT EDIT BELOW THIS LINE
-
- ***************************************************************/
-
-
-
- #include "shellSort.js"
-
-
-
- function startFrameHelper(theObjects, moveKeyFrames, firstStart, stagger, maintainStartOrder, topDown)
-
- {
-
- var setStart = firstStart;
-
- var i;
-
-
-
- if(stagger != 0)
-
- {
-
- if(maintainStartOrder)
-
- shellSort(theObjects, "startFrame");
-
- else if(!topDown)
-
- theObjects.reverse();
-
- }
-
-
-
- if(moveKeyFrames)
-
- for(i = 0; i < theObjects.length; i++)
-
- theObjects[i].moveLifetimeTo(setStart + Math.round(i*stagger));
-
- else
-
- for(i = 0; i < theObjects.length; i++)
-
- theObjects[i].startFrame = setStart + Math.round(i*stagger);
-
-
-
- }
-
-
-
- function endFrameHelper(theObjects, moveKeyFrames, firstEnd, stagger, maintainEndOrder, topDown)
-
- {
-
- var setEnd = firstEnd;
-
- var i;
-
-
-
- // make the lifetimes explicit
-
- for(i = 0; i < theObjects.length; i++)
-
- theObjects[i].explicitLifetime = true;
-
-
-
- if(stagger != 0)
-
- {
-
- if(maintainEndOrder)
-
- shellSort(theObjects, "endFrame");
-
- else if(!topDown)
-
- theObjects.reverse();
-
- }
-
-
-
- if(moveKeyFrames)
-
- for(i = 0; i < theObjects.length; i++)
-
- {
-
- var lifetimeLength = theObjects[i].endFrame - theObjects[i].startFrame;
-
- theObjects[i].moveLifetimeTo(setEnd + Math.round(i*stagger)- lifetimeLength);
-
- }
-
- else
-
- for(i = 0; i < theObjects.length; i++)
-
- theObjects[i].endFrame = setEnd + Math.round(i*stagger);
-
-
-
- }
-
-
-
- function staggerStartFrames(theObjects, moveKeyFrames, alignToCTI, stagger, maintainStartOrder, topDown)
-
- {
-
- var firstStart;
-
- var i;
-
- if(alignToCTI)
-
- firstStart = theObjects[0].currentFrame;
-
- else
-
- {
-
- //find first startFrame;
-
- firstStart = theObjects[0].startFrame;
-
- for(i = 1; i < theObjects.length; i++)
-
- {
-
- var testStart = theObjects[i].startFrame;
-
- if(testStart < firstStart)
-
- firstStart = testStart;
-
- }
-
- }
-
-
-
- startFrameHelper(theObjects, moveKeyFrames, firstStart, stagger, maintainStartOrder, topDown);
-
- }
-
-
-
- function staggerEndFrames(theObjects, moveKeyFrames, alignToCTI, stagger, maintainEndOrder, topDown)
-
- {
-
- var firstEnd;
-
- var i;
-
- if(alignToCTI)
-
- firstEnd = theObjects[0].currentFrame;
-
- else
-
- {
-
- firstEnd = theObjects[0].endFrame;
-
- for(i = 1; i < theObjects.length; i++)
-
- {
-
- var testEnd = theObjects[i].endFrame;
-
- if(testEnd < firstEnd)
-
- firstEnd = testEnd;
-
- }
-
- }
-
-
-
- endFrameHelper(theObjects, moveKeyFrames, firstEnd, stagger, maintainEndOrder, topDown);
-
- }
-
-
-
- function distributeStartFrames(theObjects, moveKeyFrames, alignToCTI, maintainStartOrder, topDown)
-
- {
-
- var firstStart;
-
- var lastStart;
-
- var i;
-
-
-
- //find first and last startFrame;
-
- firstStart = theObjects[0].startFrame;
-
- lastStart = theObjects[0].startFrame;
-
- for(i = 1; i < theObjects.length; i++)
-
- {
-
- var testStart = theObjects[i].startFrame;
-
- if(testStart < firstStart)
-
- firstStart = testStart;
-
- else if(testStart > lastStart)
-
- lastStart = testStart;
-
- }
-
-
-
- if(alignToCTI)
-
- firstStart = theObjects[0].currentFrame;
-
-
-
- startFrameHelper(theObjects, moveKeyFrames, firstStart, (lastStart-firstStart)/(theObjects.length-1), maintainStartOrder, topDown);
-
- }
-
-
-
- function distributeEndFrames(theObjects, moveKeyFrames, alignToCTI, maintainEndOrder, topDown)
-
- {
-
- var firstEnd;
-
- var lastEnd;
-
- var i;
-
-
-
- firstEnd = theObjects[0].endFrame;
-
- lastEnd = theObjects[0].endFrame;
-
- for(i = 1; i < theObjects.length; i++)
-
- {
-
- var testEnd = theObjects[i].endFrame;
-
- if(testEnd < firstEnd)
-
- firstEnd = testEnd;
-
- else if(testEnd > lastEnd)
-
- lastEnd = testEnd;
-
- }
-
-
-
- if(alignToCTI)
-
- firstEnd = theObjects[0].currentFrame;
-
-
-
- endFrameHelper(theObjects, moveKeyFrames, firstEnd, (lastEnd-firstEnd)/(theObjects.length-1), maintainEndOrder, topDown);
-
- }
-
-
-
- function alignStartFrames(theObjects, moveKeyFrames, alignToCTI)
-
- {
-
- staggerStartFrames(theObjects, moveKeyFrames, alignToCTI, 0, false, true);
-
- }
-
-
-
- function alignEndFrames(theObjects, moveKeyFrames, alignToCTI)
-
- {
-
- var lastEnd;
-
- var i;
-
- if(alignToCTI)
-
- lastEnd = theObjects[0].currentFrame;
-
- else
-
- {
-
- lastEnd = theObjects[0].endFrame;
-
- for(i = 1; i < theObjects.length; i++)
-
- {
-
- var testEnd = theObjects[i].endFrame;
-
- if(testEnd > lastEnd)
-
- lastEnd = testEnd;
-
- }
-
- }
-
-
-
- endFrameHelper(theObjects, moveKeyFrames, lastEnd, 0, false, true);
-
- }
-