CommunityToolkit / CommunityToolkit/Maui
[Proposal] Compound Animations
- Dominant language
- C#
- Stars
- 2.7k
- Forks
- 500
- Avg merge
- 2d 14h
- Merged PRs (30d)
- 7
Description
Compound Animations
* [x] Proposed
* [ ] Prototype: Not Started
* [ ] Implementation: Not Started
* [ ] iOS Support
* [ ] Android Support
* [ ] macOS Support
* [ ] Windows Support
* [ ] Unit Tests: Not Started
* [ ] Sample: Not Started
* [ ] Documentation: Not Started
## Summary
[summary]: #summary
A comprehensive set of complex animations based on https://animate.style
## Motivation
[motivation]: #motivation
To provide a feature rich set of animations that users can just use.
## Detailed Design
[design]: #detailed-design
The implementation will extend the existing `AnimationBehavior` and `AnimationBase` functionality in order to reduce any additional API footprint increase.
### CompoundAnimationBase.shared.cs
```csharp
public abstract class CompoundAnimationBase : AnimationBase
{
public static readonly BindableProperty IsRepeatedProperty;
public bool IsRepeated { get; set; }
// Extension from AnimationBase
public override Task Animate(View? view);
public Task Animate(CancellationToken? cancellationToken, params View[]? views);
protected abstract Animation CreateAnimation(params View[] views);
}
```
### RubberBandAnimation.shared.cs
```csharp
public class RubberBandAnimation : CompoundAnimationBase
{
protected override Animation CreateAnimation(params View[] views);
}
```
### TadaAnimation.shared.cs
```csharp
public class TadaAnimation : CompoundAnimationBase
{
protected override Animation CreateAnimation(params View[] views);
}
```
## Usage Syntax
[usage]: #usage-syntax
### XAML Usage
```xml
```
### C# Usage
```csharp
var cancelAnimationTokenSource = new CancellationTokenSource();
var animation = RubberBandAnimation
{
Easing = Easing.Linear,
Duration = 100
};
await animation.Animate(cancelAnimationTokenSource.Token, myView, myView2);
```
## Drawbacks
[drawbacks]: #drawbacks
## Alternatives
[alternatives]: #alternatives
## Unresolved Questions
[unresolved]: #unresolved-questions
**I have left this only covering publicly exposed parts of the toolkit. Is this fine?**
**Dependent on #35**
Contributor guide
Assessment
This issue has not been assessed yet.