private void animateSecondCard(PokemonCardView card, double ratioFromCenter) { card.MainImage.Opacity = LimitRange((ratioFromCenter - 0.3) * 3, 0, 1); var scale = LimitRange(ratioFromCenter * 1.25, 0, 1); card.MainImage.Scale = scale; Debug.WriteLine($"Y2: {card.MainImage.Height}"); card.MainImage.TranslationY = (card.MainImage.Height - scale * card.MainImage.Height) / 2; }
private void animateFirstCard(PokemonCardView card, double ratioFromCenter) { var delayCardOpacityFactor = 0.6; var delayImageScaleFactor = 0.4; var delayImageOpacityFactor = 0.3; MainCardView.CurrentView.Opacity = LimitRange((1 + delayCardOpacityFactor) - ratioFromCenter, 0, 1); var scale = LimitRange((1 + delayImageScaleFactor) - (ratioFromCenter * 1.75), 0.2, 1); card.MainImage.Scale = scale; Debug.WriteLine($"Y1: {((1 - scale) * card.MainImage.Height)/2}"); card.MainImage.TranslationY = ((1 - scale) * card.MainImage.Height) / 2; card.MainImage.Opacity = LimitRange((1 + delayImageOpacityFactor) - (ratioFromCenter * 1.5), 0, 1); if (ratioFromCenter > 0 && scale == 1) { card.ScaleTo(0.95, 50); } }