2017-02-18 9 views
0

私はアニメーションループを作成しようとするこの数行のコードを持っています。残念ながら、イベントが停止するたびにトリガーするのではありません。手伝ってくれませんか?Xamarin AnimationEndイベントトリガは一度だけです

ImageView imgView1 = FindViewById<ImageView>(Resource.Id.falling_stars1); 
ImageView imgView2 = FindViewById<ImageView>(Resource.Id.falling_stars2); 

Android.Animation.ObjectAnimator animator1 = Android.Animation.ObjectAnimator.OfFloat(imgView1, "y", -700, 100); 
Android.Animation.ObjectAnimator animator2 = Android.Animation.ObjectAnimator.OfFloat(imgView2, "y", 100, 900); 

animator1.SetDuration(2000); 
animator2.SetDuration(2000); 
animator1.Start(); 
animator2.Start(); 

animator1.AnimationEnd += delegate 
{ 
    animator1.Start(); 
}; 

animator2.AnimationEnd += delegate 
{ 
    animator2.Start(); 
}; 

答えて

0

RepeatMode: Defines the animation behavior when it reaches the end and the repeat count is greater than 0 or infinite.

Android.Animation.ObjectAnimator animator1 = Android.Animation.ObjectAnimator.OfFloat(imgView1, "y", -700, 100); 
animator1.SetDuration(2000); 
animator1.RepeatCount = ValueAnimator.Infinite; 
animator1.RepeatMode = ValueAnimatorRepeatMode.Restart; 
+0

あなたがここに提案している変更点の説明を追加します。 –

+0

アニメーションを編集して終了し、星が突然になるように編集できますか?もしこれを行う別の方法があれば? –

+0

突然終了して始めるのはどういう意味ですか?中期的な行動を止めたいですか? – Zroq