How to Play Gum Screen Animations
Introduction
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.
Setup
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.
Accessing animations in code
Playing Animations on Component Instances
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:
GumAnimation Details
All animations are instances of the GumAnimation class, which provides useful variables, methods, and events.
EndReached Event
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:
Last updated