Gum screens support animations which can be played through code. This article shows how to access a Gum animation and play it in your FlatRedBall project.
To access a Gum screen in code you must first create an object in Glue for the Gum screen. For information on how to do this, see this article. Animations can be defined in Gum or in code. To define an animation in Gum, see the Gum Usage Guide.
Animations added to Gum screens can be accessed in code. The Glue code generator will append the word "Animation" to animation names. For example, consider a Gum screen containing an animation called MoveToRight: Then this animation can be accessed in code:
Similar to screens, components can also contain animations which can be played at runtime. To play an animation on a component at runtime:
Add an animation to a Gum component
Obtain a reference to the component at runtime. For example, get a reference from a Gum screen in a Glue screen's Objects.
Call the Play method on the desired animation within the component instance in code. For example, if the ButtonRuntime has an animation called FadeOutAnimation, the following code could be used to play the animation:
All animations are instances of the GumAnimation class, which provides useful variables, methods, and events.
The EndReached event is raised by the animation after the animation reaches its end (which is defined by its Length property). To use the EndReached event, you can add an Action to it, as follows: