Copy link to clipboard
Copied
is there any possible way to find where there are keyframes in a symbol
for example say I've made a graphic symbol for the characters head and I want to be able to use a jsfl command to find where there are keyframes inside the symbol and then shake the head symbol on a keyframe at the same time there is a keyframe inside of the symbol (to replecate the south park effect)
Hi,
Yes, you can detect keyframes in a symbol's internal timeline.
But, a keyframe is a property of a layer, not to a timeline at given frame. So, you must specify the layer from the internal timeline.
Here is a piece of code, that can be used as a starting point. It detects the internal keyframes in the selected symbol on the stage and outputs them as array of arrays.
function getKeyFrames( tml ){
this.isKeyFrame = function( timeline, layerNum, frameNum ){
if( ! timeline.layers[ layerNum ].
...
Copy link to clipboard
Copied
Hi,
Yes, you can detect keyframes in a symbol's internal timeline.
But, a keyframe is a property of a layer, not to a timeline at given frame. So, you must specify the layer from the internal timeline.
Here is a piece of code, that can be used as a starting point. It detects the internal keyframes in the selected symbol on the stage and outputs them as array of arrays.
function getKeyFrames( tml ){
this.isKeyFrame = function( timeline, layerNum, frameNum ){
if( ! timeline.layers[ layerNum ].frames[ frameNum ] ){
return false;
}
return ( timeline.layers[ layerNum ].frames[ frameNum ].startFrame === frameNum );
};
var retval = [];
for( var i = 0; i < tml.layers.length; i++ ){
var layerKeyFrames = [];
for( var j = 0; j < tml.layers[ i ].frames.length; j++ ){
if( this.isKeyFrame( tml, i, j ) ){
layerKeyFrames.push( j );
}
}
retval.push( layerKeyFrames );
}
return retval;
}
fl.trace( getKeyFrames( fl.getDocumentDOM().selection[0].libraryItem.timeline ) );