/// <summary> /// Fade in opacity of the window, let the progress ring appear and collapse the NoMouvieFound label when loading movies /// </summary> /// <param name="sender">Sender object</param> /// <param name="e">EventArgs</param> private void OnMoviesLoading(object sender, EventArgs e) { // We have to deal with the DispatcherHelper, otherwise we're having the classic cross-thread access exception DispatcherHelper.CheckBeginInvokeOnUI(() => { ProgressRing.IsActive = true; #region Fade in opacity DoubleAnimationUsingKeyFrames opacityAnimation = new DoubleAnimationUsingKeyFrames(); opacityAnimation.Duration = new Duration(TimeSpan.FromSeconds(0.5)); PowerEase opacityEasingFunction = new PowerEase(); opacityEasingFunction.EasingMode = EasingMode.EaseInOut; EasingDoubleKeyFrame startOpacityEasing = new EasingDoubleKeyFrame(1, KeyTime.FromPercent(0)); EasingDoubleKeyFrame endOpacityEasing = new EasingDoubleKeyFrame(0.2, KeyTime.FromPercent(1.0), opacityEasingFunction); opacityAnimation.KeyFrames.Add(startOpacityEasing); opacityAnimation.KeyFrames.Add(endOpacityEasing); ItemsList.BeginAnimation(OpacityProperty, opacityAnimation); #endregion if (NoMouvieFound.Visibility == Visibility.Visible) { NoMouvieFound.Visibility = Visibility.Collapsed; } }); }
private void AnimateBorder() { if (_animationRunning) return; _animationRunning = true; var offset = VisualTreeHelper.GetOffset(_menuBorder); var top = offset.Y; var menuOffset = VisualTreeHelper.GetOffset(_menus[_currentMenu]); var topOffSet = menuOffset.Y; var animation = new DoubleAnimationUsingKeyFrames {Duration = new Duration(TimeSpan.FromSeconds(0.5))}; var easingFunction = new QuarticEase {EasingMode = EasingMode.EaseInOut}; var startAnimation = new EasingDoubleKeyFrame(_startPoint, KeyTime.FromPercent(0)); var endAnimation = new EasingDoubleKeyFrame(topOffSet - top, KeyTime.FromPercent(1.0), easingFunction); animation.KeyFrames.Add(startAnimation); animation.KeyFrames.Add(endAnimation); animation.Completed += delegate { _animationRunning = false; }; var trans = new TranslateTransform(); _menuBorder.RenderTransform = trans; trans.BeginAnimation(TranslateTransform.YProperty, animation); _startPoint = topOffSet - top; }
public static DoubleAnimationUsingKeyFrames CreateAnim(this Storyboard sb, DependencyObject target, string propertyPath, IEasingFunction easing, double value, TimeSpan keyTime) { var doubleAnim = (from anim in sb.Children.OfType<DoubleAnimationUsingKeyFrames>() where GetSBExtTarget(anim) == target let prop = Storyboard.GetTargetProperty(anim) where prop.Path == propertyPath select anim).FirstOrDefault(); if (doubleAnim == null) { doubleAnim = new DoubleAnimationUsingKeyFrames(); SetSBExtTarget(doubleAnim, target); Storyboard.SetTarget(doubleAnim, target); Storyboard.SetTargetProperty(doubleAnim, new System.Windows.PropertyPath(propertyPath)); sb.Children.Add(doubleAnim); } EasingDoubleKeyFrame kf = new EasingDoubleKeyFrame(); kf.EasingFunction = easing; kf.KeyTime = keyTime; kf.Value = value; doubleAnim.KeyFrames.Add(kf); return doubleAnim; }
private void btn2_1_Click(object sender, RoutedEventArgs e) { RotateTransform animatedTranslateTransform = new RotateTransform(); btn2_1.RenderTransform = animatedTranslateTransform; RegisterName("animateButton2", animatedTranslateTransform); DoubleAnimationUsingKeyFrames translationAnimation = new DoubleAnimationUsingKeyFrames(); translationAnimation.KeyFrames.Add(new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)))); EasingDoubleKeyFrame doubleKeyFrame2 = new EasingDoubleKeyFrame(360, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(10))); ElasticEase ease = new ElasticEase(); ease.Oscillations = 3; ease.Springiness = 8; ease.EasingMode = EasingMode.EaseOut; doubleKeyFrame2.EasingFunction = ease; translationAnimation.KeyFrames.Add(doubleKeyFrame2); Storyboard.SetTargetName(translationAnimation, "animateButton2"); Storyboard.SetTargetProperty(translationAnimation, new PropertyPath(RotateTransform.AngleProperty)); Storyboard strbStoryboard = new Storyboard(); strbStoryboard.Children.Add(translationAnimation); strbStoryboard.Begin(this); UnregisterName("animateButton2"); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/CameraSampleCS;component/Controls/Viewfinder.xaml", System.UriKind.Relative)); this.LivePreviewLayout = ((System.Windows.Controls.Grid)(this.FindName("LivePreviewLayout"))); this.AutoFocusInProgress = ((System.Windows.Media.Animation.Storyboard)(this.FindName("AutoFocusInProgress"))); this.AutoFocusLocked = ((System.Windows.Media.Animation.Storyboard)(this.FindName("AutoFocusLocked"))); this.PointFocusInProgress = ((System.Windows.Media.Animation.Storyboard)(this.FindName("PointFocusInProgress"))); this.PointFocusLocked = ((System.Windows.Media.Animation.Storyboard)(this.FindName("PointFocusLocked"))); this.LivePreview = ((System.Windows.Shapes.Rectangle)(this.FindName("LivePreview"))); this.LivePreviewTransform = ((System.Windows.Media.CompositeTransform)(this.FindName("LivePreviewTransform"))); this.PointFocusBrackets = ((System.Windows.Controls.Grid)(this.FindName("PointFocusBrackets"))); this.AutoFocusBrackets = ((System.Windows.Controls.Grid)(this.FindName("AutoFocusBrackets"))); this.ChromeLayout = ((System.Windows.Controls.Grid)(this.FindName("ChromeLayout"))); this.ShowArrowButton = ((System.Windows.Media.Animation.Storyboard)(this.FindName("ShowArrowButton"))); this.HideArrowButton = ((System.Windows.Media.Animation.Storyboard)(this.FindName("HideArrowButton"))); this.RotateArrowButtonToLandscape = ((System.Windows.Media.Animation.Storyboard)(this.FindName("RotateArrowButtonToLandscape"))); this.RotateArrowButtonToPortrait = ((System.Windows.Media.Animation.Storyboard)(this.FindName("RotateArrowButtonToPortrait"))); this.DisplayStatus = ((System.Windows.Media.Animation.Storyboard)(this.FindName("DisplayStatus"))); this.LeftArrowButton = ((System.Windows.Controls.Button)(this.FindName("LeftArrowButton"))); this.StatusText = ((System.Windows.Controls.TextBlock)(this.FindName("StatusText"))); this.ReviewLayout = ((System.Windows.Controls.Grid)(this.FindName("ReviewLayout"))); this.ReviewImageSlideOff = ((System.Windows.Media.Animation.Storyboard)(this.FindName("ReviewImageSlideOff"))); this.ReviewImageSlideOffTranslateStart = ((System.Windows.Media.Animation.EasingDoubleKeyFrame)(this.FindName("ReviewImageSlideOffTranslateStart"))); this.ReviewImageSlideOffTranslateEnd = ((System.Windows.Media.Animation.EasingDoubleKeyFrame)(this.FindName("ReviewImageSlideOffTranslateEnd"))); this.ReviewImage = ((System.Windows.Shapes.Rectangle)(this.FindName("ReviewImage"))); }
public Storyboard GetAnimation(DependencyObject target, double to, double from) { Storyboard story = new Storyboard(); Storyboard.SetTargetProperty(story, new PropertyPath("(TextBlock.RenderTransform).(TranslateTransform.X)")); Storyboard.SetTarget(story, target); var doubleAnimation = new DoubleAnimationUsingKeyFrames(); var fromFrame = new EasingDoubleKeyFrame(from) { EasingFunction = new ExponentialEase() {EasingMode = EasingMode.EaseIn}, KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(0)) }; var toFrame = new EasingDoubleKeyFrame(to) { EasingFunction = new QuadraticEase() {EasingMode = EasingMode.EaseOut}, KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(600)) }; doubleAnimation.KeyFrames.Add(fromFrame); doubleAnimation.KeyFrames.Add(toFrame); story.Children.Add(doubleAnimation); return story; }
/// <summary> /// 空间扭曲波动 /// </summary> public void Wave(Point center) { DoubleAnimationUsingKeyFrames d0 = new DoubleAnimationUsingKeyFrames(); SplineDoubleKeyFrame s0 = new SplineDoubleKeyFrame() { KeyTime = TimeSpan.Zero, Value = 70 }; EasingDoubleKeyFrame e0 = new EasingDoubleKeyFrame() { EasingFunction = new SineEase() { EasingMode = EasingMode.EaseOut }, KeyTime = TimeSpan.FromMilliseconds(300), Value = 0 }; d0.KeyFrames.Add(s0); d0.KeyFrames.Add(e0); Storyboard.SetTarget(d0, this); Storyboard.SetTargetProperty(d0, new PropertyPath("(UIElement.Effect).(RippleEffect.Frequency)")); DoubleAnimationUsingKeyFrames d1 = new DoubleAnimationUsingKeyFrames(); SplineDoubleKeyFrame s1 = new SplineDoubleKeyFrame() { KeyTime = TimeSpan.Zero, Value = 0 }; EasingDoubleKeyFrame e1 = new EasingDoubleKeyFrame() { KeyTime = TimeSpan.FromMilliseconds(150), Value = 0.01 }; EasingDoubleKeyFrame e11 = new EasingDoubleKeyFrame() { EasingFunction = new SineEase() { EasingMode = EasingMode.EaseOut }, KeyTime = TimeSpan.FromMilliseconds(300), Value = 0 }; d1.KeyFrames.Add(s1); d1.KeyFrames.Add(e1); d1.KeyFrames.Add(e11); Storyboard.SetTarget(d1, this); Storyboard.SetTargetProperty(d1, new PropertyPath("(UIElement.Effect).(RippleEffect.Amplitude)")); if (waveStoryboard != null) { Wave_Completed(waveStoryboard, null); } center.X = (center.X + offset.X) / mapRoot.BodyWidth; center.Y = (center.Y + offset.Y) / mapRoot.BodyHeight; this.Effect = new WaveRipple() { Phase = 0, Amplitude = 0, Frequency = 0, Center = center }; waveStoryboard = new Storyboard(); waveStoryboard.Children.Add(d0); waveStoryboard.Children.Add(d1); waveStoryboard.Completed += new EventHandler(Wave_Completed); waveStoryboard.Begin(); }
public void ClosingWindow() { //キーフレームで時間を区切る var frame0 = new EasingDoubleKeyFrame(this.Width, KeyTime.FromTimeSpan(new TimeSpan(1))); var frame1 = new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(new TimeSpan(2500000))); var frame2 = new EasingDoubleKeyFrame(this.Height, KeyTime.FromTimeSpan(new TimeSpan(2500001))); var frame3 = new EasingDoubleKeyFrame(0, KeyTime.FromTimeSpan(new TimeSpan(5000000))); //キーフレームをアニメーションとしてまとめる var animationWidth = new DoubleAnimationUsingKeyFrames(); animationWidth.KeyFrames.Add(frame0); animationWidth.KeyFrames.Add(frame1); //アニメーションをアニメーションさせたいオブジェクトクラスのプロパティにひもづける //...ということはオブジェクト毎にアニメーションさせるのはだめ? Storyboard.SetTargetName(animationWidth, this.Name); Storyboard.SetTargetProperty(animationWidth, new PropertyPath(MainWindow.WidthProperty)); var animationHeight = new DoubleAnimationUsingKeyFrames(); animationHeight.KeyFrames.Add(frame2); animationHeight.KeyFrames.Add(frame3); Storyboard.SetTargetName(animationHeight, this.Name); Storyboard.SetTargetProperty(animationHeight, new PropertyPath(MainWindow.HeightProperty)); //静的にひもづけられたストーリーボードへアニメーションを登録する myStoryboard = new Storyboard(); myStoryboard.Completed += new EventHandler(endAnimation); myStoryboard.Children.Add(animationWidth); myStoryboard.Children.Add(animationHeight); //アニメーションを実行する myStoryboard.Begin(this); myStoryboard.Stop(); }
public ConfigView(ConfigViewModel vm) { InitializeComponent(); _vm = vm; Loaded += (s, e) => DataContext = _vm; _bounceScrollbarToControl = ((Storyboard)Resources["MoveScrollbarStoryboard"]); var animation = (DoubleAnimationUsingKeyFrames)_bounceScrollbarToControl.Children[0]; _targetingKeyFrame = (EasingDoubleKeyFrame)animation.KeyFrames[0]; _bounceScrollbarToControl.Completed += (s, e) => _storyboardFinished = true; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/EasingAnimations;component/MainPage.xaml", System.UriKind.Relative)); this.Animacao = ((System.Windows.Media.Animation.Storyboard)(this.FindName("Animacao"))); this.Funcao = ((System.Windows.Media.Animation.EasingDoubleKeyFrame)(this.FindName("Funcao"))); this.LayoutRoot = ((System.Windows.Controls.Canvas)(this.FindName("LayoutRoot"))); this.ellipse = ((System.Windows.Shapes.Ellipse)(this.FindName("ellipse"))); this.ModoDaAnimacao = ((System.Windows.Controls.ComboBox)(this.FindName("ModoDaAnimacao"))); this.FuncaoDaAnimacao = ((System.Windows.Controls.ComboBox)(this.FindName("FuncaoDaAnimacao"))); }
public FadeTransition() { this.TransitionDuration = TimeSpan.FromSeconds(2d); this._transitionStoryboard = new Storyboard(); this._fadeAnimation = new DoubleAnimationUsingKeyFrames(); // 只需动态变更 Opacity 属性. Storyboard.SetTargetProperty(this._fadeAnimation, new PropertyPath("Opacity")); EasingDoubleKeyFrame frame1 = new EasingDoubleKeyFrame() { KeyTime = KeyTime.FromTimeSpan(TimeSpan.Zero), Value = 1d }; EasingDoubleKeyFrame frame2 = new EasingDoubleKeyFrame() { KeyTime = KeyTime.FromTimeSpan(this.TransitionDuration), Value = 0d }; this._fadeAnimation.KeyFrames.Add(frame1); this._fadeAnimation.KeyFrames.Add(frame2); this._transitionStoryboard.Children.Add(_fadeAnimation); this._transitionStoryboard.Completed += new EventHandler(TransitionStoryboard_Completed); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/EasingAnimations;component/MainPage.xaml", System.UriKind.Relative)); this.Animacao = ((System.Windows.Media.Animation.Storyboard)(this.FindName("Animacao"))); this.Funcao = ((System.Windows.Media.Animation.EasingDoubleKeyFrame)(this.FindName("Funcao"))); this.LayoutRoot = ((System.Windows.Controls.Canvas)(this.FindName("LayoutRoot"))); this.ellipse = ((System.Windows.Shapes.Ellipse)(this.FindName("ellipse"))); this.ModoDaAnimacao = ((System.Windows.Controls.ComboBox)(this.FindName("ModoDaAnimacao"))); this.FuncaoDaAnimacao = ((System.Windows.Controls.ComboBox)(this.FindName("FuncaoDaAnimacao"))); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/LuyenTriNho;component/Controls/ucStoryboadDropStone.xaml", System.UriKind.Relative)); this.storyboardStoneDrop = ((System.Windows.Media.Animation.Storyboard)(this.FindName("storyboardStoneDrop"))); this.edkfStoneDropValue = ((System.Windows.Media.Animation.EasingDoubleKeyFrame)(this.FindName("edkfStoneDropValue"))); this.edkfStoneDropValue01 = ((System.Windows.Media.Animation.EasingDoubleKeyFrame)(this.FindName("edkfStoneDropValue01"))); this.edkfStoneDropValue02 = ((System.Windows.Media.Animation.EasingDoubleKeyFrame)(this.FindName("edkfStoneDropValue02"))); this.imgStone = ((System.Windows.Controls.Image)(this.FindName("imgStone"))); this.imgDust01 = ((System.Windows.Controls.Image)(this.FindName("imgDust01"))); this.imgDust02 = ((System.Windows.Controls.Image)(this.FindName("imgDust02"))); this.imgDust03 = ((System.Windows.Controls.Image)(this.FindName("imgDust03"))); this.imgDust04 = ((System.Windows.Controls.Image)(this.FindName("imgDust04"))); this.meDropStone = ((System.Windows.Controls.MediaElement)(this.FindName("meDropStone"))); }
private void LongListSelector_GroupViewOpened(object sender, GroupViewOpenedEventArgs e) { //Hold a reference to the active long list selector. currentSelector = sender as LongListSelector; //Construct and begin a swivel animation to pop in the group view. IEasingFunction quadraticEase = new QuadraticEase { EasingMode = EasingMode.EaseOut }; Storyboard _swivelShow = new Storyboard(); ItemsControl groupItems = e.ItemsControl; foreach (var item in groupItems.Items) { UIElement container = groupItems.ItemContainerGenerator.ContainerFromItem(item) as UIElement; if (container != null) { Border content = VisualTreeHelper.GetChild(container, 0) as Border; if (content != null) { DoubleAnimationUsingKeyFrames showAnimation = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame showKeyFrame1 = new EasingDoubleKeyFrame(); showKeyFrame1.KeyTime = TimeSpan.FromMilliseconds(0); showKeyFrame1.Value = -60; showKeyFrame1.EasingFunction = quadraticEase; EasingDoubleKeyFrame showKeyFrame2 = new EasingDoubleKeyFrame(); showKeyFrame2.KeyTime = TimeSpan.FromMilliseconds(85); showKeyFrame2.Value = 0; showKeyFrame2.EasingFunction = quadraticEase; showAnimation.KeyFrames.Add(showKeyFrame1); showAnimation.KeyFrames.Add(showKeyFrame2); Storyboard.SetTargetProperty(showAnimation, new PropertyPath(PlaneProjection.RotationXProperty)); Storyboard.SetTarget(showAnimation, content.Projection); _swivelShow.Children.Add(showAnimation); } } } _swivelShow.Begin(); }
public Storyboard GetFadeOutAnimation(UIElement target) { Storyboard storyBoard = new Storyboard(); storyBoard.AutoReverse = false; // Create two DoubleAnimations and set their properties. DoubleAnimationUsingKeyFrames doubleAnimationOpacity = new DoubleAnimationUsingKeyFrames(); doubleAnimationOpacity.BeginTime = TimeSpan.FromSeconds(0); Storyboard.SetTarget(doubleAnimationOpacity, target); Storyboard.SetTargetProperty(doubleAnimationOpacity, new PropertyPath("(UIElement.Opacity)")); storyBoard.Children.Add(doubleAnimationOpacity); EasingDoubleKeyFrame easingDoubleKeyFrame = new EasingDoubleKeyFrame(); easingDoubleKeyFrame.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(.5)); easingDoubleKeyFrame.Value = 0; easingDoubleKeyFrame.EasingFunction = new CircleEase() { EasingMode = EasingMode.EaseInOut }; doubleAnimationOpacity.KeyFrames.Add(easingDoubleKeyFrame); return storyBoard; }
private void ArrowDown_MouseDown(object sender, MouseEventArgs e) { _currentMenu = Math.Abs(_currentMenu + 1); var offset = VisualTreeHelper.GetOffset(MenuBorder); var top = offset.Y; var menuOffset = VisualTreeHelper.GetOffset(_menus[_currentMenu]); var topOffSet = menuOffset.Y; var animation = new DoubleAnimationUsingKeyFrames { Duration = new Duration(TimeSpan.FromSeconds(1)) }; var easingFunction = new QuarticEase { EasingMode = EasingMode.EaseInOut }; var startAnimation = new EasingDoubleKeyFrame(_startPoint, KeyTime.FromPercent(0)); var endAnimation = new EasingDoubleKeyFrame(topOffSet - top, KeyTime.FromPercent(1.0), easingFunction); animation.KeyFrames.Add(startAnimation); animation.KeyFrames.Add(endAnimation); var trans = new TranslateTransform(); MenuBorder.RenderTransform = trans; trans.BeginAnimation(TranslateTransform.YProperty, animation); _startPoint = topOffSet - top; }
private void Init() { _Storyboard = new Storyboard(); _Storyboard.Completed += _Storyboard_Completed; /***animation x***/ _Animation = new DoubleAnimationUsingKeyFrames(); /*key frame 1*/ _KeyFrame_from = new EasingDoubleKeyFrame(); _KeyFrame_from.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)); _KeyFrame_from.Value = 0; _Animation.KeyFrames.Add(_KeyFrame_from); /*key frame 2*/ _KeyFrame_to = new EasingDoubleKeyFrame(); _KeyFrame_to.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(1)); _KeyFrame_to.Value = 0; _Animation.KeyFrames.Add(_KeyFrame_to); Storyboard.SetTargetProperty(_Animation,new PropertyPath( "(UIElement.Opacity)")); _Storyboard.Children.Add(_Animation); }
Storyboard GetShrinkAnimation(AwesomMenuItem item, Point pt) { Duration duration = TimeSpan.FromSeconds(0.3); var sb = new Storyboard(); sb.Duration = duration; var keyFrams = new DoubleAnimationUsingKeyFrames(); keyFrams.Duration = duration; var keyframe = new EasingDoubleKeyFrame(); keyframe.Value = pt.X; keyframe.KeyTime = TimeSpan.FromSeconds(0.3); keyFrams.KeyFrames.Add(keyframe); Storyboard.SetTarget(keyFrams, item.ItemTransfrom); Storyboard.SetTargetProperty(keyFrams, new PropertyPath(CompositeTransform.TranslateXProperty)); sb.Children.Add(keyFrams); keyFrams = new DoubleAnimationUsingKeyFrames(); keyFrams.Duration = duration; keyframe = new EasingDoubleKeyFrame(); keyframe.Value = pt.Y; keyframe.KeyTime = TimeSpan.FromSeconds(0.3); keyFrams.KeyFrames.Add(keyframe); Storyboard.SetTarget(keyFrams, item.ItemTransfrom); Storyboard.SetTargetProperty(keyFrams, new PropertyPath(CompositeTransform.TranslateYProperty)); sb.Children.Add(keyFrams); var da = GetDoubleAnimation(duration, 0.01, 1); Storyboard.SetTarget(da, item.ItemTransfrom); Storyboard.SetTargetProperty(da, new PropertyPath(CompositeTransform.ScaleXProperty)); sb.Children.Add(da); da = GetDoubleAnimation(duration, 0.01, 1); Storyboard.SetTarget(da, item.ItemTransfrom); Storyboard.SetTargetProperty(da, new PropertyPath(CompositeTransform.ScaleYProperty)); sb.Children.Add(da); da = GetDoubleAnimation(duration, 1, 0); Storyboard.SetTarget(da, item); Storyboard.SetTargetProperty(da, new PropertyPath(UIElement.OpacityProperty)); sb.Children.Add(da); return sb; }
private void Expand() { if (_flag >= MenuItems.Count) { if (_timer.IsEnabled) { _timer.Stop(); _timer = null; return; } } int tag = _flag; if (tag >= MenuItems.Count || tag < 0) return; var item = MenuItems[tag]; Duration duration = TimeSpan.FromSeconds(0.5); var sb = new Storyboard(); sb.Duration = duration; var da = new DoubleAnimationUsingKeyFrames(); da.Duration = duration; var keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.ItemTransfrom.Rotation; keyframe.KeyTime = TimeSpan.FromSeconds(0.0); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = 90; keyframe.KeyTime = TimeSpan.FromSeconds(0.15); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = 180; keyframe.KeyTime = TimeSpan.FromSeconds(0.3); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = 0; keyframe.KeyTime = TimeSpan.FromSeconds(0.5); da.KeyFrames.Add(keyframe); Storyboard.SetTarget(da, item.ItemTransfrom); Storyboard.SetTargetProperty(da, new PropertyPath(CompositeTransform.RotationProperty)); sb.Children.Add(da); da = new DoubleAnimationUsingKeyFrames(); da.Duration = duration; keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.StratPoint.X; keyframe.KeyTime = TimeSpan.FromSeconds(0); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.FarPoint.X; keyframe.KeyTime = TimeSpan.FromSeconds(0.15); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.NearPoint.X; keyframe.KeyTime = TimeSpan.FromSeconds(0.3); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.EndPoint.X; keyframe.KeyTime = TimeSpan.FromSeconds(0.5); da.KeyFrames.Add(keyframe); Storyboard.SetTarget(da, item.ItemTransfrom); Storyboard.SetTargetProperty(da, new PropertyPath(CompositeTransform.TranslateXProperty)); sb.Children.Add(da); da = new DoubleAnimationUsingKeyFrames(); da.Duration = duration; keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.StratPoint.Y; keyframe.KeyTime = TimeSpan.FromSeconds(0); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.FarPoint.Y; keyframe.KeyTime = TimeSpan.FromSeconds(0.15); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.NearPoint.Y; keyframe.KeyTime = TimeSpan.FromSeconds(0.3); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.EndPoint.Y; keyframe.KeyTime = TimeSpan.FromSeconds(0.5); da.KeyFrames.Add(keyframe); Storyboard.SetTarget(da, item.ItemTransfrom); Storyboard.SetTargetProperty(da, new PropertyPath(CompositeTransform.TranslateYProperty)); sb.Children.Add(da); sb.Begin(); sb.Completed += (o, a) => { //System.Diagnostics.Debug.WriteLine(item.EndPoint.X) item.ItemTransfrom.TranslateX = item.EndPoint.X; item.ItemTransfrom.TranslateY = item.EndPoint.Y; item.ItemTransfrom.Rotation = 0; sb.Stop(); sb.Children.Clear(); da = null; sb = null; if (ActionExpened != null) ActionExpened(); }; _flag++; }
private void Close() { if (_flag < 0) { _timer.Stop(); _timer = null; return; } int tag = _flag; AwesomMenuItem item = null; //if (tag >= MenuItems.Count) //{ // item = _addButton; //} //else //item = MenuItems[tag]; if (tag - 1 < 0) { return; } item = MenuItems[tag - 1]; Duration duration = TimeSpan.FromSeconds(0.5); var sb = new Storyboard(); sb.Duration = duration; var da = new DoubleAnimationUsingKeyFrames(); da.Duration = duration; var keyframe = new EasingDoubleKeyFrame(); keyframe.Value = 0; keyframe.KeyTime = TimeSpan.FromSeconds(0.0); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = 180; keyframe.KeyTime = TimeSpan.FromSeconds(0.25); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = 0; keyframe.KeyTime = TimeSpan.FromSeconds(0.5); da.KeyFrames.Add(keyframe); Storyboard.SetTarget(da, item.ItemTransfrom); Storyboard.SetTargetProperty(da, new PropertyPath(CompositeTransform.RotationProperty)); sb.Children.Add(da); da = new DoubleAnimationUsingKeyFrames(); da.Duration = duration; keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.EndPoint.X; keyframe.KeyTime = TimeSpan.FromSeconds(0); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.FarPoint.X; keyframe.KeyTime = TimeSpan.FromSeconds(0.25); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.StratPoint.X; keyframe.KeyTime = TimeSpan.FromSeconds(0.5); da.KeyFrames.Add(keyframe); Storyboard.SetTarget(da, item.ItemTransfrom); Storyboard.SetTargetProperty(da, new PropertyPath(CompositeTransform.TranslateXProperty)); sb.Children.Add(da); da = new DoubleAnimationUsingKeyFrames(); da.Duration = duration; keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.EndPoint.Y; keyframe.KeyTime = TimeSpan.FromSeconds(0); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.FarPoint.Y; keyframe.KeyTime = TimeSpan.FromSeconds(0.25); da.KeyFrames.Add(keyframe); keyframe = new EasingDoubleKeyFrame(); keyframe.Value = item.StratPoint.Y; keyframe.KeyTime = TimeSpan.FromSeconds(0.5); da.KeyFrames.Add(keyframe); Storyboard.SetTarget(da, item.ItemTransfrom); Storyboard.SetTargetProperty(da, new PropertyPath(CompositeTransform.TranslateYProperty)); sb.Children.Add(da); sb.Begin(); sb.Completed += (o, a) => { item.ItemTransfrom.TranslateX = item.StratPoint.X; item.ItemTransfrom.TranslateY = item.StratPoint.Y; item.ItemTransfrom.Rotation = 0; sb.Stop(); sb.Children.Clear(); da = null; sb = null; if (ActionClosed != null) if (_closedByTapMenu == true) { _closedByTapMenu = false; ActionClosed(null); } else ActionClosed(_addButton); }; _flag--; }
/// <summary> /// Provides the feathered animation for items /// when the Expander View goes from collapsed to expanded. /// </summary> internal void AnimateContainerDropDown() { for (int i = 0; i < Items.Count; i++) { FrameworkElement container = ItemContainerGenerator.ContainerFromIndex(i) as FrameworkElement; if (container == null) { break; } Storyboard itemDropDown = new Storyboard(); IEasingFunction quadraticEase = new QuadraticEase { EasingMode = EasingMode.EaseOut }; int initialKeyTime = InitialKeyTime + (KeyTimeStep * i); int finalKeyTime = FinalKeyTime + (KeyTimeStep * i); TranslateTransform translation = new TranslateTransform(); container.RenderTransform = translation; DoubleAnimationUsingKeyFrames transAnimation = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame transKeyFrame_1 = new EasingDoubleKeyFrame(); transKeyFrame_1.EasingFunction = quadraticEase; transKeyFrame_1.KeyTime = TimeSpan.FromMilliseconds(0.0); transKeyFrame_1.Value = -150.0; EasingDoubleKeyFrame transKeyFrame_2 = new EasingDoubleKeyFrame(); transKeyFrame_2.EasingFunction = quadraticEase; transKeyFrame_2.KeyTime = TimeSpan.FromMilliseconds(initialKeyTime); transKeyFrame_2.Value = 0.0; EasingDoubleKeyFrame transKeyFrame_3 = new EasingDoubleKeyFrame(); transKeyFrame_3.EasingFunction = quadraticEase; transKeyFrame_3.KeyTime = TimeSpan.FromMilliseconds(finalKeyTime); transKeyFrame_3.Value = 0.0; transAnimation.KeyFrames.Add(transKeyFrame_1); transAnimation.KeyFrames.Add(transKeyFrame_2); transAnimation.KeyFrames.Add(transKeyFrame_3); Storyboard.SetTarget(transAnimation, translation); Storyboard.SetTargetProperty(transAnimation, new PropertyPath(TranslateTransform.YProperty)); itemDropDown.Children.Add(transAnimation); DoubleAnimationUsingKeyFrames opacityAnimation = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame opacityKeyFrame_1 = new EasingDoubleKeyFrame(); opacityKeyFrame_1.EasingFunction = quadraticEase; opacityKeyFrame_1.KeyTime = TimeSpan.FromMilliseconds(0.0); opacityKeyFrame_1.Value = 0.0; EasingDoubleKeyFrame opacityKeyFrame_2 = new EasingDoubleKeyFrame(); opacityKeyFrame_2.EasingFunction = quadraticEase; opacityKeyFrame_2.KeyTime = TimeSpan.FromMilliseconds(initialKeyTime - 150); opacityKeyFrame_2.Value = 0.0; EasingDoubleKeyFrame opacityKeyFrame_3 = new EasingDoubleKeyFrame(); opacityKeyFrame_3.EasingFunction = quadraticEase; opacityKeyFrame_3.KeyTime = TimeSpan.FromMilliseconds(finalKeyTime); opacityKeyFrame_3.Value = 1.0; opacityAnimation.KeyFrames.Add(opacityKeyFrame_1); opacityAnimation.KeyFrames.Add(opacityKeyFrame_2); opacityAnimation.KeyFrames.Add(opacityKeyFrame_3); Storyboard.SetTarget(opacityAnimation, container); Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath(FrameworkElement.OpacityProperty)); itemDropDown.Children.Add(opacityAnimation); itemDropDown.Begin(); } }
/// <summary> /// Gets the template parts and sets event handlers. /// </summary> public override void OnApplyTemplate() { if (_expanderPanel != null) { _expanderPanel.Tap -= OnExpanderPanelTap; } base.OnApplyTemplate(); _expanderPanel = base.GetTemplateChild(ExpanderPanel) as Grid; _expandedStateAnimation = (base.GetTemplateChild(ExpandedState) as VisualState).Storyboard.Children[0] as DoubleAnimation; _expandedToCollapsedFrame = base.GetTemplateChild(ExpandedToCollapsedKeyFrame) as EasingDoubleKeyFrame; _collapsedToExpandedFrame = base.GetTemplateChild(CollapsedToExpandedKeyFrame) as EasingDoubleKeyFrame; _itemsCanvas = base.GetTemplateChild("ItemsCanvas") as Canvas; _presenter = base.GetTemplateChild(Presenter) as ItemsPresenter; _presenter.SizeChanged += OnPresenterSizeChanged; if (_expanderPanel != null) { _expanderPanel.Tap += OnExpanderPanelTap; } UpdateVisualState(false); }
private void LongListSelector_GroupViewClosing(object sender, GroupViewClosingEventArgs e) { //Cancelling automatic closing and scrolling to do it manually. e.Cancel = true; if (e.SelectedGroup != null) { currentSelector.ScrollToGroup(e.SelectedGroup); } //Dispatch the swivel animation for performance on the UI thread. Dispatcher.BeginInvoke(() => { //Construct and begin a swivel animation to pop out the group view. IEasingFunction quadraticEase = new QuadraticEase { EasingMode = EasingMode.EaseOut }; Storyboard _swivelHide = new Storyboard(); ItemsControl groupItems = e.ItemsControl; foreach (var item in groupItems.Items) { UIElement container = groupItems.ItemContainerGenerator.ContainerFromItem(item) as UIElement; if (container != null) { Border content = VisualTreeHelper.GetChild(container, 0) as Border; if (content != null) { DoubleAnimationUsingKeyFrames showAnimation = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame showKeyFrame1 = new EasingDoubleKeyFrame(); showKeyFrame1.KeyTime = TimeSpan.FromMilliseconds(0); showKeyFrame1.Value = 0; showKeyFrame1.EasingFunction = quadraticEase; EasingDoubleKeyFrame showKeyFrame2 = new EasingDoubleKeyFrame(); showKeyFrame2.KeyTime = TimeSpan.FromMilliseconds(125); showKeyFrame2.Value = 90; showKeyFrame2.EasingFunction = quadraticEase; showAnimation.KeyFrames.Add(showKeyFrame1); showAnimation.KeyFrames.Add(showKeyFrame2); Storyboard.SetTargetProperty(showAnimation, new PropertyPath(PlaneProjection.RotationXProperty)); Storyboard.SetTarget(showAnimation, content.Projection); _swivelHide.Children.Add(showAnimation); } } } _swivelHide.Completed += _swivelHide_Completed; _swivelHide.Begin(); }); }
/// <summary> /// Adds an animation corresponding to an specific framework element. /// Thus, the storyboard can be composed piece by piece. /// </summary> /// <param name="element">The framework element.</param> /// <param name="leftToRight"> /// Indicates whether the animation should go /// from left to right or viceversa. /// </param> /// <param name="storyboard">A reference to the storyboard.</param> private static void ComposeStoryboard(FrameworkElement element, bool leftToRight, ref Storyboard storyboard) { double xPosition = SlideInEffect.GetLineIndex(element) * ProportionalOffset; double from = leftToRight ? xPosition : -xPosition; TranslateTransform translateTransform = SlideInEffect.GetAttachedTransform(element); DoubleAnimationUsingKeyFrames animation = new DoubleAnimationUsingKeyFrames(); LinearDoubleKeyFrame keyFrame1 = new LinearDoubleKeyFrame(); keyFrame1.KeyTime = TimeSpan.Zero; keyFrame1.Value = from; animation.KeyFrames.Add(keyFrame1); LinearDoubleKeyFrame keyFrame2 = new LinearDoubleKeyFrame(); keyFrame2.KeyTime = TimeSpan.FromMilliseconds(BeginTime); keyFrame2.Value = from; animation.KeyFrames.Add(keyFrame2); LinearDoubleKeyFrame keyFrame3 = new LinearDoubleKeyFrame(); keyFrame3.KeyTime = TimeSpan.FromMilliseconds(BreakTime); keyFrame3.Value = from * ExponentialInterpolationWeight; animation.KeyFrames.Add(keyFrame3); EasingDoubleKeyFrame keyFrame4 = new EasingDoubleKeyFrame(); keyFrame4.KeyTime = TimeSpan.FromMilliseconds(EndTime); keyFrame4.Value = 0.0; keyFrame4.EasingFunction = SlideInExponentialEase; animation.KeyFrames.Add(keyFrame4); Storyboard.SetTarget(animation, translateTransform); Storyboard.SetTargetProperty(animation, XPropertyPath); storyboard.Children.Add(animation); }
public override void Begin(Action completionAction) { Storyboard = new Storyboard(); double liCounter = 0; var listBoxItems = ListBox.GetVisualDescendants().OfType<ListBoxItem>().Where(lbi => IsOnCurrentPage(lbi) && lbi.IsEnabled).ToList(); if (HoldSelectedItem && Direction == Directions.Out && ListBox.SelectedItem != null) { //move selected container to end var selectedContainer = ListBox.ItemContainerGenerator.ContainerFromItem(ListBox.SelectedItem); listBoxItems.Remove(selectedContainer); listBoxItems.Add(selectedContainer); } foreach (ListBoxItem li in listBoxItems) { GeneralTransform gt = li.TransformToVisual(RootElement); Point globalCoords = gt.Transform(new Point(0, 0)); double heightAdjustment = li.Content is FrameworkElement ? ((li.Content as FrameworkElement).ActualHeight / 2) : (li.ActualHeight / 2); //double yCoord = globalCoords.Y + ((((System.Windows.FrameworkElement)(((System.Windows.Controls.ContentControl)(li)).Content)).ActualHeight) / 2); double yCoord = globalCoords.Y + heightAdjustment; double offsetAmount = (RootElement.ActualHeight / 2) - yCoord; PlaneProjection pp = new PlaneProjection(); pp.GlobalOffsetY = offsetAmount * -1; pp.CenterOfRotationX = 0; li.Projection = pp; CompositeTransform ct = new CompositeTransform(); ct.TranslateY = offsetAmount; li.RenderTransform = ct; var beginTime = TimeSpan.FromMilliseconds((FeatherDelay * liCounter) + InitialDelay); if (Direction == Directions.In) { li.Opacity = 0; DoubleAnimationUsingKeyFrames daukf = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame edkf1 = new EasingDoubleKeyFrame(); edkf1.KeyTime = beginTime; edkf1.Value = Angle; daukf.KeyFrames.Add(edkf1); EasingDoubleKeyFrame edkf2 = new EasingDoubleKeyFrame(); edkf2.KeyTime = TimeSpan.FromMilliseconds(Duration).Add(beginTime); edkf2.Value = 0; ExponentialEase ee = new ExponentialEase(); ee.EasingMode = EasingMode.EaseOut; ee.Exponent = 6; edkf2.EasingFunction = ee; daukf.KeyFrames.Add(edkf2); Storyboard.SetTarget(daukf, li); Storyboard.SetTargetProperty(daukf, new PropertyPath("(UIElement.Projection).(PlaneProjection.RotationY)")); Storyboard.Children.Add(daukf); DoubleAnimation da = new DoubleAnimation(); da.Duration = TimeSpan.FromMilliseconds(0); da.BeginTime = beginTime; da.To = 1; Storyboard.SetTarget(da, li); Storyboard.SetTargetProperty(da, new PropertyPath("(UIElement.Opacity)")); Storyboard.Children.Add(da); } else { li.Opacity = 1; DoubleAnimation da = new DoubleAnimation(); da.BeginTime = beginTime; da.Duration = TimeSpan.FromMilliseconds(Duration); da.To = Angle; ExponentialEase ee = new ExponentialEase(); ee.EasingMode = EasingMode.EaseIn; ee.Exponent = 6; da.EasingFunction = ee; Storyboard.SetTarget(da, li); Storyboard.SetTargetProperty(da, new PropertyPath("(UIElement.Projection).(PlaneProjection.RotationY)")); Storyboard.Children.Add(da); da = new DoubleAnimation(); da.Duration = TimeSpan.FromMilliseconds(10); da.To = 0; da.BeginTime = TimeSpan.FromMilliseconds(Duration).Add(beginTime); Storyboard.SetTarget(da, li); Storyboard.SetTargetProperty(da, new PropertyPath("(UIElement.Opacity)")); Storyboard.Children.Add(da); } liCounter++; } base.Begin(completionAction); }
public override void OnApplyTemplate() { base.OnApplyTemplate(); root = (Grid)GetTemplateChild("root"); if (root == null) return; hideStoryboard = (Storyboard)GetTemplateChild("HideStoryboard"); hideFrame = (EasingDoubleKeyFrame)GetTemplateChild("hideFrame"); hideFrameY = (EasingDoubleKeyFrame)GetTemplateChild("hideFrameY"); showFrame = (EasingDoubleKeyFrame)GetTemplateChild("showFrame"); showFrameY = (EasingDoubleKeyFrame)GetTemplateChild("showFrameY"); if (hideFrame == null || showFrame == null || hideFrameY == null || showFrameY == null) return; ApplyAnimation(Position); }
void AnimateControlHeight(double from, double to, DependencyProperty heightAttribute) { var sb = new Storyboard(); DoubleAnimationUsingKeyFrames anim = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame key = new EasingDoubleKeyFrame(); key.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)); key.Value = from; anim.KeyFrames.Add(key); key = new EasingDoubleKeyFrame(); key.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400)); key.Value = to; anim.KeyFrames.Add(key); sb.Children.Add(anim); Storyboard.SetTarget(anim, this); Storyboard.SetTargetProperty(anim, new PropertyPath(heightAttribute)); sb.Begin(); }
Storyboard GetExpandParentGridStoryboard() { if( _storyExpandParentGrid == null ) { _storyExpandParentGrid = new Storyboard(); DoubleAnimationUsingKeyFrames anim = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame key = new EasingDoubleKeyFrame(); key.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)); key.Value = 220; anim.KeyFrames.Add(key); key = new EasingDoubleKeyFrame(); key.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400)); key.Value = 290; ; anim.KeyFrames.Add(key); _storyExpandParentGrid.Children.Add(anim); Storyboard.SetTarget(anim, this); Storyboard.SetTargetProperty(anim, new PropertyPath(SavedCommandsControl.GridHeightProperty)); } return _storyExpandParentGrid; }
Storyboard GetCollapseControlStoryboard() { if( _storyCollapseControl == null ) { _storyCollapseControl = new Storyboard(); //sb.Duration = new Duration(TimeSpan.FromSeconds(5)); DoubleAnimationUsingKeyFrames anim = new DoubleAnimationUsingKeyFrames(); //anim.Duration = new Duration(TimeSpan.FromMilliseconds(400)); EasingDoubleKeyFrame key = new EasingDoubleKeyFrame(); key.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)); key.Value = 145; anim.KeyFrames.Add(key); key = new EasingDoubleKeyFrame(); key.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400)); key.Value = 76; anim.KeyFrames.Add(key); _storyCollapseControl.Children.Add(anim); Storyboard.SetTarget(anim, this); Storyboard.SetTargetProperty(anim, new PropertyPath(UserControl.HeightProperty)); _storyCollapseControl.Completed += (a, b) => { UpdateView(false); }; } return _storyCollapseControl; }
Storyboard GetExpandControlStoryboard() { if( _storyExpandControl == null ) { _storyExpandControl = new Storyboard(); DoubleAnimationUsingKeyFrames anim = new DoubleAnimationUsingKeyFrames(); EasingDoubleKeyFrame key = new EasingDoubleKeyFrame(); key.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0)); key.Value = 76; anim.KeyFrames.Add(key); key = new EasingDoubleKeyFrame(); key.KeyTime = KeyTime.FromTimeSpan(TimeSpan.FromMilliseconds(400)); key.Value = 145; anim.KeyFrames.Add(key); _storyExpandControl.Children.Add(anim); Storyboard.SetTarget(anim, this); Storyboard.SetTargetProperty(anim, new PropertyPath(UserControl.HeightProperty)); } return _storyExpandControl; }
void TranslateWithKeyframe(Duration duration, Action action) { var sb = new Storyboard(); sb.Duration = duration; var frames = new DoubleAnimationUsingKeyFrames(); frames.Duration = duration; var keyFrame = new EasingDoubleKeyFrame { Value = uptansform.TranslateX, KeyTime = TimeSpan.FromSeconds(0) }; frames.KeyFrames.Add(keyFrame); keyFrame = new EasingDoubleKeyFrame { Value = 480, KeyTime = TimeSpan.FromSeconds(0.2) }; frames.KeyFrames.Add(keyFrame); keyFrame = new EasingDoubleKeyFrame { Value = 480, KeyTime = TimeSpan.FromSeconds(0.4) }; frames.KeyFrames.Add(keyFrame); keyFrame = new EasingDoubleKeyFrame { Value = 0, KeyTime = TimeSpan.FromSeconds(0.6) }; frames.KeyFrames.Add(keyFrame); Storyboard.SetTarget(frames, uptansform); Storyboard.SetTargetProperty(frames, new PropertyPath(CompositeTransform.TranslateXProperty)); sb.Children.Add(frames); sb.Begin(); sb.Completed += (o, a) => { sb.Stop(); sb.Children.Clear(); sb = null; frames.KeyFrames.Clear(); frames = null; uptansform.TranslateX = 0; if (action != null) action(); }; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/Zires%20Explorer;component/MainPage.xaml", System.UriKind.Relative)); this.Zires = ((Microsoft.Phone.Controls.PhoneApplicationPage)(this.FindName("Zires"))); this.Open_OpenWithAnimation = ((System.Windows.Media.Animation.Storyboard)(this.FindName("Open_OpenWithAnimation"))); this.Close_OpenWithAnimation = ((System.Windows.Media.Animation.Storyboard)(this.FindName("Close_OpenWithAnimation"))); this.Open_MainMenu = ((System.Windows.Media.Animation.Storyboard)(this.FindName("Open_MainMenu"))); this.easingDoubleKeyFrame_1 = ((System.Windows.Media.Animation.EasingDoubleKeyFrame)(this.FindName("easingDoubleKeyFrame_1"))); this.Close_MainMenu = ((System.Windows.Media.Animation.Storyboard)(this.FindName("Close_MainMenu"))); this.easingDoubleKeyFrame_2 = ((System.Windows.Media.Animation.EasingDoubleKeyFrame)(this.FindName("easingDoubleKeyFrame_2"))); this.Open_HoldMenu = ((System.Windows.Media.Animation.Storyboard)(this.FindName("Open_HoldMenu"))); this.Close_HoldMenu = ((System.Windows.Media.Animation.Storyboard)(this.FindName("Close_HoldMenu"))); this.Open_Start = ((System.Windows.Media.Animation.Storyboard)(this.FindName("Open_Start"))); this.longListSelectorItem = ((System.Windows.Style)(this.FindName("longListSelectorItem"))); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.seperator = ((System.Windows.Controls.RowDefinition)(this.FindName("seperator"))); this.explorer_1 = ((System.Windows.Controls.Grid)(this.FindName("explorer_1"))); this.list = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("list"))); this.selectionList = ((Microsoft.Phone.Controls.LongListMultiSelector)(this.FindName("selectionList"))); this.home_2 = ((Coding4Fun.Phone.Controls.RoundButton)(this.FindName("home_2"))); this.pathPanel_2 = ((System.Windows.Controls.TextBox)(this.FindName("pathPanel_2"))); this.explorer_2 = ((System.Windows.Controls.Grid)(this.FindName("explorer_2"))); this.list_2 = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("list_2"))); this.selectionList_2 = ((Microsoft.Phone.Controls.LongListMultiSelector)(this.FindName("selectionList_2"))); this.seperatorControler = ((System.Windows.Controls.Primitives.ToggleButton)(this.FindName("seperatorControler"))); this.home = ((Coding4Fun.Phone.Controls.RoundButton)(this.FindName("home"))); this.pathPanel = ((System.Windows.Controls.TextBox)(this.FindName("pathPanel"))); this.statusBar = ((System.Windows.Controls.Grid)(this.FindName("statusBar"))); this.numbersOfItem = ((System.Windows.Controls.TextBlock)(this.FindName("numbersOfItem"))); this.selectedItem = ((System.Windows.Controls.TextBlock)(this.FindName("selectedItem"))); this.MainMenu = ((System.Windows.Controls.Grid)(this.FindName("MainMenu"))); this.planeProjectionMainMenu = ((System.Windows.Media.PlaneProjection)(this.FindName("planeProjectionMainMenu"))); this.menuScrooll = ((System.Windows.Controls.ScrollViewer)(this.FindName("menuScrooll"))); this.menuScroollContentPlaneProjection = ((System.Windows.Media.PlaneProjection)(this.FindName("menuScroollContentPlaneProjection"))); this.Thumbnails_view = ((System.Windows.Controls.Button)(this.FindName("Thumbnails_view"))); this.Details_view = ((System.Windows.Controls.Button)(this.FindName("Details_view"))); this.search = ((System.Windows.Controls.Button)(this.FindName("search"))); this.new_folder = ((System.Windows.Controls.Button)(this.FindName("new_folder"))); this.cut = ((System.Windows.Controls.Button)(this.FindName("cut"))); this.copy = ((System.Windows.Controls.Button)(this.FindName("copy"))); this.paste = ((System.Windows.Controls.Button)(this.FindName("paste"))); this.delete = ((System.Windows.Controls.Button)(this.FindName("delete"))); this.rename = ((System.Windows.Controls.Button)(this.FindName("rename"))); this.selectall = ((System.Windows.Controls.Button)(this.FindName("selectall"))); this.selectnone = ((System.Windows.Controls.Button)(this.FindName("selectnone"))); this.properties = ((System.Windows.Controls.Button)(this.FindName("properties"))); this.pintostart = ((System.Windows.Controls.Button)(this.FindName("pintostart"))); this.refresh = ((System.Windows.Controls.Button)(this.FindName("refresh"))); this.exit = ((System.Windows.Controls.Button)(this.FindName("exit"))); this.settings = ((System.Windows.Controls.Button)(this.FindName("settings"))); this.asd = ((System.Windows.Controls.TextBlock)(this.FindName("asd"))); this.openWithList = ((System.Windows.Controls.Grid)(this.FindName("openWithList"))); this.OpenWithForAnimation = ((System.Windows.Media.PlaneProjection)(this.FindName("OpenWithForAnimation"))); this.ziresPlayerButton = ((System.Windows.Controls.Button)(this.FindName("ziresPlayerButton"))); this.phonePlayerButton = ((System.Windows.Controls.Button)(this.FindName("phonePlayerButton"))); this.playInBackground = ((System.Windows.Controls.Button)(this.FindName("playInBackground"))); this.openWithClose = ((Coding4Fun.Phone.Controls.RoundButton)(this.FindName("openWithClose"))); this.menuControl = ((System.Windows.Controls.Grid)(this.FindName("menuControl"))); this.planeprojectionHoldMenu = ((System.Windows.Media.PlaneProjection)(this.FindName("planeprojectionHoldMenu"))); this.Menu = ((Microsoft.Phone.Controls.LongListSelector)(this.FindName("Menu"))); this.startControl = ((System.Windows.Controls.Grid)(this.FindName("startControl"))); this.Start = ((System.Windows.Controls.Grid)(this.FindName("Start"))); this.startPlaneProjection = ((System.Windows.Media.PlaneProjection)(this.FindName("startPlaneProjection"))); this.start = ((Microsoft.Phone.Controls.LongListMultiSelector)(this.FindName("start"))); this.recentPlaces = ((Microsoft.Phone.Controls.LongListMultiSelector)(this.FindName("recentPlaces"))); }
private void Animate(double begin, double end) { var da = new DoubleAnimationUsingKeyFrames(); da.Completed += (s, e) => { foreach (object ob in Items) { ((PanoramaItem) ob).RenderTransform = new TranslateTransform(RenderTranslateTransform(ob).X, RenderTranslateTransform(ob).Y); } }; var e0 = new EasingDoubleKeyFrame(begin, KeyTime.FromTimeSpan(TimeSpan.Zero)) { EasingFunction = new BackEase { EasingMode = EasingMode.EaseOut, Amplitude = 0.5 } }; da.KeyFrames.Add(e0); var e1 = new EasingDoubleKeyFrame(end, KeyTime.FromTimeSpan(TimeSpan.FromSeconds(0.6))) { EasingFunction = new BackEase { EasingMode = EasingMode.EaseOut, Amplitude = 0.5 } }; da.KeyFrames.Add(e1); foreach (object ob in Items) { RenderTranslateTransform(ob).BeginAnimation(TranslateTransform.XProperty, da, HandoffBehavior.SnapshotAndReplace); } }