[Mono-osx] Animating Views using new Animator accessor

kjpou1 kjpou at pt.lu
Sun Nov 14 23:56:28 EST 2010


Hello Miguel

It looks like the example in git has the old routine for animating the view.

Here is the modified animateView method that uses the Animator accessor:


		// Helper method to animate the sub view
		private void animateView(NSView subView, RectangleF toFrame) 
		{
			
			
			((NSView)subView.Animator).Frame = toFrame;

			
			// The code below was first attempt that worked before
			// the Animator accessor was added.
			
//			var animationY = CABasicAnimation.FromKeyPath("position.y");
//			animationY.To = NSNumber.FromFloat(toFrame.Y);
//			animationY.AnimationStopped += delegate {
//				//Console.WriteLine("animation stopped");
//				try {
//					subView.Layer.Frame = toFrame;
//				}
//				catch (Exception ex) {}
//			};
//			
//			var animationX = CABasicAnimation.FromKeyPath("position.x");
//			animationX.To = NSNumber.FromFloat(toFrame.X);
//			
//			animationY.AutoReverses = false;
//			animationX.AutoReverses = false;
//			
//			animationY.RemovedOnCompletion = false;
//			animationX.RemovedOnCompletion = false;
//			
//			animationY.FillMode = CAFillMode.Forwards;
//			animationX.FillMode = CAFillMode.Forwards;
//			
//			subView.Layer.AddAnimation(animationX,"moveX");
//			subView.Layer.AddAnimation(animationY,"moveY");
		
		}

Kenneth
-- 
View this message in context: http://mono.1490590.n4.nabble.com/Animating-Views-using-new-Animator-accessor-tp3037926p3042514.html
Sent from the Mono - OSX mailing list archive at Nabble.com.


More information about the Mono-osx mailing list