- Home /
Animation Timeline Last Frame Duration
Hi,
I'm struggling to work out what the best approach is for looping simple sprite animations, using the non-legacy animation timeline.
I have an 8-keyframe character run cycle, with each part of the cycle lasting 3 frames, so I have 8 keyframes on my timeline, each 3 units/measurements apart. What should I do with the end of the timeline to make the timing of each frame of the cycle completely equal/uniform?
I know that I could duplicate the first keyframe of the run cycle and place it at the end, 3 frames after the final frame's keyframe, causing the final keyframe to last longer than a single frame, but that makes my first keyframe appear to last longer (because, I guess, it is lasting longer, by one frame).
The solution I currently use is to place an additional keyframe containing the last frame of the run cycle, and place it one frame leftward, making the gap smaller than with every other interval. This means that, on frame 22, I have my new 8th keyframe, and I have it again on frame 24.
I've used Flash quite a lot, so I guess what I'm asking is this: is there a way to specify that a keyframe lasts a certain number of frames, not requiring a repeat keyframe to finish? Or is there a way to specify simply an ending keyframe, whereby the data for that keyframe isn't repeated from the previous keyframe?
The reason I'm fussy about this is (beyond just wanting to do things the right way) I was hoping to have myself or artists make use of the quick method of selecting multiple images from the project pane and dragging them into the timeline, without having to perform this extra step each time, which I feel might be a workaround of mine and not the correct approach.
Thanks
Answer by prossel · May 19, 2015 at 07:14 PM
You can add an event to the end of the animation and move it past the last keyframe.
This will extend the last keyframe duration to the event.
No need to select a function if you don't want but you will probably get the error:
'YourAnimationName' AnimationEvent has no function name specified!
To avoid the error, add a dummy function to a script on the GameObject and select it for the event.