简体   繁体   English

Xamarin.Forms UWP上的缩放动画不重复

[英]Scale animation on Xamarin.Forms UWP not repeating

I'm trying to set up an animation on my image similar to pulse on https://daneden.github.io/animate.css/ 我正在尝试在我的图像上设置类似于https://daneden.github.io/animate.css/上的pulse的动画

So, in Xamarin.Forms, i'm trying to recreate that animation using ScaleTo from class ViewExtensions: 因此,在Xamarin.Forms中,我尝试使用ViewTotensions类的ScaleTo重新创建该动画:

await image.ScaleTo (1.3, 500);
await image.ScaleTo (1, 500);
await image.ScaleTo (1.3, 500);
await image.ScaleTo (1, 500);

But actually nothing appens, my image remains the same. 但是实际上什么都没有,我的形象保持不变。

How can i resolve this? 我该如何解决?

Thanks for your help. 谢谢你的帮助。

I would convert that CSS pulse to a custom Parent/Child animation. 我会将CSS脉冲转换为自定义的父/子动画。

CSS Pulse: CSS Pulse:

//animation-duration: 1s;
@keyframes pulse {
  from {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }

  50% {
    -webkit-transform: scale3d(1.05, 1.05, 1.05);
    transform: scale3d(1.05, 1.05, 1.05);
  }

  to {
    -webkit-transform: scale3d(1, 1, 1);
    transform: scale3d(1, 1, 1);
  }
}

Xamarin Animation: Xamarin动画:

new Animation
 {
      { 0, 0.5, new Animation (v => image.Scale = v, 1, 1.05) },
      { 0.5, 1, new Animation (v => image.Scale = v, 1.05, 1) },
 }.Commit(this, "viewAnim", 16, 1000, Easing.Linear);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM