public async Task AnimateAppleWhooshAsync(DraggableImage apple) { var ax = AppleHelpers.GetLeft(apple); var ay = AppleHelpers.GetTop(apple); var bx = AppleHelpers.GetLeft(BasketBottomArea) + RND.Next() % (BasketBottomArea.Width - apple.Width); var by = AppleHelpers.GetTop(BasketBottomArea) + RND.Next() % (BasketBottomArea.Height - apple.Height); //Canvas.SetLeft(apple, bx); Canvas.SetTop(apple, by); AbsoluteLayout.SetLayoutBounds(apple, new Rectangle(bx, by, apple.Width, apple.Height)); SetZIndex(apple, 1); var sb = new StoryBoard(); //From = ax - bx, From = ay - by var an = new TranslateToAnimation { TranslateX = 0, TranslateY = 0, Duration = (200).ToString() }; sb.Target = apple; sb.Animations.Add(an); await sb.PlayAsync(); }
public async Task AnimateAppleInsertAsync(Image apple, int delayMs) { apple.IsVisible = false; StoryBoard sb = new StoryBoard(); //From = 4, var anx1 = new ScaleToAnimation() { Scale = 4, Duration = (250).ToString() }; var anx2 = new ScaleToAnimation() { Scale = 1, Duration = (250).ToString() }; sb.Target = apple; sb.Animations.Add(anx1); sb.Animations.Add(anx2); await Task.Delay(delayMs); apple.IsVisible = true; await sb.PlayAsync(); }