// Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. namespace osu.Framework.Graphics.Animations { /// /// This class holds various extension methods for the interface. /// public static class FramedAnimationExtensions { /// /// Displays the frame with the given zero-based frame index and stops the animation at that frame. /// /// The animation that should seek the frame and stop playing. /// The zero-based index of the frame to display. public static void GotoAndStop(this IFramedAnimation animation, int frameIndex) { animation.GotoFrame(frameIndex); animation.IsPlaying = false; } /// /// Displays the frame with the given zero-based frame index and plays the animation from that frame. /// /// The animation that should seek the frame and start playing. /// The zero-based index of the frame to display. public static void GotoAndPlay(this IFramedAnimation animation, int frameIndex) { animation.GotoFrame(frameIndex); animation.IsPlaying = true; } /// /// Resumes playing the animation. /// /// The animation to play. public static void Play(this IFramedAnimation animation) => animation.IsPlaying = true; /// /// Stops playing the animation. /// /// The animation to stop playing. public static void Stop(this IFramedAnimation animation) => animation.IsPlaying = false; /// /// Restarts the animation. /// /// The animation to restart. public static void Restart(this IFramedAnimation animation) => animation.GotoAndPlay(0); } }