private void AnimationStopped(object sender, CAAnimationStateEventArgs e) { if (e.Finished) { ((CAAnimation)sender).AnimationStopped -= AnimationStopped; Completed?.Invoke(this, EventArgs.Empty); } }
void handleAnimationStopped(object sender, CAAnimationStateEventArgs e) { var animation = sender as CABasicAnimation; Log.Debug($"AnimationStopped Finished={e.Finished} | animation={animation}"); if (animation != null) { var completedValue = animation.GetToAs <NSNumber> ().DoubleValue; progressLayer.Progress = (nfloat)completedValue; } }
void HandleAnimationStopped(object sender, CAAnimationStateEventArgs e) { //Console.WriteLine("stopped" + ((CAAnimation)sender).ValueForKey((NSString)"name")); var animation = (CAAnimation)sender; string animationValue = ((CAAnimation)sender).ValueForKey((NSString)"name").ToString(); if (e.Finished && animationValue == "photo1") { CABasicAnimation photo2Animation = basicAnimationNamed("photo2", (float)animation.Duration); photo2.Animations = NSDictionary.FromObjectAndKey(photo2Animation, (NSString)"frameOrigin"); PointF newPhoto2Origin = new PointF(Frame.GetMaxX() - photo2.Frame.Size.Width, photo2.Frame.Location.Y); ((NSView)photo2.Animator).SetFrameOrigin(newPhoto2Origin); } }
async void pathAnimationStopped(object sender, CAAnimationStateEventArgs e) { var pathAnimation = sender as CABasicAnimation; if (pathAnimation != null) { pathAnimation.AnimationStopped -= pathAnimationStopped; pathLayer.FillColor = UIColor.Blue.CGColor; await Task.Delay(Settings.LetterDrawDelay * 1000); incrementLetter(); } }
public void FadeRepeat(object sender, CAAnimationStateEventArgs e) { //btnShowTime.Layer.RemoveAnimation("fadeInOUt"); CAKeyFrameAnimation fade = CAKeyFrameAnimation.GetFromKeyPath("opacity"); NSNumber opacity0 = NSNumber.FromFloat(0.0f); NSNumber opacity1 = NSNumber.FromFloat(1.0f); fade.Values = new NSObject[] { opacity1, opacity0, opacity1, }; fade.Duration = 1.0f; fade.RepeatDuration = 1000.0; btnShowTime.Layer.AddAnimation(fade, "fadeInOut"); }
public void FadeRepeat(object sender, CAAnimationStateEventArgs e) { //btnShowTime.Layer.RemoveAnimation("fadeInOUt"); // Create a key frame animation CAKeyFrameAnimation fade = CAKeyFrameAnimation.GetFromKeyPath("opacity"); // Set the opacities between which the show time button will cycle NSNumber opacity0 = NSNumber.FromFloat(0.0f); NSNumber opacity1 = NSNumber.FromFloat(1.0f); fade.Values = new NSObject[] { opacity1, opacity0, opacity1, }; // Set the flashing speed fade.Duration = 1.0f; // Set hoew long the flashing will repeat for fade.RepeatDuration = 1000.0; // Add the animation to the show time button (btnShowTime) CALayer btnShowTime.Layer.AddAnimation(fade, "fadeInOut"); }
void Animation_AnimationStopped(object sender, CAAnimationStateEventArgs e) { Window.Close(); }
public void FadeRepeat(object sender, CAAnimationStateEventArgs e) { //btnShowTime.Layer.RemoveAnimation("fadeInOUt"); CAKeyFrameAnimation fade = CAKeyFrameAnimation.GetFromKeyPath("opacity"); NSNumber opacity0 = NSNumber.FromFloat(0.0f); NSNumber opacity1 = NSNumber.FromFloat(1.0f); fade.Values = new NSObject[] { opacity1, opacity0, opacity1, }; fade.Duration = 1.0f; fade.RepeatDuration= 1000.0; btnShowTime.Layer.AddAnimation(fade, "fadeInOut"); }
public void AnimationStopped(object sender, CAAnimationStateEventArgs e) { Console.WriteLine("{0} finished {1}", sender, e.Finished); }
void HandleAnimationStopped (object sender, CAAnimationStateEventArgs e) { //Console.WriteLine("stopped" + ((CAAnimation)sender).ValueForKey((NSString)"name")); var animation = (CAAnimation)sender; string animationValue = ((CAAnimation)sender).ValueForKey((NSString)"name").ToString(); if (e.Finished && animationValue == "photo1"){ CABasicAnimation photo2Animation = basicAnimationNamed ("photo2", (float)animation.Duration); photo2.Animations = NSDictionary.FromObjectAndKey (photo2Animation, (NSString)"frameOrigin"); PointF newPhoto2Origin = new PointF(Frame.GetMaxX () - photo2.Frame.Size.Width, photo2.Frame.Location.Y); ((NSView)photo2.Animator).SetFrameOrigin(newPhoto2Origin); } }