Esempio n. 1
0
		public void DialogPanelShow(bool bShow)
		{
			if (bShow) // force visibility since you can't animate the Visible property
			{
				m_this.Visibility = Visibility.Visible;
				if (m_BackgroundElement != null)
					m_BackgroundElement.Visibility = Visibility.Visible;
			}

			Storyboard storyBoard = new Storyboard();
//j			m_this.Resources.Add("SomeSortofKeyName", storyBoard);

			DoubleAnimation animation = new DoubleAnimation();
			animation.From = (bShow ? 0 : 1);
			animation.To = (bShow ? 1 : 0);
			animation.Duration = TimeSpan.FromSeconds(0.5);
			animation.SetTarget(m_RootDialogElement);
			animation.SetTargetProperty("(UIElement.Opacity)");
			storyBoard.Children.Add(animation);
			if (bShow) storyBoard.Completed += ShowCompleted; else storyBoard.Completed += HideCompleted;
			storyBoard.Begin();
		}
Esempio n. 2
0
		private DoubleAnimation FadeAnimation(bool forward)
		{
			DoubleAnimation animation = new DoubleAnimation();
			//animation.EasingFunction = EasingFunction;
			//animation.BeginTime = (forward ? TimeSpan.FromSeconds(DelayForward) : TimeSpan.FromSeconds(DelayReverse));
			//animation.Duration = (forward ? TimeSpan.FromSeconds(SecondsForward) : TimeSpan.FromSeconds(SecondsReverse));
			animation.Duration = TimeSpan.FromSeconds(1);
			//animation.From = (forward ? 0 : 1);
			animation.To = (forward ? 1 : 0);
			animation.SetTargetProperty("Opacity");
			return animation;
		}
Esempio n. 3
0
		private DoubleAnimation TranslateAnimation(bool forward, bool horizontal, double offset)
		{
			DoubleAnimation animation = new DoubleAnimation();
			animation.EasingFunction = (forward ? EasingFunctionForward : EasingFunctionReverse);
			animation.BeginTime = (forward ? TimeSpan.FromSeconds(DelayForward) : TimeSpan.FromSeconds(DelayReverse));
			animation.Duration = (forward ? TimeSpan.FromSeconds(SecondsForward) : TimeSpan.FromSeconds(SecondsReverse));
			//animation.From = (forward ? offset : 0);
			animation.To = (forward ? 0 : offset);
			string target = (horizontal ? "X" : "Y");
			animation.SetTargetProperty(string.Format("(UIElement.RenderTransform).(TransformGroup.Children)[1].(TranslateTransform.{0})", target));
			return animation;
		}
Esempio n. 4
0
		private DoubleAnimation ScaleAnimation(bool forward, bool horizontal, double scale)
		{
			DoubleAnimation animation = new DoubleAnimation();
			animation.EasingFunction = EasingFunction;
			animation.BeginTime = (forward ? TimeSpan.FromSeconds(DelayForward) : TimeSpan.FromSeconds(DelayReverse));
			animation.Duration = (forward ? TimeSpan.FromSeconds(SecondsForward) : TimeSpan.FromSeconds(SecondsReverse));
			//animation.From = 0;
			animation.To = (forward ? 1 : scale);
			string target = (horizontal ? "X" : "Y");
			animation.SetTargetProperty(string.Format("(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.Scale{0})", target));
			return animation;
		}