Skip to main content
Chaint
Known Participant
April 25, 2023
Answered

How to determine the length of the current layer

  • April 25, 2023
  • 1 reply
  • 323 views

This jsfl can add a blank keyframe to the last frame of the current layer
But there will be an error that automatically extends to the end frame of the timeline
how to fix

if (aslayer.frameCount < tl.frameCount) {
    tl.insertBlankKeyframe(tl.frameCount);
} else {
    if (aslayer.frames[aslayer.frameCount].startFrame !== aslayer.frameCount) {
        tl.insertBlankKeyframe(tl.frameCount);
    }
}
This topic has been closed for replies.
Correct answer Multoman
var doc = fl.getDocumentDOM()
var tl = doc.getTimeline()
var currentLayer = tl.currentLayer; 
var frameCount = tl.layers[(currentLayer)].frameCount;
tl.insertBlankKeyframe(frameCount -1);

1 reply

Multoman
MultomanCorrect answer
Inspiring
April 25, 2023
var doc = fl.getDocumentDOM()
var tl = doc.getTimeline()
var currentLayer = tl.currentLayer; 
var frameCount = tl.layers[(currentLayer)].frameCount;
tl.insertBlankKeyframe(frameCount -1);