private Animation CreateGradientAnimation(CardState cardState) { double start; double end; if (cardState == CardState.Expanded) { _gradientTransitionY = CardBackground.CanvasSize.Height; start = _gradientTransitionY; end = -_gradientHeight; } else { _gradientTransitionY = -_gradientHeight; start = _gradientTransitionY; end = CardBackground.CanvasSize.Height; } var gradientAnimation = new Animation( callback: v => { _gradientTransitionY = (float)v; CardBackground.InvalidateSurface(); }, start: start, end: end, easing: Easing.Linear, finished: () => { } ); return(gradientAnimation); }
private Animation GradientAnimation(CardState cardstate) { double start; double end; if (cardstate == CardState.Expended) { _gradientTransitionY = CardBackground.CanvasSize.Height; start = _gradientHeight; end = -_gradientTransitionY; } else { _gradientTransitionY = -_gradientHeight; start = _gradientTransitionY; end = CardBackground.CanvasSize.Height; } var gradientAnime = new Animation(v => { _gradientTransitionY = (float)v; CardBackground.InvalidateSurface(); }, start, end, Easing.Linear); return(gradientAnime); }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (this.BindingContext == null) { return; } _viewModel = this.BindingContext as ProductsCardsModels; // because we can't bind skia drawing using the binding engine // we cache the paint objects when the bound character changes //initialisont la position du top de la carte _cardTopAnimPosition = _cardTopMargin; _ProductColor = Color.FromHex(_viewModel.ProductColor).ToSKColor(); _ProductPaint = new SKPaint() { Color = _ProductColor }; _gradientTransitionY = float.MaxValue; // cette grande valeur permet que le gradient soit en bas de l'ecran avant que l'initialisation de la variable ne debute dans l'animation //_ProductAnimeOffsetY = 520f * _density; _ProductNamePaint = new SKPaint() { Typeface = _typeface, IsAntialias = true, Color = SKColors.White, TextSize = 30 * _density }; CardBackground.InvalidateSurface(); }
private Animation CreateCardAnimation(CardState cardstate) { var cardAnimStart = cardstate == CardState.Expended ? _cardTopMargin : _cornerRadius; var endAnimCard = cardstate == CardState.Expended ? -_cornerRadius : _cardTopMargin; var cardAnim = new Animation(v => { _cardTopAnimPosition = v; CardBackground.InvalidateSurface(); }, cardAnimStart, endAnimCard, Easing.SinInOut); return(cardAnim); }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (this.BindingContext == null) { return; } _viewModel = this.BindingContext as Hero; // because we can't bind skia drawing using the binding engine // we cache the paint objects when the bound character changes _heroColor = Color.FromHex(_viewModel.HeroColor).ToSKColor(); _heroPaint = new SKPaint() { Color = _heroColor }; _gradientTransitionY = float.MaxValue; _heroNamePaint = new SKPaint() { Typeface = _typeface, IsAntialias = true, Color = SKColors.White, TextSize = 60f * _density }; _heroNamePosY = 450f * _density; _heroNamePosX = 40f * _density; _realNamePaint = new SKPaint() { Typeface = _typeface, IsAntialias = true, Color = SKColors.White, TextSize = 25 * _density }; _realNamePosY = 550f * _density; // setup initial values _cardTopAnimPosition = _cardTopMargin; // repaint the surface with the new colors CardBackground.InvalidateSurface(); }
private Animation CreateCardAnimation(CardState cardState) { // work out where the top of the card should be var cardAnimStart = cardState == CardState.Expanded ? _cardTopMargin : -_cornerRadius; var cardAnimEnd = cardState == CardState.Expanded ? -_cornerRadius : _cardTopMargin; var cardAnim = new Animation( v => { _cardTopAnimPosition = v; CardBackground.InvalidateSurface(); }, cardAnimStart, cardAnimEnd, Easing.SinInOut ); return(cardAnim); }
private Animation CreateHeroNameAnimation(CardState cardState) { // work out where the top of the card should be var nameAnimationStart = cardState == CardState.Expanded ? 0 : -50; var nameAnimationEnd = cardState == CardState.Expanded ? -50 : 0; var imageAnim = new Animation( v => { _heroNameOffsetY = (float)v * _density; CardBackground.InvalidateSurface(); }, nameAnimationStart, nameAnimationEnd, Easing.SpringOut ); return(imageAnim); }
private Animation CardAnimation(CardState cardState) { //work out where the top of the card should be Debug.WriteLine($"CARD STATE: {cardState.ToString()}"); var animationStart = cardState == CardState.Expanded ? _cardTopMargin : -_cornerRadius; var animationStop = cardState == CardState.Expanded ? -_cornerRadius : _cardTopMargin; var animation = new Animation( v => { _cardTopPosition = v; CardBackground.InvalidateSurface(); }, animationStart, animationStop, Easing.SinInOut ); return(animation); }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (this.BindingContext == null) { return; } _viewModel = this.BindingContext as Hero; _heroColor = Color.FromHex(_viewModel.HeroColor).ToSKColor(); _heroPaint = new SKPaint() { Color = _heroColor }; _gradientTransitionY = float.MaxValue; // setup initial values _cardTopAnimPosition = _cardTopMargin; CardBackground.InvalidateSurface(); }
private Animation CreateGradientAnimation(CardState cardState) { float animStart, animEnd; Debug.WriteLine($"Canvass height: {CardBackground.CanvasSize.Height}"); if (cardState == CardState.Expanded) { _gradientTransitionY = CardBackground.CanvasSize.Height; animStart = _gradientTransitionY; animEnd = -_gradientHeight; } else { _gradientTransitionY = -_gradientHeight; animStart = -_gradientTransitionY; animEnd = CardBackground.CanvasSize.Height; } var anim = new Animation( callback: v => { _gradientTransitionY = (float)v; CardBackground.InvalidateSurface(); }, start: animStart, end: animEnd, finished: () => { var fontColor = cardState == CardState.Expanded ? Color.Black : Color.White; HeroNameLabelLine1.TextColor = fontColor; HeroNameLabelLine2.TextColor = fontColor; RealNameLabel.TextColor = fontColor; } ); return(anim); }
//public BoxView CardBackground => PokemonBackground; protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (this.BindingContext == null) { return; } _viewModel = this.BindingContext as Pokemon; // because we can't bind skia drawing using the binding engine // we cache the paint objects when the bound character changes _pokeColor = Color.FromHex(_viewModel.PokemonPrimaryColor).ToSKColor(); _pokePaint = new SKPaint() { Color = _pokeColor }; //setup initial values _cardTopPosition = _cardTopMargin; // repaint the surface with the new colors CardBackground.InvalidateSurface(); }
protected override void OnBindingContextChanged() { base.OnBindingContextChanged(); if (this.BindingContext == null) { return; } _viewModel = this.BindingContext as Hero; // because we can't bind skia drawing using the binding engine // we cache the paint objects when the bound character changes _heroColor = Color.FromHex(_viewModel.HeroColor).ToSKColor(); _heroPaint = new SKPaint() { Color = _heroColor }; _gradientTransitionY = float.MaxValue; // setup initial values _cardTopAnimPosition = _cardTopMargin; // repaint the surface with the new colors CardBackground.InvalidateSurface(); }
private Animation NameAnimation(CardState cardstate) { var NameAnimStart = cardstate == CardState.Expended ? 0 : _ProductAnimeOffsetY; var NameAnimEnd = cardstate == CardState.Expended ? _ProductAnimeOffsetY - 200: 0; var NameAnim = new Animation(v => { _ProductAnimeOffsetY = (float)v; CardBackground.InvalidateSurface(); }, NameAnimStart, NameAnimEnd, Easing.SpringOut); return(NameAnim); }