Copy link to clipboard
Copied
Hello;
I'm trying to make a portion of a script that allows me to shift the keyframes of an animated property of layer according to a new value.
I'm cycling through all the properties of my layers. I'm trying to copy keyframes for each property into a list.
The issue now, is that only position property returns values into the list, other properties such as scale and other properties return an empty list.
I'm wondering what's about this function, why it's not returning data for other properties than position.
function collectKeyframes(propertyInput)
{
if(propertyInput instanceof Property)
{
var totalKeys, prop, keyIndexList, curKeyIndex, curKeyValue, inin, outin, ab, cb, ie, oe, sab, scb, ist, ost, rov, twoDS, threeDS;
twoDS= PropertyValueType.TwoD_SPATIAL;
threeDS = PropertyValueType.ThreeD_SPATIAL;
keyIndexList = new Array();
totalKeys = propertyInput.numKeys;
if(totalKeys > 0)
{
for(var i = 1; i<= totalKeys; i++)
{
curKeyTime = propertyInput.keyTime(i);
curKeyTime= curKeyTime+1;
curKeyIndex = i;
curKeyValue = propertyInput.keyValue(i);
inin = propertyInput.keyInInterpolationType(curKeyIndex);
outin = propertyInput.keyOutInterpolationType(curKeyIndex);
if(inin == KeyframeInterpolationType.BEZIER && outin == KeyframeInterpolationType.BEZIER)
{
ab = propertyInput.keyTemporalAutoBezier(curKeyIndex);
cb = propertyInput.keyTemporalContinuous(curKeyIndex);
}
if(inin != KeyframeInterpolationType.HOLD || outin != KeyframeInterpolationType.HOLD)
{
ie = propertyInput.keyInTemporalEase(curKeyIndex);
oe = propertyInput.keyOutTemporalEase(curKeyIndex);
}
if(propertyInput.propertyValueType == twoDS || propertyInput.propertyValueType == threeDS)
{
sab = propertyInput.keySpatialAutoBezier(curKeyIndex);
scb = propertyInput.keySpatialContinuous(curKeyIndex);
ist = propertyInput.keyInSpatialTangent(curKeyIndex);
ost = propertyInput.keyOutSpatialTangent(curKeyIndex);
rov = propertyInput.keyRoving(curKeyIndex);
keyIndexList [keyIndexList.length] = {'curKeyTime': curKeyTime, 'curKeyIndex':curKeyIndex , 'curKeyValue':curKeyValue , 'inin':inin , 'outin':outin , 'ab':ab , 'cb':cb , 'ie':ie , 'sab':sab, 'scb':scb, 'ist':ist, 'ost':ost, 'rov':rov}
}
}
alert (keyIndexList);
return (keyIndexList);
}
else
{
return null;
}
}
}
Thanks in advance.
Seems like you're only storing values for TwoD_SPATIAL and ThreeD_SPATIAL. Only properties like Position and Anchor Point are spatial properties that have both spatial (controlling ease between keyframes in space) and temporal (controlling ease between keyframes in time) handles.
Copy link to clipboard
Copied
Seems like you're only storing values for TwoD_SPATIAL and ThreeD_SPATIAL. Only properties like Position and Anchor Point are spatial properties that have both spatial (controlling ease between keyframes in space) and temporal (controlling ease between keyframes in time) handles.