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

问题描述 投票:1回答:1

我正在尝试在我的图像上设置一个类似于https://daneden.github.io/animate.css/上的脉冲的动画

所以,在Xamarin.Forms中,我试图使用ViewExtensions类中的ScaleTo重新创建该动画:

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

但实际上什么都没有,我的形象依然如故。

我该如何解决这个问题?

谢谢你的帮助。

xamarin animation xamarin.forms xamarin.uwp
1个回答
0
投票

我会将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:

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);
© www.soinside.com 2019 - 2024. All rights reserved.