Maui
Maui copied to clipboard
[Proposal] Animation Behavior
Animation Behavior
- [x] Proposed
- [x] Prototype
- [x] Implementation
- [x] iOS Support
- [x] Android Support
- [x] macOS Support
- [x] Windows Support
- [x] Unit Tests
- [ ] Documentation: Not Started
- [ ] Sample: Not Started
Summary
AnimationBehavor
is a Behavior
that can be attached to any VisualElement
, allowing developers to trigger the following animations via ICommand AnimateCommand
:
- [x] #519
- [ ] FlipHorizontalAnimation
- [ ] FlipVerticalAnimation
- [ ] RotateAnimation
- [ ] ScaleAnimation
- [ ] ShakeAnimation
Motivation
AnimationBehavior
solves the following challenges:
- [x] Animations are not easily accomplished in XAML
- [x] Animations are not easily accomplished using
ICommand
Following the implementation of AnimationBehavior
, developers will easily be able to create bindable animations for any VisualElement
Detailed Design
AnimationBehavior.shared.cs
AnimationBehavior
is a Behavior
can be attached to any VisualElement
.
AnimationBehavior
implements EventToCommandBehavior
.
public class AnimationBehavior : EventToCommandBehavior
{
public static readonly BindableProperty AnimationTypeProperty;
public static readonly BindableProperty AnimateCommandProperty;
public AnimationBase? AnimationType { get; set; }
public ICommand AnimateCommand { get; }
}
AnimationBase<TView>
AnimationBase
is an abstract
class implementing BindableObject
that allows for creating animations.
public abstract class AnimationBase<TView> : BindableObject where TView : View
{
public static readonly BindableProperty DurationProperty;
public static readonly BindableProperty EasingTypeProperty
public uint Duration { get; set; }
public Easing Easing { get; set; }
public abstract Task Animate(TView? view);
}
Hi @brminnick, I love this feature. I can have a go at implementing it if you like.
Thanks @stefanbogaard86! Assigned 👍
Reopening Proposal.
Only Proposals moved to the Closed
Project Column and Completed
Project Column can be closed.
I am happy to get the remaining parts implemented for the next milestone unless @stefanbogaard86 you still wanted to work on this?
Hi @bijington, I've unassigned myself so go for it!
Hi @bijington, I've unassigned myself so go for it!
Thank you and thanks for all the hard work in getting it to this stage it really is appreciated!