-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[F100] Basic GIF animation support #1704
Description
Rationale
Animated Gifs are popular. Providing the image view with features that allowed it to animate gifs would allow users to not have to use webviews or create other custom renderers
Implementation
Add an AnimationPlayBehaviorProperty for the Image control which indicates that a gif should start playing once it has loaded or if it should be started through other mechanisms.
Add two methods for starting and stopping the animation
public enum ImagePlayBehavior
{
None,
OnLoad
}
public static readonly BindableProperty AnimationPlayBehaviorProperty = BindableProperty.Create(nameof(AnimationPlayBehavior), typeof(ImagePlayBehavior), typeof(Image), ImagePlayBehavior.None);
public void StartAnimation();
public void StopAnimation();
Expected Result
Android
If user has specified they want the animation to play onload or they call StartAnimation then start playing the gif animation
iOS
See Android
UWP
See Android
Implications for CSS
Backward Compatibility
Ensure the way the current Image control processes gifs does not change unless the user opts in for the given properties
Difficulty : Medium
Work that's been done
https://forums.xamarin.com/discussion/17448/animated-gif-in-image-view
https://github.com/jamesmontemagno/PuppyKittyOverflow/blob/master/PuppyKittyOverflow.Touch/AnimatedImageView.cs
https://github.com/jamesmontemagno/GifImageView-Xamarin.Android
https://github.com/luberda-molinet/FFImageLoading/pull/470/files