【问题标题】:Scale animation on Xamarin.Forms UWP not repeatingXamarin.Forms UWP 上的缩放动画不重复
【发布时间】:2019-09-08 02:57:34
【问题描述】:

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

因此,在 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】:

    我会将 CSS pulse 转换为自定义父/子动画。

    CSS 脉冲:

    //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 动画:

    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);
    

    【讨论】:

      猜你喜欢
      • 2018-03-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-07-17
      • 2017-12-02
      • 1970-01-01
      • 2018-06-16
      相关资源
      最近更新 更多