public async Task AFullAnimationShouldReturnToOriginalValues() { var animation = new TadaAnimation(); var view = new MockView(); await animation.Animate(view); Assert.IsTrue(view.ValuesSet.ContainsKey(nameof(View.Scale))); Assert.AreEqual(1, view.ValuesSet[nameof(View.Scale)].Last()); Assert.IsTrue(view.ValuesSet.ContainsKey(nameof(View.Rotation))); Assert.AreEqual(0, view.ValuesSet[nameof(View.Rotation)].Last()); }
public async Task AnAbortedAnimationShouldNotReturnToOriginalValues() { var animation = new TadaAnimation(); var view = new MockView(); var cancellationTokenSource = new CancellationTokenSource(100); await animation.Animate(cancellationTokenSource.Token, view); Assert.IsTrue(view.ValuesSet.ContainsKey(nameof(View.Scale))); Assert.AreNotEqual(1, view.ValuesSet[nameof(View.Scale)].Last()); Assert.IsTrue(view.ValuesSet.ContainsKey(nameof(View.Rotation))); Assert.AreNotEqual(0, view.ValuesSet[nameof(View.Rotation)].Last()); }
private static AnimationDefinition GetAnimationDefinition(string animationName) { AnimationDefinition animationDefinition = null; if (animationName != null) { switch (animationName.ToLower()) { case "flash": animationDefinition = new FlashAnimation(); break; case "bounce": animationDefinition = new BounceAnimation(); break; case "shake": animationDefinition = new ShakeAnimation(); break; case "tada": animationDefinition = new TadaAnimation(); break; case "swing": animationDefinition = new SwingAnimation(); break; case "wobble": animationDefinition = new WobbleAnimation(); break; case "pulse": animationDefinition = new PulseAnimation(); break; case "breathing": animationDefinition = new BreathingAnimation(); break; case "jump": animationDefinition = new JumpAnimation(); break; case "flip": animationDefinition = new FlipAnimation(); break; case "flipinx": animationDefinition = new FlipInXAnimation(); break; case "flipoutx": animationDefinition = new FlipOutXAnimation(); break; case "flipiny": animationDefinition = new FlipInYAnimation(); break; case "flipouty": animationDefinition = new FlipOutYAnimation(); break; case "fadein": animationDefinition = new FadeInAnimation(); break; case "fadeout": animationDefinition = new FadeOutAnimation(); break; case "fadeinleft": animationDefinition = new FadeInLeftAnimation(); break; case "fadeinright": animationDefinition = new FadeInRightAnimation(); break; case "fadeinup": animationDefinition = new FadeInUpAnimation(); break; case "fadeindown": animationDefinition = new FadeInDownAnimation(); break; case "fadeoutleft": animationDefinition = new FadeOutLeftAnimation(); break; case "fadeoutright": animationDefinition = new FadeOutRightAnimation(); break; case "fadeoutup": animationDefinition = new FadeOutUpAnimation(); break; case "fadeoutdown": animationDefinition = new FadeOutDownAnimation(); break; case "bouncein": animationDefinition = new BounceInAnimation(); break; case "bounceout": animationDefinition = new BounceOutAnimation(); break; case "bounceinleft": animationDefinition = new BounceInLeftAnimation(); break; case "bounceinright": animationDefinition = new BounceInRightAnimation(); break; case "bounceinup": animationDefinition = new BounceInUpAnimation(); break; case "bounceindown": animationDefinition = new BounceInDownAnimation(); break; case "bounceoutleft": animationDefinition = new BounceOutLeftAnimation(); break; case "bounceoutright": animationDefinition = new BounceOutRightAnimation(); break; case "bounceoutup": animationDefinition = new BounceOutUpAnimation(); break; case "bounceoutdown": animationDefinition = new BounceOutDownAnimation(); break; case "scalein": animationDefinition = new ScaleInAnimation(); break; case "scaleout": animationDefinition = new ScaleOutAnimation(); break; case "lightspeedinleft": animationDefinition = new LightSpeedInLeftAnimation(); break; case "lightspeedinright": animationDefinition = new LightSpeedInRightAnimation(); break; case "lightspeedoutleft": animationDefinition = new LightSpeedOutLeftAnimation(); break; case "lightspeedoutright": animationDefinition = new LightSpeedOutRightAnimation(); break; case "hinge": animationDefinition = new HingeAnimation(); break; case "reset": animationDefinition = new ResetAnimation(); break; } } return(animationDefinition); }