簡體   English   中英

Xamarin.Forms UWP上的縮放動畫不重復

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

我正在嘗試在我的圖像上設置類似於https://daneden.github.io/animate.css/上的pulse的動畫

因此,在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);

但是實際上什么都沒有,我的形象保持不變。

我該如何解決?

謝謝你的幫助。

我會將CSS脈沖轉換為自定義的父/子動畫。

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動畫:

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