abort() vs finish() - Grisgram/gml-raptor GitHub Wiki

In Version 2.6 and later, the Animation class is extended by a new method, .finish(). A few words on this one, as you might be confused, because there's already an .abort() method available.

.abort() stops the animation immediately, invoking the finished_triggers, if there are any defined, and returns.

.finish() does more. It performs a fast_forward of the entire animation, simulating all remaining frames and thus also invokes all the frame_triggers on the way. This means, this method takes longer to return, but ensures, that all frames (based on the current delta_time) are processed. See it as a "do all remaining frames in the current frame". In reality, this is very fast, but it depends on the animation length. If there are 10 frames left to process, it will be done almost instantly, if this is a 2-minute-animation of 10,000 frames, expect some milliseconds to pass until this function returns.

These images here shall visualize, how the two methods work:

abort

finish

paused and finished states

An Animation can be in a paused state (by invoking the pause() method) or it can be finished already. In the latter case, nothing happens, when you invoke abort() or finish(), but both methods will ignore the paused state and bring the animation to an end.

It is important, that you are aware of this.

However, both internal flags (paused and finished) are set to the state they had before after abort() or finish() are complete.