Animation Chaining - Grisgram/gml-raptor GitHub Wiki

From raptor Version 2.0 on, Animation supports chaining and looping of animations, building sequences of animations.

For this, there are three methods available:

  • .followed_by will launch another animation when this one finishes
  • .loop_to_start will restart the first animation of the sequence (thus building a chain of animations)
  • .loop_to will jump to a named animation anywhere in the sequence

Here is a little example of how this looks like in code:

animation_run(self, 0, 30, acLinearAlpha)
    .followed_by(0, 15, acLinearRotate).set_rotation_distance(-30)
    .followed_by(0, 30, acLinearRotate).set_rotation_distance(60).set_name("anchor")
    .followed_by(0, 30, acLinearRotate).set_rotation_distance(-60)
    .loop_to("anchor", 3)
    .followed_by(0, 15, acLinearRotate).set_rotation_distance(30);

At runtime, this looks like this: animate

This is a very easy-to-understand concept of chaining animations together, building complex workflows with an object.

With a creative usage of the loop_to* methods you can create amazing animated effects that are all handled for you in the engine.


Next to read: Animation Functions (Class)